Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-kit/llms.txt

Use this file to discover all available pages before exploring further.

The @backtest-kit/cli package is a zero-boilerplate CLI runner for backtest-kit strategies. Point it at your strategy file and run backtests, paper trading, or live bots without writing a single line of infrastructure code. Storage, candle caching, signal logging, Telegram notifications, and the web dashboard are all wired up automatically — your project contains only the strategy logic itself.

Key Features

Zero Config

Run a backtest with one command — no exchange registration, runner, or persistence setup code required.

Three Modes

Switch between --backtest, --paper, and --live with graceful SIGINT shutdown built in.

Auto Cache

Warms the OHLCV candle cache for all intervals automatically before the backtest starts.

Web Dashboard

Launch the full @backtest-kit/ui trading dashboard with a single --ui flag — no extra config.

Telegram Alerts

Formatted trade notifications with price charts sent to your channel via --telegram.

Monorepo Ready

Each strategy’s dump/, modules/, and template/ directories are automatically isolated by entry point directory.
All infrastructure code — storage adapters, exchange registration, the runner loop, candle caching — lives inside @backtest-kit/cli. Your project contains only your strategy files. There is nothing to maintain beyond your strategy logic.

Getting Started

Initialize a new project with a single command:
1

Scaffold the project

npx @backtest-kit/cli --init --output backtest-kit-project
The generator creates a ready-to-run project. Library documentation is fetched automatically into docs/lib/ on init.
2

Install dependencies

cd backtest-kit-project
npm install
3

Start running

npm start
The default package.json script wires @backtest-kit/cli as the runner. No additional configuration is needed.

Three Execution Modes

Pass one flag to select the execution mode. The strategy file itself is identical across all three.
# Historical backtest — replays candle data and generates a PNL report
npm start -- --backtest

# Paper trading — runs against live candles with no real orders
npm start -- --paper

# Live trading — connects to your exchange via API keys in .env
npm start -- --live
FlagDescription
--backtestReplay historical OHLCV data and produce a Markdown PNL report
--paperLive candle feed with simulated order fills
--liveReal order execution via your configured exchange adapter

Docker Integration

The CLI can generate a self-contained Docker workspace with a ready-to-use docker-compose.yaml and strategy entry point:
npx @backtest-kit/cli --docker
cd backtest-kit-docker
Start a live bot with environment variables:
MODE=live SYMBOL=TRXUSDT STRATEGY_FILE=./content/feb_2026/feb_2026.strategy.ts \
  docker-compose up -d

docker-compose logs -f
The Docker setup provides automatic restarts and zero-downtime trading out of the box.

Multiple Symbol Parallel

For power users running many symbols concurrently, @backtest-kit/cli supports launching multiple symbols in parallel from a single process. Each symbol’s storage is automatically isolated so signals, dumps, and caches never collide between strategies.
See the @backtest-kit/cli NPM page for full documentation on the --symbols flag and parallel configuration options.

Build docs developers (and LLMs) love