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.
@pro/main contains four self-contained mode modules, each exporting an async main() function. Every main() early-returns unless its required CLI flags are set, so all four modules can be imported unconditionally from packages/main/src/index.ts — only the one whose flags match will actually run.
backtest.ts — --backtest --entry
backtest.ts is the parallel backtesting entry point. It requires both --entry and --backtest to be set. After verifying schema registrations it optionally pre-warms MongoDB with historical candles, then fans out a Backtest.background() worker for every symbol in CC_SYMBOL_LIST.
values.entry && values.backtest — returns immediately if either is false.Passes
true to wait for full DI container readiness and backtest schema registration before proceeding.Returns the registered strategy schema array. Throws
"Strategy not specified" if the array is empty.Returns the registered exchange schema array. Throws
"Exchange not specified" if the array is empty.Returns the registered frame (date range) schema array. Throws
"Frame not specified" if the array is empty.When set, runs
CACHE_CANDLES_FN before the symbol loop to pre-warm MongoDB with 1m OHLCV candles for the exchange’s full startDate–endDate range.Spawns a background backtest worker for each
symbol in CC_SYMBOL_LIST with { exchangeName, strategyName, frameName }.live.ts — --live --entry
live.ts connects to a live exchange and runs the strategy in real time. It requires both --entry and --live. Unlike backtest mode it passes false to waitForReady() — live mode does not need the backtest schema pipeline to be initialized.
Live mode does not accept a
--cache flag and does not require frameName — the exchange streams real-time candles, so no historical frame is needed.values.entry && values.livePasses
false — skips waiting for backtest-specific schema readiness.Spawns a background live-trading worker for each
symbol with { exchangeName, strategyName }. No frameName is required.paper.ts — --paper --entry
paper.ts is structurally identical to live.ts but gates on values.paper instead of values.live. It consumes live market data from the exchange but simulates order fills without placing real orders — useful for validating a strategy before going live.
values.entry && values.paperSame as live mode — passes
false to skip backtest schema readiness.Paper trading reuses the same
Live.background() call as live mode. The simulated-fill behaviour is controlled by the persistence adapter configuration in setup.config.ts, not by a different background function.session.ts — --session
session.ts handles Telegram MTProto authentication. It does not require --entry. When --session is set it creates a TelegramClient from the gram.js library, displays a QR code in the terminal using qrcode-terminal, and saves the resulting session string to ./session.txt for use by ScraperService.
values.session — returns immediately if false.Read from
process.env.CC_TELEGRAM_API_ID. Falls back to the default value in params.ts.Read from
process.env.CC_TELEGRAM_API_HASH. Falls back to the default value in params.ts.Renders a
tg://login?token=... QR code in the terminal. Prompts for a 2FA password via readline if required. Calls onError with a false return to abort without rethrowing.The serialized
StringSession string is written here after a successful login. Pass this value as CC_TELEGRAM_SESSION to subsequent runs so ScraperService can reuse the authenticated session.