One of Backtest Kit’s core design goals is strategy portability: the exact sameDocumentation 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.
addStrategySchema code you validated against historical data runs live without any modifications. Switching from a backtest to a live bot is a single function call — replace Backtest.background() with Live.background(). The engine, signal validation, risk checks, VWAP pricing, and persistence layer all stay identical.
Starting the Live Bot
Live.background() launches an infinite loop that calls your strategy’s getSignal at the configured interval, monitors open positions for TP/SL hits, and persists state to disk after every mutation. It returns a stop function you can call to trigger a graceful shutdown.
Crash Recovery
Live trading processes can be killed at any time — by a server restart, an OOM event, or a deployment. Backtest Kit uses a persist-and-restart pattern to make crashes transparent.State is written atomically on every mutation
Every signal state change (
opened → active → closed) is persisted to disk using atomic file writes via writeFileAtomic. A partial write can never corrupt the saved state.waitForInit reloads state on the next startup
When
Live.background() starts, ClientStrategy.waitForInit() reads the last persisted signal from disk before the first tick. If the process was killed mid-trade, the engine resumes monitoring that open position exactly where it left off — no duplicate entries, no missed closes.waitForInit is wrapped with singleshot from functools-kit — it runs exactly once per ClientStrategy instance regardless of how many ticks fire concurrently during startup.Paper Trading
Paper mode runs the full live engine — same strategy, same signal validation, same state machine — but without placing real orders on the exchange. Use it to validate your strategy and broker adapter wiring before committing real capital.Monitoring and Alerts
Event Listeners
Backtest Kit emits typed events for every lifecycle stage. Subscribe before callingLive.background().
Web Dashboard
The@backtest-kit/ui package provides a full-stack dashboard with candlestick charts, signal tracking, and real-time event feeds. Launch it with the --ui flag:
Telegram Alerts
Formatted trade notifications with price charts can be sent directly to a Telegram channel:Live Report Generation
Reports accumulate across the entire running session and can be generated or refreshed at any time.idle, opened, active, closed — and replaces previous entries for the same signalId, so you always see one row per signal in its latest state.
Multi-Symbol Live Trading
The sameLive.background() call works across multiple symbols simultaneously. Each symbol runs its own signal lifecycle and state persistence independently.
Configuration Reference
Environment variables for live mode
Environment variables for live mode
| Variable | Description |
|---|---|
BINANCE_API_KEY | Exchange API key (trade permissions only) |
BINANCE_API_SECRET | Exchange API secret |
CC_MONGO_CONNECTION_STRING | MongoDB URI for production persistence (optional) |
CC_REDIS_HOST | Redis host for O(1) state cache (optional) |
OLLAMA_API_KEY | LLM provider key if using @backtest-kit/ollama |
TELEGRAM_BOT_TOKEN | Telegram bot token for --telegram alerts |