This guide walks you from a fresh clone to a running parallel backtest across all nine default symbols. The entire sequence takes under five minutes on a machine that already has Docker installed. All commands assume the repository root as the working directory.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-monorepo-parallel/llms.txt
Use this file to discover all available pages before exploring further.
parseArgs (built-in util module) and ESM support used by @backtest-kit/clipackage.jsonnode --version # must be v18.0.0 or higher
docker --version
tsc --version # must be 5.0.0 or higher
git clone https://github.com/theonetrade/backtest-monorepo-parallel.git
cd backtest-monorepo-parallel
Install all root-level and workspace-level dependencies with a single command. npm workspaces will hoist shared packages and link
@pro/core and @pro/main correctly.The repository ships a ready-made Docker Compose file for MongoDB. This starts a standalone Mongo instance on the default port
27017.Similarly, a Redis compose file is provided. Redis runs on port
6379 and is used by BaseMap for O(1) per-key caching.CC_MONGO_CONNECTION_STRINGmongodb://localhost:27017/backtest-pro?wtimeoutMS=15000DbService writesCC_REDIS_HOST127.0.0.1BaseMap lookupsCC_REDIS_PORT6379CC_REDIS_USERdefaultCC_REDIS_PASSWORDmysecurepasswordCC_SYMBOL_LISTBTCUSDT,POLUSDT,ZECUSDT,HYPEUSDT,XAUTUSDT,DOGEUSDT,SOLUSDT,PENGUUSDT,HBARUSDTThe monorepo uses Rollup to build each package in
./packages/* into a CommonJS bundle and a rolled-up type declaration file. Run the build for your platform:Under the hood,
npm run build calls dotenv -e .env -- ./scripts/linux/build.sh, which iterates every directory under packages/ and runs npm run build inside each:#!/bin/bash
cd packages
for D in `find . -maxdepth 1 -not -path "." -not -path "./.*" -type d`
do
cd $D
npm install
npm run build
cd ..
done
cd ..
packages/<pkg>/build/index.cjs — the CommonJS bundle loaded at runtime via config/alias.config.tspackages/<pkg>/types.d.ts — the rolled-up .d.ts bundle resolved at compile time via tsconfig.json pathsWith infrastructure running and packages built, launch the parallel 9-symbol backtest using Mode A with the
--cache flag to pre-warm all candles before the runners start:npm run start -- --backtest --entry --ui --cache \
./content/apr_2026.strategy/apr_2026.strategy.ts
--backtest@pro/main; without it every mode handler early-returns--entrypackages/main/src/main/backtest.ts that iterates CC_SYMBOL_LIST and calls Backtest.background(symbol, …) for each--ui@backtest-kit/ui web dashboard on port 60050--cachecacheCandles(…) for every symbol before the runners start, so the inner loop never blocks on ccxt HTTPThe
--ui flag starts the optional @backtest-kit/ui web dashboard at
http://localhost:60050. You can open it in any browser while the backtest
is running to inspect positions, equity curves, and per-symbol activity in
real time.Omitting
--cache on the first run means the inner loop will call ccxt
over HTTP to fetch 1-minute candles for each symbol as they are needed.
This is significantly slower than the cached path — expect the throughput
to drop from ~103 events/sec to a rate limited by your internet connection
and exchange API rate limits.Once all nine
Backtest.background(...) calls are dispatched, the strategy file begins printing progress to the console. You should see output resembling:active BTCUSDT backtest=1775001720000 now=1779292949309
active SOLUSDT backtest=1775001720000 now=1779292949415
active DOGEUSDT backtest=1775001720000 now=1779292949521
active HBARUSDT backtest=1775001720000 now=1779292949633
...
Running Mode B (Single-Symbol)
If you want to run a single-strategy backtest without the parallel entry gate — letting@backtest-kit/cli manage the symbol dispatch — omit --entry:
--entry, packages/main/src/main/backtest.ts early-returns and the bundled CLI takes over: it loads the strategy file, calls schemas registered inside it, and runs a single backtest on whatever symbol the strategy itself declares.
Next Steps
Architecture
Understand how the two packages are wired together, how
globalThis.core is set up, and how config files bootstrap the
runtime without bundler hooks.Introduction
Read the full feature overview, performance table, and explanation
of why the system is as fast as it is.