backtest-kit-minio-s3-docker supports three running modes. Each has its own entry point inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-minio-s3-docker/llms.txt
Use this file to discover all available pages before exploring further.
src/main/, and each is gated by CLI flags parsed by getArgs(). The mode you choose determines whether the engine simulates against historical candles, places real orders on the exchange, or simulates order execution using live prices without touching your actual account.
Mode overview
Backtest
Replays historical OHLCV data bar-by-bar over the date range defined by the selected frame. No network calls to the exchange during replay — all candle data is served from MinIO cache.
Live
Connects to a live exchange via CCXT and places real orders. Runs
getSignal on each incoming price tick. Use only with tested strategies and appropriate risk settings.Paper
Uses live prices from the exchange but simulates order fills locally. Identical code path to live mode — only order execution is virtual. Ideal for validating a strategy before committing real capital.
CLI flags
Each mode is invoked by passing flags tonpm run start. The --entry flag is a mandatory safety guard; without it the process exits immediately regardless of any other flags.
- Backtest
- Live
- Paper
src/main/backtest.ts. Candles are pre-fetched via warmCandles before the loop starts.Flags parsed by getArgs()
The four flags below are the only ones explicitly declared in src/helpers/getArgs.ts. They are the flags your application code reads via values.*.
| Flag | Description |
|---|---|
--entry | Required. Must be present for any mode to execute. Acts as an accidental-run guard. |
--backtest | Selects historical backtest mode. |
--live | Selects live trading mode. |
--paper | Selects paper trading mode. |
Additional flags consumed by @backtest-kit/cli
The following flags are passed on the command line alongside the mode flags but are consumed by the @backtest-kit/cli runtime layer, not by getArgs(). Because parseArgs is called with strict: false, unknown flags are silently ignored by getArgs() and forwarded transparently.
| Flag | Description |
|---|---|
--ui | Enables the backtest-kit web UI on port :60050. Pass the path to the compiled UI bundle (e.g. ./build/index.cjs). |
--verbose | Enables verbose logging throughout the runtime. |
--no-cache | Disables candle caching (candles are fetched from the exchange on every read). |
--no-flush | Disables the flush-on-shutdown hook. |
--telegram | Enables Telegram notifications for signal events. |
The getArgs() helper
src/helpers/getArgs.ts wraps Node’s built-in parseArgs utility and memoises the result with singleshot so command-line parsing happens exactly once:
getArgs() and checks both values.entry and the mode-specific flag before doing any work. If either is missing, the function returns early with no side-effects:
Backtest mode entry point
src/main/backtest.ts is the historical simulation runner. After confirming the CLI flags it:
- Waits for the Redis index to be ready (
redisService.waitForInit()). - Calls
waitForReady(true)— thetrueargument signals backtest mode to the runtime. - Pre-fetches all candles for the frame’s date range with
warmCandles. - Launches the simulation loop with
Backtest.background().
Live mode entry point
src/main/live.ts connects to the live exchange and drives getSignal on real price ticks. It uses Live.background() instead of Backtest.background(), and calls waitForReady(false) — the false argument puts the runtime into live mode. No warmCandles call is needed; candles are fetched on demand from the exchange.
Paper mode entry point
src/main/paper.ts is structurally identical to live.ts — the same Live.background() call with live prices — but it gates on values.paper instead of values.live. The differentiation between a real order and a paper order is handled internally by the backtest-kit runtime based on the mode flag.
Environment variables for Docker mode
When running viadocker-compose, CLI flags are replaced by environment variables. The @backtest-kit/cli container reads these at startup and translates them into the equivalent flag set:
| Variable | Equivalent flag | Values |
|---|---|---|
MODE | --backtest / --live / --paper | backtest | live | paper |
ENTRY | --entry | 1 to enable |
STRATEGY_FILE | (path arg) | Path to compiled bundle, default ./build/index.cjs |
SYMBOL | — | Override the trading symbol (e.g. TRXUSDT) |
STRATEGY | — | Override the strategy name |
EXCHANGE | — | Override the exchange name |
FRAME | — | Override the frame name |
UI | --ui | 1 to enable web UI on :60050 |
TELEGRAM | --telegram | 1 to enable Telegram notifications |
VERBOSE | --verbose | 1 for verbose logging |
NO_CACHE | --no-cache | 1 to disable candle caching |
NO_FLUSH | --no-flush | 1 to disable flush on shutdown |
Web UI — passing
--ui ./build/index.cjs (or setting UI=1 in Docker) starts the backtest-kit UI server on port 60050. Open http://localhost:60050 in your browser after a backtest completes to browse signal history, PnL curves, and per-bar logs. The Docker healthcheck pings http://localhost:60050/api/v1/health/health_check every 30 seconds to confirm the container is alive.