Skip to content

Deployment

Deploy strategies to live exchanges from the dashboard or CLI.

Prerequisites

  1. Exchange API credentials added to your account
  2. A built and tested strategy

Adding exchange credentials

Via dashboard

  1. DeployCredentialsAdd Credential
  2. Select an exchange — Binance, Bybit, OKX, Hyperliquid, HTX, Gate, or Bitget
  3. Enter API key, secret, and passphrase (OKX, Bitget) or wallet private key (Hyperliquid)
  4. Mark as Testnet if applicable
  5. Test Connection to verify

Via CLI

bash
tradectl auth set binance        # interactive — prompts for key/secret
tradectl auth set okx            # additionally prompts for passphrase
tradectl auth set hyperliquid    # API wallet address + private key

tradectl auth list               # show configured exchanges
tradectl auth remove binance

Credentials are encrypted with AES-256-GCM at rest and only decrypted in-memory during strategy execution.

Deploying a strategy

Via dashboard

  1. DeployNew Deployment
  2. Select a strategy
  3. Select credentials and symbols
  4. Configure parameters
  5. Deploy

Via CLI

bash
tradectl run config.json                  # foreground
tradectl run config.json --daemon         # background (detached)
tradectl run config.json --dry-run        # validate only — load plugin, no orders
tradectl run config.json --replay file.bin # historical replay through the live runner

Set isEmulator: true for paper trading, false for live. Paper mode connects to real exchange market-data WebSockets but simulates all fills locally — no API keys required.

Process model

When the bot starts, the runner spawns a tokio multi-thread runtime with these tasks:

tradectl run config.json
  └── Tokio multi-thread runtime
        ├── Exchange WS — market data → per-symbol callbacks
        ├── Exchange Private WS — order updates → runner
        ├── Per-symbol event loop — gates → strategy → action → execute
        ├── Shadow variant evaluator (own task, optional)
        ├── Monitor WS server (port 9100, broadcast channel)
        ├── MCP HTTP server (port 9101, optional)
        ├── Trade Reporter — batch POST to platform API every 5 s
        ├── Telegram notifier + command bot (30+ commands)
        ├── AI agent (optional, Telegram free-text Q&A)
        ├── Pair selector — periodic re-evaluation (optional)
        └── Metrics reporter — bot snapshots to platform

The exchange adapter is wrapped in a single Arc<dyn MarketAdapter> shared across all tasks — interior mutability lets parallel REST calls fly without an outer mutex.

Managing bots

bash
tradectl strats               # list installed strategy plugins

tradectl stop config.json     # stop a specific bot
tradectl stop all             # stop all bots managed by this CLI

tradectl stop cancels active entry orders. Exits stay on the exchange and positions stay open, protected by their TP/SL until they fire or you close them manually.

Shutdown behavior

TriggerBehavior
SIGTERM / tradectl stop / Telegram /stopCancels entries; exits remain on exchange; positions stay open
Hourly maxLossLimit breachedStrategy stops globally — all symbols
One symbol panicsOnly that symbol stops; other symbols keep running
3+ persistent errors (margin / qty exceeded) within 60 sStrategy stops across all symbols

Monitoring

Open the unified live monitor in tradectl-lab:

http://localhost:9200/monitor

The page is a WebSocket client to the bot's MonitorBroadcaster (port 9100 by default). It works for both paper and live runs and shows:

  • Real-time order fills
  • Current positions and unrealized PnL
  • Per-symbol session, trigger, and shadow state
  • Strategy logs and notifications

The URL field in the UI lets you point it at a remote bot.

Telegram

Configure Telegram for both notifications and the two-way command bot:

json
"telegram": {
    "botToken": "1234:ABC...",
    "chatId": "123456789"
}

The command bot supports 30+ commands — /status, /stop, /positions, /profit, /month, /month_coins, /detailed, /last_month_* variants, and more. With the AI agent enabled, you can also send free-text questions ("how's the bot doing?", "why hasn't ETHUSDT traded?").

Notifications

Notifications fire for trade fills, bot status changes, errors, and shadow-promotion candidates via:

  • Telegram (default)
  • Email (via SendGrid, optional)
  • Webhook (configurable)

Controls (dashboard)

ActionDescription
StopGracefully stop the strategy (cancels entries; exits stay on exchange)
RestartRestart with the same configuration
DeleteStop and remove the deployment

tradectl — Automate Crypto Trading