Skip to content
@backtest-kit

Backtest Kit

Production-grade algorithmic trading infrastructure for Node.js — backtest, paper, and live trading from a single codebase. Telegram, UI, PineScript GUI, Runner

🧿 backtest-kit

Production-grade algorithmic trading infrastructure for Node.js — from Pine Script execution and LLM signal generation to live exchange connectivity and interactive dashboards. One codebase for backtest, paper, and live trading.

screenshot

Ask DeepWiki npm TypeScript License


🚀 Quick Start

Start here: Clone the reference implementation — a fully working news-sentiment AI trading system with LLM forecasting, multi-timeframe data, and a documented February 2026 backtest.

# Scaffold a new AI agent trading project
npx -y @backtest-kit/cli --init --output my-trading-bot
cd my-trading-bot
npm start

🧩 Ecosystem

Package Description
backtest-kit Core engine — temporal context via AsyncLocalStorage, exchange adapters, risk management, signal lifecycle
@backtest-kit/ui Full-stack dashboard — candlestick charts, signal tracking, PnL analytics, trailing stops visualization
@backtest-kit/signals 50+ technical indicators across 4 timeframes, order book depth, AI-ready markdown reports
@backtest-kit/ollama Multi-provider LLM wrapper (OpenAI, Claude, DeepSeek, Grok, Mistral, Ollama, 10+) with structured output
@backtest-kit/pinets Run TradingView Pine Script v5/v6 locally — 1:1 syntax, 60+ built-in indicators
@backtest-kit/graph Typed DAG execution for multi-timeframe strategies — parallel source nodes, serializable to DB
@backtest-kit/cli CLI for scaffolding AI agent trading projects with CLAUDE.md skill contracts

✨ Core Design Principles

Look-Ahead Bias is Architecturally Impossible

Temporal context flows automatically through AsyncLocalStorage — every getCandles() call is implicitly bounded to the current backtest tick. No timestamp parameters to pass, no future data to accidentally leak.

Same Code, Backtest → Paper → Live

Strategy functions are unaware of execution mode. Switch from historical simulation to real exchange connectivity by changing one flag.

LLM as Signal Generator

The framework provides structured pipelines for injecting multi-timeframe technical analysis, order book data, and news sentiment into LLM context — while keeping temporal isolation and validation invariants intact.

Pine Script indicators if you want to

Port your existing TradingView strategies to Node.js without rewriting a single line — @backtest-kit/pinets executes Pine Script v5/v6 locally via the PineTS runtime, extracts plot values into typed objects, and feeds them directly into the signal pipeline alongside LLM-generated signals.


📚 Articles

A series of in-depth articles documenting the engineering decisions behind the framework:

  1. Look-Ahead Bias — How AsyncLocalStorage makes temporal contamination architecturally impossible
  2. Second-Order Chaos — Why thousands of identical bots trade against themselves at a loss
  3. Claude Trader — How AI gets hands for autonomous strategy iteration via Claude Code
  4. Option Hedging — Why the price drops in a single candle and how to adapt
  5. AI Strategy Workflow — AI workflow for identifying and updating liquidation cascade criteria
  6. AI Strategy Blueprint — ReAct-pattern LLM trading agent with live test results
  7. AI News Trading Signals — News sentiment analysis as a trading signal: methodology and backtest
  8. AI Liquidity Harvesting — How to detect and invert manipulative Telegram signal channels
  9. Pine Script Local Markets — Running Pine Script on exchanges not available in TradingView
  10. DCA Averaging Strategy — Asset price averaging mechanics, drawdown reality, and broker deception

🧠 Concepts

Architectural and infrastructure concepts behind the framework:

  1. Monorepo Parallel Execution — Declarative event-driven strategies in a monorepo, N entry points per mode, ~700× replay speed per symbol
  2. Zero Expectation Escape — Why every strategy decays to zero EV and how to trade on external capital inflow instead
  3. Manual Control Adapter — Debugging the exchange adapter in an hour via dashboard buttons that pull the same hooks as the strategy
  4. Highload Candle Storage — MinIO vs MongoDB vs PostgreSQL + Pgpool-II for 260M candles, and what Redis lookup actually buys
  5. AI Signal Scoring Agent — MCP agent that trades Telegram signals in paper mode and rates authors by real Sharpe/Calmar, not their screenshots

🔗 Links


MIT © tripolskypetr

