This guide takes you from a fresh clone to a running 9-symbol parallel backtest. The entire flow — infrastructure, build, and first run — typically completes in under ten minutes on a machine with a working Docker daemon and Node.js installation.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.
Prerequisites
Before you begin, make sure the following tools are available on your machine:- Node.js 20 or later (
node --version) - Docker with the Compose plugin (
docker compose version) or standalonedocker-compose - Git (
git --version)
Windows users need the
build:win script (see Step 6). All other steps are identical across platforms.Clone the repository
Clone the template and enter the project root:Alternatively, use the directory as a template by copying it into your own repository — no monorepo changes are required to add new strategies later.
Configure environment variables
Copy the example env file and edit the values for your local setup:The variables and their defaults are:
The docker-compose files in
| Variable | Default | Purpose |
|---|---|---|
CC_MONGO_CONNECTION_STRING | mongodb://localhost:27017/backtest-pro?wtimeoutMS=15000 | Mongo connection used by all DbServices |
CC_REDIS_HOST | 127.0.0.1 | Redis host for BaseMap O(1) lookups |
CC_REDIS_PORT | 6379 | Redis port |
CC_REDIS_USER | default | Redis ACL username |
CC_REDIS_PASSWORD | mysecurepassword | Redis ACL password |
CC_SYMBOL_LIST | BTCUSDT,POLUSDT,ZECUSDT,HYPEUSDT,XAUTUSDT,DOGEUSDT,SOLUSDT,PENGUUSDT,HBARUSDT | Comma-separated symbols for Mode A parallel runner |
docker/mongodb/ and docker/redis/ are pre-configured to match the defaults above, so no edits are needed for a local first run.Start MongoDB
Bring up the MongoDB container in detached mode:Wait for the container to report
healthy before proceeding (docker ps).Start Redis
Bring up the Redis container in detached mode:Both containers must be running before you attempt a backtest run.
Install root dependencies
Install the root-level dependencies (rollup, TypeScript, dev tools):npm workspaces will also hoist shared dependencies visible to both
packages/core and packages/main.Build workspace packages
Build both workspace packages (The underlying shell script (A successful build prints the package directory names and exits with code 0. If either package fails, fix the TypeScript error before proceeding — the runtime will fail to resolve
@pro/core and @pro/main). The build script walks every directory under ./packages/*, runs npm install and npm run build inside each, and emits two artifacts per package:packages/<pkg>/build/index.cjs— CommonJS bundle consumed at runtime viaconfig/alias.config.tspackages/<pkg>/types.d.ts— rolled-up declaration bundle consumed at compile time viatsconfig.jsonpaths
scripts/linux/build.sh) is straightforward:alias.config.ts entries otherwise.Run the parallel backtest (Mode A)
Launch a full 9-symbol parallel backtest using the sample strategy:Flag breakdown:
| Flag | Effect |
|---|---|
--backtest | Activates backtest mode in @pro/main |
--entry | Gates backtest.ts to iterate CC_SYMBOL_LIST and call Backtest.background(symbol, …) for each symbol |
--ui | Starts the @backtest-kit/ui web interface on port 60050 |
--cache | Pre-warms candle data into MongoDB before the runners start |
| (path argument) | Strategy file loaded by @backtest-kit/cli at runtime |
Use
--cache on the first run for every strategy. It pre-warms every symbol’s candles from ccxt into MongoDB so the inner replay loop never blocks on HTTP — this is the primary reason the hot path reaches ~6 300× real-time speed. Subsequent runs can omit --cache if the candles are already present.Observe the output
Each tick printed to stdout follows this pattern from
apr_2026.strategy.ts:backtest=<historicalMs>— the simulated timestamp inside the replay windownow=<wallClockMs>— the actual wall-clock time when the event fired
now= values tells you your effective throughput. On a warm cache, expect ≈ 103 events/sec across 9 symbols on mid-range hardware.Optional: open the web UI
If you passed--ui, the @backtest-kit/ui dashboard is available at:
What’s next
Architecture
Learn how the monorepo, DI container, config layer, and build pipeline fit together.
Mode A Parallel Guide
Configure symbol lists, tune caching, and add new parallel contexts.