By default Backtest Kit suppresses all internal log output. CallDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-kit/llms.txt
Use this file to discover all available pages before exploring further.
setLogger once at startup — before registering schemas — to route framework messages to console, a structured logger like pino or winston, or any custom sink. The ILogger interface is intentionally minimal: four methods that accept a topic string followed by variadic arguments.
setLogger
An object implementing the
ILogger interface. All four methods are required; use no-op functions to silence specific levels.addExchangeSchema, addStrategySchema, and related functions.
ILogger Interface
General-purpose messages: significant lifecycle events, strategy ticks, signal state changes.
Detailed diagnostic output: intermediate states during candle fetches, indicator calculations, DI service routing.
Informational summaries: successful completions, schema validations, cache hits/misses.
Potentially problematic situations: deprecated usage, missing optional configuration, unexpected conditions that do not stop execution.
Examples
Using console
The simplest approach — route everything to the standard Node.js console:Silent (no logging)
Pass no-op functions to suppress all output:Production-only logging (warn + info only)
Suppress verbose debug/log output in production:Using pino
Additional Startup Utilities
getBacktestTimeframe
Retrieve the current backtest timeframe for a given symbol — the array ofDate objects representing every tick timestamp in the active frame. Throws if called outside of a backtest execution context.
Trading pair symbol (e.g.,
"BTCUSDT").waitForReady
Block until all required schema registries are populated. Useful when schemas are registered asynchronously (lazy imports, remote config, plugin loading).When
true (default), waits for exchange, frame, and strategy schemas to be registered. When false (live mode), only exchange and strategy schemas are required — frames are unused in live mode.Backtest.run / Live.run call will surface a clearer error.
stopStrategy
Gracefully stop a live strategy from generating new signals without force-closing any currently open position. The existing signal continues to monitor TP/SL until natural closure.Trading pair symbol to stop signal generation for.
shutdown
Emit a shutdown signal to all components listening toshutdownEmitter. Use in SIGINT / SIGTERM handlers for graceful process exit.