The exchange schema is the bridge betweenDocumentation 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-kit’s internal engine and the actual market data source. It is registered once at startup via addExchangeSchema and then resolved by name whenever Backtest.background or Live.background needs to fetch candles, format prices, or retrieve order book depth. The reference implementation in content/apr_2026.strategy/modules/backtest.module.ts uses ccxt.binance in spot mode with rate limiting enabled, but any data source that satisfies the interface will work.
setConfig
Before registering schemas, the module configures two engine-wide risk parameters viasetConfig. These values affect how backtest-kit handles stop-loss distances and breakeven logic across all running symbols.
Maximum allowed distance between entry price and stop-loss as a percentage. Setting this to
100 disables the guard, allowing strategies like apr_2026 to use a 25% hard stop without triggering an engine error.Percentage PnL at which the engine moves the stop-loss to breakeven. Setting this to
0 disables automatic breakeven adjustment, leaving stop management entirely to the strategy’s listenActivePing handlers.addExchangeSchema
Registers a named exchange adapter for use by the parallel runner.Parameters
Unique identifier for this exchange adapter. Must match the
exchangeName passed to Backtest.background or Live.background. In the reference module this is "ccxt-exchange".Fetches historical OHLCV candles for a symbol. Called by the backtest engine to populate the replay buffer.
Fetches the current order book. In live/paper mode this returns real depth data; in backtest mode the function receives
backtest: true and the reference implementation deliberately throws.Fetches aggregated trade records for a time window. Used for trade-level analysis and signal generation in strategies that need sub-candle granularity.
Rounds a raw price to the market’s tick size. The reference implementation fetches the market object from ccxt and calls
roundTicks(price, tickSize) from backtest-kit.Rounds a raw quantity to the market’s step size. Falls back to ccxt’s
amountToPrecision when step size is unavailable.addFrameSchema (brief)
Frame schema registration lives alongside exchange schema registration inmodules/backtest.module.ts. See the Frame Schema page for the full reference. Briefly: addFrameSchema({ frameName, interval, startDate, endDate }) defines the time window and candle interval used by Backtest.background.