This page is the fastest path from zero to a working strategy. You will scaffold a project, register an exchange, define a time frame, wire up a strategy, and run your first backtest — all with real code and no boilerplate to write by hand. The CLI handles the infrastructure; you focus on the signal.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-docs/llms.txt
Use this file to discover all available pages before exploring further.
Scaffold the project
Run the CLI init command to generate a minimal project. All bootstrap wiring lives inside The generated directory contains a preconfigured
@backtest-kit/cli — your project only contains strategy files.package.json, an example strategy entry point under content/, utility scripts, and automatically fetched library documentation under docs/lib/.Register an exchange schema
Open (or create) your strategy entry point — for example The
src/index.ts. Register a data source using addExchangeSchema from backtest-kit. The example below connects to Binance via CCXT.getCandles adapter is the only integration point with your data source. In live mode it fetches from the exchange API; in backtest mode the CLI pre-warms the candle cache so no live calls are made during replay.Register a frame and strategy
A
FrameSchema defines the historical window for your backtest. A StrategySchema defines the interval your strategy ticks on and the getSignal function that produces trading signals.getSignal runs inside an ambient temporal context powered by AsyncLocalStorage. Every call to getCandles inside this function automatically uses the current virtual time — look-ahead bias is structurally impossible.Run the backtest
Point the CLI at your entry file and provide a symbol. The CLI pre-warms the candle cache, replays the frame, calls your You can also add these as Add
getSignal on every tick, and writes a Markdown report when done.package.json scripts for convenience:--ui to launch the interactive web dashboard at http://localhost:60050, and --telegram to receive formatted trade notifications with price charts in a Telegram channel.View results and switch to live trading
After the backtest finishes, a Markdown report is written to The same entry file, the same schemas, and the same
./dump/ containing PNL, Sharpe Ratio, win rate, Max Drawdown, and per-signal details. Inspect it directly or open the UI dashboard.When you’re ready to go live, change one flag:getSignal function drive all three modes. For live order placement, drop a modules/live.module.ts file that calls Broker.useBrokerAdapter() — the CLI loads it automatically before starting the live run.Complete Minimal Example
Here is the full minimal entry point that combines all the steps above into a single file — ready to run with the CLI.The reference implementation for a production-ready strategy is the AI news sentiment bot — a fully working system with LLM forecasting, multi-timeframe data, and a documented February 2026 backtest that achieved +16.99% during a -16.4% market month. Start from there when you’re ready to move beyond the minimal scaffold.
Next Steps
Signal Lifecycle
Understand how a signal moves from
getSignal through validation, scheduling, activation, partial commits, and final close.Running Backtests
Learn how to configure frames, warm candle caches, generate reports, and compare strategies with the Walker A/B tool.
Examples
Explore real strategy implementations: neural networks, Pine Script breakouts, LLM sentiment, DCA ladders, and more.