Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-monorepo-parallel/llms.txt

Use this file to discover all available pages before exploring further.

backtest-monorepo-parallel is a production-ready TypeScript monorepo template that lets you backtest trading strategies across 9 crypto symbols simultaneously — achieving ~6 300× real-time aggregate replay speed on commodity developer hardware. It wires together a zero-import dependency-injection runtime, MongoDB for durable persistence, and Redis for O(1) candle lookups, all in a single Node process with no IPC overhead.

Quickstart

Build the workspace, spin up infrastructure, and run your first parallel backtest in minutes.

Architecture

Understand the monorepo layout, DI runtime, and how strategy files reach the IoC container without imports.

Mode A: Parallel Runner

Run all 9 symbols concurrently with the --entry flag and cache candles for maximum throughput.

API Reference

Explore BaseCRUD, BaseMap, strategy schemas, and the full IoC container surface.

Why backtest-monorepo-parallel?

Traditional backtesting frameworks fork a process per symbol or serialize symbols sequentially. This template takes a different approach: all Backtest.background(...) calls share one Node event loop, one MongoDB connection pool, and one Redis pool. The result is near-linear scaling with zero subprocess overhead.

6300× Speed

Replays 9 symbols × 27 days of 1m candles in a few minutes of wall time on a laptop.

Zero-Import DI

Strategy files access globalThis.core at evaluation time — no imports, no bundler hooks.

Atomic Writes

Every write*Data() is a single findOneAndUpdate with upsert:true — no application-side locks.

Getting started

1

Spin up infrastructure

Start MongoDB and Redis with the bundled Docker Compose files.
docker-compose -f docker/mongodb/docker-compose.yaml up -d
docker-compose -f docker/redis/docker-compose.yaml up -d
2

Build workspace packages

Compile @pro/core and @pro/main into CJS bundles and rolled-up type declarations.
npm run build        # Linux / macOS
npm run build:win    # Windows
3

Run a parallel backtest

Launch all 9 symbols concurrently with candle pre-warming enabled.
npm run start -- --backtest --entry --ui --cache \
  ./content/apr_2026.strategy/apr_2026.strategy.ts
4

Extend the monorepo

Add new services, strategies, and Mongo collections following the scaling patterns.

Performance at a glance

MetricValue
Aggregate replay speed~6 326× real-time
Event throughput~103 events/sec (one Node process)
Symbols in parallel9 (BTC, POL, ZEC, HYPE, XAUT, DOGE, SOL, PENGU, HBAR)
Candle frame covered2026-04-01 → 2026-04-27 (38 880 candles/symbol × 9)
Hardwarei5-13420H, 16 GB DDR4-3200, NVMe SSD
These numbers were measured with a hot Mongo + Redis cache (candles pre-warmed via --cache). Cold-start times are dominated by the initial CCXT HTTP fetch, not the backtest engine itself.

Build docs developers (and LLMs) love