Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@backtest-kit/sidekick

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backtest-kit/sidekick

The easiest way to create a new Backtest Kit trading bot project. Like create-react-app, but for algorithmic trading with LLM integration and technical analysis.

latest
Source
npmnpm
Version
10.1.0
Version published
Maintainers
1
Created
Source

🧿 @backtest-kit/sidekick

The easiest way to create a new Backtest Kit trading bot project. Scaffolds a multi-timeframe crypto trading strategy with Pine Script indicators via PineTS runtime, 4H trend filter + 15m signal generator, partial profit taking, breakeven trailing stops, and risk validation.

screenshot

Ask DeepWiki npm License

📚 Backtest Kit Docs | 🌟 GitHub

✨ Features

  • 🚀 Zero Config: Get started with one command - no setup required
  • 📊 Multi-timeframe analysis — 4H daily trend filter (RSI + MACD + ADX) combined with 15m entry signals (EMA crossover + volume spike + momentum)
  • 📜 Pine Script indicators — strategies written in TradingView Pine Script v5, executed locally via @backtest-kit/pinets
  • 🛡️ Risk management — SL/TP distance validation, Kelly-optimized partial profit taking (33/33/34%), breakeven trailing stop
  • 🔄 Position lifecycle — full monitoring with scheduled/opened/closed/cancelled event logging
  • 🔌 Binance integration — OHLCV candles, order book depth, tick-precise price/quantity formatting via CCXT
  • 🕐 Historical frames — predefined backtest periods covering bull runs, sharp drops, and sideways markets
  • 🎨 Web UI dashboard — interactive charting via @backtest-kit/ui
  • 💾 Persistent storage — crash-safe state with atomic persistence for both backtest and live modes

🚀 Quick Start

New to backtest-kit? The fastest way to get a real, production-ready setup is to clone the reference implementation — a fully working news-sentiment AI trading system with LLM forecasting, multi-timeframe data, and a documented February 2026 backtest. Start there instead of from scratch.

Create a New Project

npx -y @backtest-kit/sidekick my-trading-bot
cd my-trading-bot
npm start

That's it! You now have a working trading bot with:

  • Multi-timeframe Pine Script strategy (4H trend + 15m signals)
  • Risk management validation (SL/TP distance checks)
  • Partial profit taking and breakeven trailing stops
  • Cache utilities and debug scripts
  • CLAUDE.md for AI-assisted strategy iteration
  • Environment configuration

🏗️ Generated Project Structure

my-trading-bot/
├── src/
│   ├── index.mjs                  # Entry point — loads config, logic, bootstrap
│   ├── main/bootstrap.mjs         # Mode dispatcher (backtest / paper / live)
│   ├── config/
│   │   ├── setup.mjs              # Logger, storage, notifications, UI server
│   │   ├── validate.mjs           # Schema validation for all enums
│   │   ├── params.mjs             # Environment variables (Ollama API key)
│   │   └── ccxt.mjs               # Binance exchange singleton via CCXT
│   ├── logic/
│   │   ├── strategy/main.strategy.mjs    # Main strategy — multi-TF signal logic
│   │   ├── exchange/binance.exchange.mjs # Exchange schema — candles, order book, formatting
│   │   ├── frame/*.frame.mjs             # Backtest time frames (Feb 2024, Oct–Dec 2025)
│   │   ├── risk/sl_distance.risk.mjs     # Stop-loss distance validation (≥0.2%)
│   │   ├── risk/tp_distance.risk.mjs     # Take-profit distance validation (≥0.2%)
│   │   └── action/
│   │       ├── backtest_partial_profit_taking.action.mjs
│   │       ├── backtest_lower_stop_on_breakeven.action.mjs
│   │       └── backtest_position_monitor.action.mjs
│   ├── classes/
│   │   ├── BacktestPartialProfitTakingAction.mjs  # Scale out at 3 TP levels
│   │   ├── BacktestLowerStopOnBreakevenAction.mjs # Trailing stop on breakeven
│   │   └── BacktestPositionMonitorAction.mjs      # Position event logger
│   ├── math/
│   │   ├── timeframe_4h.math.mjs   # 4H trend data — RSI, MACD, ADX, DI+/DI-
│   │   └── timeframe_15m.math.mjs  # 15m signal data — EMA, ATR, volume, momentum
│   ├── enum/                        # String constants for type-safe schema refs
│   └── utils/getArgs.mjs            # CLI argument parser with defaults
├── config/source/
│   ├── timeframe_4h.pine    # Pine Script v5 — Daily Trend Filter (RSI/MACD/ADX)
│   └── timeframe_15m.pine   # Pine Script v5 — Signal Strategy (EMA/ATR/Volume)
├── 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 (1m/15m/4h)
│       ├── validate_candles.mjs  # Verify cached candle data integrity
│       └── cache_model.mjs       # Pull Ollama LLM model with progress bar
├── docker/ollama/
│   ├── docker-compose.yaml   # Ollama GPU container setup
│   └── watch.sh              # nvidia-smi monitor
├── CLAUDE.md                 # AI strategy development guide
├── .env                      # Environment variables
└── package.json              # Dependencies

💡 Strategy Overview

🎯 4H Trend Filter (timeframe_4h.pine)

Determines the market regime using three indicators:

RegimeCondition
AllowLongADX > 25, MACD histogram > 0, DI+ > DI-, RSI > 50
AllowShortADX > 25, MACD histogram < 0, DI- > DI+, RSI < 50
AllowBothStrong trend but no clear bull/bear regime
NoTradesADX ≤ 25 (weak trend)

⚡ 15m Signal Generator (timeframe_15m.pine)

Generates entry signals with EMA crossover confirmed by volume and momentum:

  • Long: EMA(5) crosses above EMA(13), RSI 40–65, price above EMA(50), volume spike (>1.5x MA), positive momentum
  • Short: EMA(5) crosses below EMA(13), RSI 35–60, price below EMA(50), volume spike, negative momentum
  • SL/TP: Static 2%/3% from entry price
  • Signal expiry: 5 bars

🛡️ Risk Filters

  • Reject signals where SL distance < 0.2% (slippage protection)
  • Reject signals where TP distance < 0.2% (slippage protection)
  • Trend alignment: long signals rejected in bear regime, short signals rejected in bull regime

💹 Position Management

  • Partial profit taking: Scale out at 3 levels — 33% at TP3, 33% at TP2, 34% at TP1
  • Breakeven trailing stop: When breakeven is reached, lower trailing stop by 3 points

🕐 Backtest Frames

FramePeriodMarket Note
February2024Feb 1–29, 2024Bull run
October2025Oct 1–31, 2025Sharp drop Oct 9–11
November2025Nov 1–30, 2025Sideways with downtrend
December2025Dec 1–31, 2025Sideways, no clear direction

💡 CLI Options

# Create project with custom name
npx -y @backtest-kit/sidekick my-bot

# Create in current directory (must be empty)
npx -y @backtest-kit/sidekick .

📋 Dependencies

PackagePurpose
backtest-kitCore backtesting/trading framework
@backtest-kit/pinetsPine Script v5 runtime for Node.js
@backtest-kit/uiInteractive charting dashboard
@backtest-kit/ollamaLLM inference integration
ccxtBinance exchange connectivity
functools-kitsingleshot, randomString utilities
pinologFile-based structured logging
openaiOpenAI API client
ollamaOllama local LLM client

🤝 Contribute

Found a bug or want to add a feature? Open an issue or submit a PR!

📜 License

MIT © tripolskypetr

Keywords

create-backtest-app

FAQs

Package last updated on 31 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts