Skip to main content

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.

Backtest Kit is a production-ready TypeScript framework that solves the fundamental challenges of building reliable algorithmic trading systems. Unlike research-focused libraries, it provides battle-tested solutions for the real-world problems that emerge when moving from backtesting to live trading — identical code runs in both environments without modification.

Quickstart

Get a working backtest running in under 5 minutes with a real strategy example.

Installation

Install via CLI scaffold, Sidekick, Docker, or manual npm setup.

Core Concepts

Understand signal lifecycle, execution context, and position management.

API Reference

Full reference for all schemas, commit functions, and event listeners.

Why Backtest Kit?

Most trading frameworks force you to choose between research speed and production reliability. Backtest Kit bridges this gap with an architecture that guarantees correctness at every layer.

Type-Safe States

Signal lifecycle enforced by TypeScript discriminated unions — invalid states are unrepresentable at compile time.

No Look-Ahead Bias

Ambient temporal context via AsyncLocalStorage makes it impossible to accidentally use future data.

Crash-Safe

Atomic file writes and transactional broker commits ensure your bot recovers cleanly from any failure.

AI-Native

First-class LLM integration with 10+ providers, structured output enforcement, and token rotation.

Parallel Execution

Run 9+ symbols concurrently in a single Node.js process — ~6,300× real-time aggregate speed.

Pine Script

Execute TradingView Pine Script v5/v6 indicators directly in Node.js without rewriting.

Get Started

1

Scaffold a new project

Use the CLI to generate a fully configured project in seconds:
npx @backtest-kit/cli --init --output my-trading-bot
cd my-trading-bot
npm install
2

Register your schemas

Define your exchange data source, backtest timeframe, and strategy logic:
import { addExchangeSchema, addFrameSchema, addStrategySchema } from 'backtest-kit';

addExchangeSchema({ exchangeName: 'binance', getCandles: async (...) => [...] });
addFrameSchema({ frameName: 'feb-2026', interval: '1m', startDate: new Date('2026-02-01'), endDate: new Date('2026-02-28') });
addStrategySchema({ strategyName: 'my-strategy', getSignal: async (symbol) => null });
3

Run a backtest

Execute against historical data with a single command:
npx @backtest-kit/cli --backtest ./src/index.ts --symbol BTCUSDT
4

Deploy live

Switch to live trading by changing one flag — your strategy code stays identical:
npx @backtest-kit/cli --live ./src/index.ts --symbol BTCUSDT --ui

Ecosystem

@backtest-kit/cli

Zero-boilerplate CLI runner for backtests, paper trading, and live bots.

@backtest-kit/ui

Real-time web dashboard for signal visualization and manual position control.

@backtest-kit/mongo

Production-grade MongoDB + Redis persistence adapters for all 15 storage contracts.

@backtest-kit/ollama

Universal LLM inference adapter supporting 10+ providers with token rotation.

@backtest-kit/pinets

Run TradingView Pine Script indicators natively in Node.js.

@backtest-kit/signals

50+ technical indicators across 4 timeframes, formatted for LLM consumption.

Build docs developers (and LLMs) love