Skip to content

CLI Commands

The CLI ships ~20 commands grouped into four areas: auth & account, strategies & deployment, data & analysis, and maintenance.

Coming soon: tradectl lab

The local lab dashboard (port 9200) will be launched as tradectl lab from the next CLI release. Today, build and run the standalone tradectl-lab binary — see tradectl-lab.


Auth & account

tradectl login

Authenticate with the platform using an API key (read it from stdin to avoid leaking it into shell history):

bash
echo "st_live_<your-key>" | tradectl login

Exchanges the API key for a signed JWT license token (Ed25519, 72 h expiry). The token is cached locally and refreshed automatically.

tradectl logout

Clears the cached license token.

bash
tradectl logout

tradectl auth

Manage exchange API credentials. Supported providers: binance, bybit, okx, hyperliquid, htx, gate, bitget.

bash
tradectl auth set binance     # interactive — prompts for key/secret/passphrase
tradectl auth list            # list configured exchanges
tradectl auth remove binance  # remove credentials for an exchange

OKX and Bitget additionally prompt for a passphrase. Hyperliquid uses an API wallet's address + private key.


Strategies & deployment

tradectl init <name>

Scaffold a new strategy crate.

bash
tradectl init my-strategy

Creates a Rust project with src/lib.rs, src/params.rs, config.json, a unit test, and a STRATEGY.md template. The SDK dependency is resolved automatically (local path or crates.io).

tradectl build

Compile the current strategy crate to a cdylib.

bash
tradectl build              # release build of cdylib

Produces target/release/lib<name>.so (Linux), lib<name>.dylib (macOS), or <name>.dll (Windows). Cargo converts dashes to underscores in the cdylib name.

tradectl run <config>

Run a strategy. Paper or live is selected by isEmulator in the config.

bash
tradectl run config.json
tradectl run config.json --daemon    # detach as background process
tradectl run config.json --dry-run   # validate config + load plugin, do not start
tradectl run config.json --replay data/prepared.bin   # historical replay
FlagDescription
<CONFIG>Path to bot config (positional)
--daemonRun in background as a detached process
--dry-runValidate config and load strategy without starting trading
--replay <FILE>Replay a prepared .bin data file instead of connecting live

tradectl stop

Stop a running bot.

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

Cancels active entry orders. Exits remain on the exchange and positions stay open — protected by their TP/SL until they fire or you close them manually.

tradectl strats

List installed strategy plugins (scans ~/.tradectl/lib/).

bash
tradectl strats

tradectl install <strategy>

Download a strategy from the marketplace. The CLI verifies the SHA256 of the binary against the platform's record before writing.

bash
tradectl install shot-scalper

tradectl upload

Register the current strategy with your platform account.

bash
tradectl upload              # register source
tradectl upload --binary     # also upload the compiled binary

Data & analysis

tradectl backtest

Run a local backtest against a prepared data file.

bash
tradectl backtest \
  -d data/prepared.bin \
  --balance 10000 \
  --leverage 5 \
  --taker-fee 0.0004 \
  -p order_size=0.001 \
  -v
FlagDescriptionDefault
-d, --data <PATH>Prepared data file (.bin, .parquet, .csv, or .jsonl)required
--balance <FLOAT>Initial balance (USD)10000
--leverage <FLOAT>Leverage multiplier1.0
--taker-fee <FLOAT>Taker fee rate0.0004
--maker-fee <FLOAT>Maker fee rate0.0002
--slippage <FLOAT>Slippage as a fraction0.0001
-p, --param <KEY=VAL>Strategy parameter (repeatable)
-v, --verbosePrint individual tradesfalse
--benchProfile latency / throughput / pipeline breakdownfalse

tradectl sweep

Parameter sweep — Cartesian product of ranges, ranked by score.

bash
tradectl sweep \
  -d data/prepared.bin \
  -r entryDistance=0.5:3.0:0.1 \
  -r takeProfit=0.3:1.5:0.1 \
  -p order_size=0.001 \
  --top 20 \
  --min-trades 5
FlagDescriptionDefault
-d, --data <PATH>Prepared data filerequired
-r, --range <KEY=MIN:MAX:STEP>Range to sweep (repeatable)required
-p, --param <KEY=VAL>Fixed parameter (repeatable)
--balance / --leverage / --taker-fee / --maker-fee / --slippageSame as backtest
--top <N>Show top N results20
--min-trades <N>Minimum trades to be eligible5
-o, --output <PATH>Save results as JSON

tradectl prepare

Prepare raw market data into the optimized format.

bash
tradectl prepare \
  --root data/raw \
  --exchange binance \
  --symbol BTCUSDT \
  --interval 2026-01-01:2026-02-01 \
  -o data/prepared.bin
FlagDescription
--root <DIR>Raw data directory
--exchange <NAME>Source exchange (binance, bybit, ...)
--symbol <SYM>Symbol to prepare
--interval <RANGE>Date range (YYYY-MM-DD:YYYY-MM-DD)
--ticker-data <PATH>Or supply a single bookTicker file directly
--trade-data <PATH>Or supply a single trades file directly
--trades-onlySynthesize tickers when bookTicker is unavailable
--ticker-bucket-ms <N>Synthesis bucket size (default 100)
--buffer-ms <N>Windowing buffer (default 20, 0 = off)
-o, --output <PATH>Output (.bin or .parquet)

The CLI emits the TCTL v3 binary format — single-file pack of ticker / trade / kline / depth streams with a footer index for mmap loading. Load time: ~18 µs for the binary format vs ~360 ms for parquet.

tradectl collect

Live WebSocket recorder — captures market data into compressed JSONL files.

bash
tradectl collect binance --symbols BTCUSDT,ETHUSDT --output data/raw/

Writes zstd-compressed .jsonl.zst files. Use tradectl prepare afterward to roll them into the binary format.

tradectl monitor

Connect to a running bot's MonitorBroadcaster (port 9100 by default) and stream events to the terminal. The full UI lives in tradectl-lab at /monitor.

bash
tradectl monitor --url localhost:9100

Maintenance

tradectl config validate

Validate a bot config file without starting it.

bash
tradectl config validate config.json

tradectl run config.json --dry-run does the same thing plus loads the strategy plugin to verify ABI compatibility.

tradectl mcp

Stdio proxy for the bot's embedded MCP server (port 9101). Used to register the bot as an MCP server in Claude Code:

bash
claude mcp add tradectl-bot -- tradectl mcp

See MCP Server.

tradectl update

Update the CLI binary in place from the GitHub Releases channel.

bash
tradectl update

Coming soon

  • tradectl lab — launch the local lab dashboard (port 9200) directly from the CLI. Until then, run the standalone binary as described in tradectl-lab.

tradectl — Automate Crypto Trading