npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@backtest-kit/sidekick

v3.8.0

Published

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.

Readme

🧿 @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

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:

| Regime | Condition | |--------|-----------| | AllowLong | ADX > 25, MACD histogram > 0, DI+ > DI-, RSI > 50 | | AllowShort | ADX > 25, MACD histogram < 0, DI- > DI+, RSI < 50 | | AllowBoth | Strong trend but no clear bull/bear regime | | NoTrades | ADX ≤ 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

| Frame | Period | Market Note | |-------|--------|-------------| | February2024 | Feb 1–29, 2024 | Bull run | | October2025 | Oct 1–31, 2025 | Sharp drop Oct 9–11 | | November2025 | Nov 1–30, 2025 | Sideways with downtrend | | December2025 | Dec 1–31, 2025 | Sideways, 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

| Package | Purpose | |---------|---------| | backtest-kit | Core backtesting/trading framework | | @backtest-kit/pinets | Pine Script v5 runtime for Node.js | | @backtest-kit/ui | Interactive charting dashboard | | @backtest-kit/ollama | LLM inference integration | | ccxt | Binance exchange connectivity | | functools-kit | singleshot, randomString utilities | | pinolog | File-based structured logging | | openai | OpenAI API client | | ollama | Ollama local LLM client |

🔗 Links

🤝 Contribute

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

📜 License

MIT © tripolskypetr