Pinned Loading

  1. ai-trading-mcp ai-trading-mcp Public

    MCP-driven crypto trading rig: Claude (or any MCP client) trades a live portfolio through three guarded tools: get_status, open_position, close_position. Capable to read news and charts. Paper and …

    TypeScript 1 1

  2. backtest-kit-redis-mongo-docker backtest-kit-redis-mongo-docker Public

    A production-grade integration of backtest-kit that replaces the default file-based persistence with MongoDB as the source of truth and Redis as an O(1) lookup cache, packaged with docker-compose f…

    TypeScript 1 3

  3. QFChart QFChart Public

    QuantForgeOrg chart source code dumped before PineTS has been acquired by LuxAlgo

    TypeScript 9 3

  4. backtest-monorepo-parallel backtest-monorepo-parallel Public

    ⚡ 6300× real-time crypto backtesting: 9 symbols in parallel, one Node process. TypeScript monorepo for backtest-kit with a zero-import DI runtime, Mongo + Redis lookup

    TypeScript 1 3

  5. quantforge-indicators quantforge-indicators Public

    QuantForgeOrg technical indicators dumped before PineTS has been acquired by LuxAlgo

    TypeScript 4 2

  6. backtest-ollama-crontab backtest-ollama-crontab Public

    A TypeScript monorepo demonstrating how to code Ollama outline-based risk filter, with a 15-minute crontab doing live and backtest both Telegram-channel ingestion. Parses signals from a public Tele…

    TypeScript 3

Repositories

Showing 10 of 16 repositories
  • backtest-kit.github.io Public

    The backtest-kit onboarding guide. Includes technical details and articles required to bootstrap your project

    backtest-kit/backtest-kit.github.io's past year of commit activity
    HTML 0 0 0 0 Updated Sep 11, 2026
  • ai-trading-mcp Public

    MCP-driven crypto trading rig: Claude (or any MCP client) trades a live portfolio through three guarded tools: get_status, open_position, close_position. Capable to read news and charts. Paper and live.

    backtest-kit/ai-trading-mcp's past year of commit activity
    TypeScript 1 1 0 0 Updated Sep 10, 2026
  • uzse-backtest-app Public

    A toolkit for collecting trade data from UZSE (Uzbekistan Stock Exchange), building OHLCV candlesticks, and running Pine Script technical analysis indicators on exchanges not supported by TradingView.

    backtest-kit/uzse-backtest-app's past year of commit activity
    TypeScript 0 2 0 0 Updated Sep 10, 2026
  • backtest-ollama-crontab Public

    A TypeScript monorepo demonstrating how to code Ollama outline-based risk filter, with a 15-minute crontab doing live and backtest both Telegram-channel ingestion. Parses signals from a public Telegram channel, asks the LLM whether each signal is safe to trade

    backtest-kit/backtest-ollama-crontab's past year of commit activity
    TypeScript 0 3 0 0 Updated Sep 10, 2026
  • backtest-monorepo-parallel Public

    ⚡ 6300× real-time crypto backtesting: 9 symbols in parallel, one Node process. TypeScript monorepo for backtest-kit with a zero-import DI runtime, Mongo + Redis lookup

    backtest-kit/backtest-monorepo-parallel's past year of commit activity
    TypeScript 1 3 0 0 Updated Sep 10, 2026
  • backtest-kit-redis-postgres-pgpool-docker Public

    backtest-kit persistence on PostgreSQL (TypeORM) + Redis cache, with atomic ON CONFLICT upserts and a Pgpool-II replica cluster for dev.

    backtest-kit/backtest-kit-redis-postgres-pgpool-docker's past year of commit activity
    TypeScript 0 MIT 2 0 0 Updated Sep 10, 2026
  • backtest-kit-redis-mongo-docker Public

    A production-grade integration of backtest-kit that replaces the default file-based persistence with MongoDB as the source of truth and Redis as an O(1) lookup cache, packaged with docker-compose for one-command deploys.

    backtest-kit/backtest-kit-redis-mongo-docker's past year of commit activity
    TypeScript 1 MIT 3 0 0 Updated Sep 10, 2026
  • backtest-kit-minio-s3-docker Public

    Backtest-kit persistence on MinIO (S3) as the source of truth with Redis as a time-ordered index

    backtest-kit/backtest-kit-minio-s3-docker's past year of commit activity
    TypeScript 0 MIT 1 0 0 Updated Sep 10, 2026
  • .github Public
    backtest-kit/.github's past year of commit activity
    0 0 0 0 Updated Sep 3, 2026
  • wallet-manager Public

    Binance spot wallet toolkit with an interactive REPL and reference broker-adapter flows for backtest-kit. Encodes the correct order-management sequence (cancel pending orders, verify the book is clean, then sell; poll-with-timeout, market fallback, clientOrderId reconcile) so an adapter for any exchange can be built on top of it.

    backtest-kit/wallet-manager's past year of commit activity
    TypeScript 0 1 0 0 Updated Jul 23, 2026