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/sidekick is the full-control alternative to @backtest-kit/cli --init. Where CLI init keeps all boilerplate inside the CLI package, Sidekick places every piece of wiring — exchange adapter, frame definitions, risk rules, strategy logic, and the runner script — directly in your project as editable source files. Think of it as ejecting from the CLI init: you get complete visibility and control over the entire setup from day one.

Install and Init

Create a new project with one command:
npx -y @backtest-kit/sidekick my-trading-bot
cd my-trading-bot
npm start
That’s it. You now have a running trading bot with a multi-timeframe Pine Script strategy, risk management validation, partial profit taking, breakeven trailing stops, and a complete LLM integration chain.

What Gets Generated

1

Exchange Adapter

A Binance exchange schema via CCXT (src/logic/exchange/binance.exchange.mjs) with OHLCV candle fetching, order book depth, and tick-precise price and quantity formatting.
2

Frame Definitions

Pre-configured backtest time periods (src/logic/frame/*.frame.mjs) covering February 2024 (bull run), October–December 2025 (drops and sideways markets).
3

Risk Rules

Two distance validation rules (src/logic/risk/) that reject signals where the stop-loss or take-profit is less than 0.2% from entry — protecting against slippage eating the entire move.
4

Strategy Logic

A complete multi-timeframe strategy (src/logic/strategy/main.strategy.mjs) that uses @backtest-kit/graph to run a 4h trend filter and 15m signal generator in parallel.
5

Runner Script

A mode dispatcher (src/main/bootstrap.mjs) that reads CLI arguments and starts the correct engine mode: backtest, paper, or live.

Generated Project Structure

my-trading-bot/
├── src/
│   ├── index.mjs                  # Entry point
│   ├── main/bootstrap.mjs         # Mode dispatcher (backtest / paper / live)
│   ├── config/
│   │   ├── setup.mjs              # Logger, storage, notifications, UI server
│   │   ├── params.mjs             # Environment variables
│   │   └── ccxt.mjs               # Binance exchange singleton via CCXT
│   ├── logic/
│   │   ├── strategy/main.strategy.mjs
│   │   ├── exchange/binance.exchange.mjs
│   │   ├── frame/*.frame.mjs
│   │   ├── risk/sl_distance.risk.mjs
│   │   ├── risk/tp_distance.risk.mjs
│   │   └── action/
│   │       ├── backtest_partial_profit_taking.action.mjs
│   │       ├── backtest_lower_stop_on_breakeven.action.mjs
│   │       └── backtest_position_monitor.action.mjs
│   ├── math/
│   │   ├── timeframe_4h.math.mjs  # 4H trend data — RSI, MACD, ADX
│   │   └── timeframe_15m.math.mjs # 15m signal data — EMA, ATR, volume
│   └── enum/                      # String constants for type-safe schema refs
├── config/source/
│   ├── timeframe_4h.pine          # Pine Script v5 — Daily Trend Filter
│   └── timeframe_15m.pine         # Pine Script v5 — Signal Strategy
├── scripts/
│   ├── run_timeframe_15m.mjs      # Standalone 15m Pine Script runner
│   ├── run_timeframe_4h.mjs       # Standalone 4H Pine Script runner
│   └── cache/
│       ├── cache_candles.mjs      # Pre-download OHLCV candles
│       └── cache_model.mjs        # Pull Ollama LLM model
├── CLAUDE.md                      # AI strategy development guide
├── .env                           # Environment variables with API key placeholders
└── package.json

Pre-Configured Features

Sidekick comes with a full AI and technical analysis stack wired up and ready to use:

LLM Fallback Chain

DeepSeek → Claude → GPT-5 fallback chain pre-configured via @backtest-kit/ollama. Switch providers by changing one line.

50+ Technical Indicators

Complete indicator suite via @backtest-kit/signals — RSI, MACD, Bollinger Bands, ADX, ATR, CCI, Fibonacci, order book depth across 4 timeframes.

Pine Script Strategy

Two Pine Script v5 indicators via @backtest-kit/pinets: a 4H trend filter (RSI + MACD + ADX) and a 15m entry signal generator (EMA crossover + volume + momentum).

Environment Setup

Auto-generated .env with placeholders for all required API keys — Binance, DeepSeek, Anthropic, OpenAI, Telegram.

Sidekick vs CLI Init

Both commands bootstrap a working trading project. The difference is where the wiring lives:
@backtest-kit/cli --init@backtest-kit/sidekick
Bootstrap codeHidden inside @backtest-kit/cliVisible as editable files in your project
Exchange adapterAuto-registered (CCXT Binance default)Explicit file in src/logic/exchange/
Frame definitionsRegistered in your strategy fileSeparate files in src/logic/frame/
Risk rulesDefined in your strategy fileSeparate files in src/logic/risk/
Runner scriptProvided by the CLIsrc/main/bootstrap.mjs in your project
Best forSolo quants, fast iteration, minimal ceremonyTeams, full control, custom architecture
Use CLI init when you want the fastest possible path to a running backtest with minimal files to maintain. Use Sidekick when you need full visibility into every part of the setup, want to customize the runner script, or are building a project that other developers will work in.
Sidekick is the equivalent of “ejecting” from CLI init. Once you run Sidekick, all infrastructure code is in your project and you own it entirely. There is no partial eject — if you want to go back to a leaner setup, start a new CLI init project and copy your strategy logic across.

Build docs developers (and LLMs) love