Skip to content

CLI Reference

ShortLongTypeDefaultDescription
-s--symbolstringsample dataTicker (e.g. AAPL, BTCUSDT). If omitted, chartgen uses random sample data. In --trade mode, defaults to BTCUSDT.
-i--intervalstring4hCandle interval: a number and a unit, such as 1m, 7m, 45m, 4h, 8h, 1d, 2D, 2W, 1M. Above 60 minutes the length must be round. --trade needs an interval Binance streams natively.
-p--panelsstring (repeat)cipher_b, macdIndicator names, bottom to top. Repeat the flag for multiple indicators. See the indicator reference.
-n--barsinteger120Number of bars.
-o--outputstringchart.pngOutput file path (one-shot render mode only).
--widthinteger1920Image width in pixels.
--heightinteger1080Image height in pixels.
--sourcestringautoData source: auto, binance, or yahoo. auto picks by ticker suffix (see below).
--mcpflagoffRun as MCP stdio JSON-RPC server. Use with Claude Desktop.
--serveflagoffRun as remote MCP HTTP server with OAuth 2.1 PKCE. See MCP integration and OAuth.
--portinteger9315HTTP server port, used by both --serve and --trade.
--tradeflagoffStart the trading engine: live WebSocket feed, indicator state manager, order tracker, alert engine, and the same HTTP + OAuth server as --serve. Exposes the 12 trading MCP tools on top of the charting tools. Mutually exclusive with --serve. See the trading guide.
--testnetflagoffMeant to route --trade orders to Binance testnet. Currently a no-op — see the caution in the trading guide.

chartgen replay-fixtures writes replay fixtures from real Binance 1m history and exits. The guide is Replay over real history.

Terminal window
chartgen replay-fixtures --symbols BTCUSDT,ETHUSDT \
--from 2026-08-01 --to 2026-10-31 --out fixtures/2026-q3 [--shift-days 14]
FlagTypeDescription
--symbolsstring, comma-separatedBinance spot symbols. Required.
--fromdate YYYY-MM-DDFirst day of the window, UTC. Required.
--todate YYYY-MM-DDLast day, UTC, included; it must have ended. Required.
--outpathDirectory for one <SYMBOL>.json per symbol. Required.
--shift-daysintegerMove every timestamp by this many days, a multiple of 7. Default 0.
--shift-anyflagAllow a --shift-days that is not a multiple of 7 (weekdays and weekly bars change).

A run writes at most 460 symbol-days (5 symbols over 92 days), the memory a replay server can spare. A rerun keeps the symbols already written for the same window; an --out holding another window is refused. Rate limits are waited out and the page read again, up to 5 times. It exits with status 1 on any error.

chartgen has four modes, picked by the first matching flag in this order (src/main.rs dispatches sequentially and returns early):

  1. --mcp — MCP stdio JSON-RPC, for Claude Desktop.
  2. --serve — HTTP MCP server with OAuth 2.1 PKCE, for Claude.ai (charting tools only).
  3. --trade — trading engine plus the same HTTP + OAuth server as --serve, with the trading tools added.
  4. One-shot render (no mode flag) — fetch data, render chart.png, exit.

--serve and --trade are mutually exclusive; passing both runs only --serve. Use --trade whenever you want the engine — it already serves HTTP.

With --source auto (the default), the ticker suffix picks the provider:

SuffixSource
USDT, BTC, ETHBinance
anything elseYahoo Finance

Force a provider with --source binance or --source yahoo.

Terminal window
chartgen -s BTCUSDT -i 4h -n 200 \
-p ema_stack -p vpvr -p wavetrend \
--width 2560 --height 1440 \
-o btc.png

Live trading engine served over HTTP for Claude.ai:

Terminal window
chartgen --trade --testnet \
--symbol BTCUSDT --interval 1h \
--port 9315 \
-p cipher_b -p rsi_mfi_stoch