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
| Field | Type | Description |
|---|---|---|
api.provider | string | Binance, Bybit, OKX, Hyperliquid, HTX, Gate, Bitget, Paper, or Replay |
api.key | string | Exchange API key (or API wallet address for Hyperliquid) |
api.secret | string | Exchange API secret (or API wallet private key for Hyperliquid) |
api.passphrase | string | Required for OKX and Bitget |
limits.maxLossLimit | number | Hourly max loss (USD) — strategy stops if breached |
db.path | string | Local SQLite path for order persistence |
log.path | string | Log directory |
log.mode | string | console, file, or console_file |
log.level | string | debug, info, warn, error |
monitor.host / monitor.port | string / number | MonitorBroadcaster bind (default 0.0.0.0:9100) |
telegram.botToken / telegram.chatId | string | Telegram notifications + command bot |
mcp | object | Embedded MCP server — see MCP Server |
ai | object | Telegram AI agent — see Telegram AI Agent |
strats | array | Strategy instances |
Strategy entries (strats[])
| Field | Type | Description |
|---|---|---|
name | string | Unique instance name (used in logs and status) |
type | string | Strategy type — must match declare_strategy!("...") |
marketType | string | LINEAR, INVERSE, or SPOT |
isEmulator | boolean | true for paper, false for live |
pairs | string[] | Trading pairs |
leverage | number | Per-strategy leverage |
direction | string | Optional — 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
| Variable | Default | Description |
|---|---|---|
TRADECTL_API_URL | https://tradectl.com | Platform API base URL |
TRADECTL_DOWNLOAD_URL | GitHub Releases | Override binary download location |
ANTHROPIC_API_KEY / OPENAI_API_KEY | — | LLM providers for the Telegram AI agent |
LAB_PORT | 9200 | Lab dashboard port (when running tradectl-lab) |
RUST_LOG | — | Override the runner's log level |
