Skip to content

CLI Configuration

The CLI is driven by a JSON config file. tradectl init generates a starter; tradectl config validate and tradectl run --dry-run check it.

Strategy config files

json
{
    "api": {
        "provider": "Binance",
        "key": "",
        "secret": ""
    },
    "limits": {
        "maxLossLimit": 50
    },
    "db": {
        "path": "./data/orders.db"
    },
    "log": {
        "path": "./logs",
        "mode": "console_file",
        "level": "info"
    },
    "monitor": {
        "host": "0.0.0.0",
        "port": 9100
    },
    "telegram": {
        "botToken": "",
        "chatId": ""
    },
    "mcp": {
        "enabled": false,
        "host": "127.0.0.1",
        "port": 9101
    },
    "strats": [
        {
            "name": "my_strategy-01",
            "type": "my_strategy",
            "marketType": "LINEAR",
            "isEmulator": true,
            "pairs": ["BTCUSDT"],
            "leverage": 10,
            "order_size": 0.001
        }
    ]
}

Top-level fields

FieldTypeDescription
api.providerstringBinance, Bybit, OKX, Hyperliquid, HTX, Gate, Bitget, Paper, or Replay
api.keystringExchange API key (or API wallet address for Hyperliquid)
api.secretstringExchange API secret (or API wallet private key for Hyperliquid)
api.passphrasestringRequired for OKX and Bitget
limits.maxLossLimitnumberHourly max loss (USD) — strategy stops if breached
db.pathstringLocal SQLite path for order persistence
log.pathstringLog directory
log.modestringconsole, file, or console_file
log.levelstringdebug, info, warn, error
monitor.host / monitor.portstring / numberMonitorBroadcaster bind (default 0.0.0.0:9100)
telegram.botToken / telegram.chatIdstringTelegram notifications + command bot
mcpobjectEmbedded MCP server — see MCP Server
aiobjectTelegram AI agent — see Telegram AI Agent
stratsarrayStrategy instances

Strategy entries (strats[])

FieldTypeDescription
namestringUnique instance name (used in logs and status)
typestringStrategy type — must match declare_strategy!("...")
marketTypestringLINEAR, INVERSE, or SPOT
isEmulatorbooleantrue for paper, false for live
pairsstring[]Trading pairs
leveragenumberPer-strategy leverage
directionstringOptional — LONG, SHORT, or BOTH

Any additional fields are passed to the strategy as Params. Sessions activate when session_profit_max, session_profit_min, or session_strat_max is present. Triggers activate when a triggers block is present. Pair selection activates when a pairSelector block is present. Shadow optimization activates when a shadow block is present.

Validate

bash
tradectl config validate config.json
tradectl run config.json --dry-run

--dry-run additionally loads the strategy plugin to verify the ABI matches the runner.

Environment variables

VariableDefaultDescription
TRADECTL_API_URLhttps://tradectl.comPlatform API base URL
TRADECTL_DOWNLOAD_URLGitHub ReleasesOverride binary download location
ANTHROPIC_API_KEY / OPENAI_API_KEYLLM providers for the Telegram AI agent
LAB_PORT9200Lab dashboard port (when running tradectl-lab)
RUST_LOGOverride the runner's log level

tradectl — Automate Crypto Trading