Skip to content

CLI Configuration

Strategy Config Files

Strategy configurations are JSON files. The tradectl init command generates a config.json:

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
    },
    "strats": [
        {
            "name": "my_strategy-01",
            "type": "my_strategy",
            "marketType": "LINEAR",
            "isEmulator": true,
            "pairs": ["BTCUSDT"],
            "order_size": 0.1
        }
    ]
}

Top-Level Fields

FieldTypeDescription
api.providerstringBinance, Bybit, or Hyperliquid
api.keystringExchange API key
api.secretstringExchange API secret
limits.maxLossLimitnumberMax loss before auto-stop (USD)
db.pathstringPath for local orders SQLite database
log.pathstringDirectory for log files
log.modestringconsole, file, or console_file
log.levelstringdebug, info, warn, error
monitor.hoststringMonitor dashboard bind address
monitor.portnumberMonitor dashboard port

Strategy Entries (strats[])

FieldTypeDescription
namestringUnique instance name (used in logs and status)
typestringStrategy type (matches declare_strategy! name)
marketTypestringLINEAR or INVERSE
isEmulatorbooleantrue for paper trading, false for live
pairsstring[]Trading pairs (e.g., ["BTCUSDT", "ETHUSDT"])

Any additional fields in a strat entry are passed to the strategy as parameters via Params.

Validate Config

Check a config file for errors without starting:

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

tradectl — Automate Crypto Trading