Overview
Horizon is a complete solution for managing PTN miners and exchange connectivity.
- Watcher: Backend service monitoring exchange orders and forwarding them to PTN
- Easy Miner: Web interface for managing PTN miners and monitoring order flow
Features
Order Watcher
- Real-time order monitoring
- Automated order-to-signal conversion
- Dynamic leverage calculation
- WebSocket status updates
- Exchange sandbox/testnet support
- Modular exchange integration
Easy Miner
Miner Management
- Start/stop miners
- Real-time log viewing
Order Monitoring
- Live order feed
- Status tracking
- Error reporting
Architecture
/├── watcher/ # Exchange monitoring service│ ├── modules/│ │ ├── app/ # Core application logic│ │ ├── ccxt/ # Exchange integration│ │ ├── miner/ # Miner management│ │ ├── order/ # Order processing│ │ └── websocket/ # Real-time updates│ └── routes/ # API endpoints├── easy-miner/ # Web interface│ ├── app/ # Next.js application│ │ ├── actions/ # Server actions│ │ └── store/ # State management│ ├── components/ # UI components│ └── features/ # Feature modules└── config/ # Configuration files
Prerequisites
- Node.js 20+
- Python 3.8+
- PTN installed and configured
- Exchange API credentials
Installation
- Clone the repository
git clone https://github.com/taoshidev/horizon.gitcd horizon
- Install dependencies:
npm install
- Configure the project:
cp config/default.json.example config/default.json
- Update configuration:
{ "port": 8080, "signal-server": "http://127.0.0.1:3005", "ptn-path": "/path/to/your/ptn", "exchange": "", "[exchange-id]": { "apiKey": "your-api-key", "secret": "your-secret", "market": "future", // Optional "password": "", // If required by exchange "demo": false }}
Usage
Development Mode
Start both components:
npm run dev
Start individually:
# Watcher onlynode index.js --exchange [exchange-id]
# Easy Miner onlycd easy-miner && npm run dev
The application automatically starts watching orders on the configured exchanges and processes them into signals.
Exchange Integration
- Create exchange module (
/watcher/modules/exchanges/[exchange-id].js
):
export function transformOrder(order) { return { trade_pair: TradePair[formatSymbol(order)], order_type: determineOrderType(order), };}
export function configureExchange(exchange, config) { // Configure sandbox mode if supported if (typeof exchange.set_sandbox_mode === "function") { exchange.set_sandbox_mode(config.demo); }
// Add any exchange-specific configuration}
// Optional: Custom options for CCXT initializationexport function getOptions() { return { defaultType: "future", // Or other CCXT options };}
- Add to exchange registry (
./watcher/modules/exchanges/index.js
):
import * as customExchange from "./[exchange-id].js";
const exchangeModules = { [exchange-id]: customExchange,};
Signal Processing
File: ./watcher/modules/orders/toSignal.js
Converts orders and balances into signals:
export function toSignal({ id, order, balance }) { const leverage = calculateLeverage(order, balance);
return { trade_pair: order.info.symbol, order_type: order.side.toUpperCase() === "BUY" ? "LONG" : "SHORT", leverage, };}
Production Mode
npm run buildnpm start
Contributing
- Fork the repository
- Create a feature branch
- Submit a pull request
Ensure your PR:
- Includes tests
- Updates documentation
- Maintains code style
- Has clear description
License
MIT License
Support
- GitHub Issues
- Discord: Join
- Email: support@taoshi.io
Built by Taoshi