Skip to main content

Module engine

Module engine 

Source
Expand description

The replay engine.

Single-threaded loop: feeds candles to the brain in order, builds an order from each non-Hold decision, applies slippage and fees, and updates a synthetic per-symbol position. On position-reducing fills (closes or flips) a TradeOutcome is emitted into the result.

§Multi-symbol replay

Each candle is tagged with a symbol. The engine maintains independent Position state per symbol but a single shared cash balance. When Backtest::with_candles is used, every candle is assumed to be for the (single) symbol on the config. For multi-symbol runs use Backtest::with_symbol_candles.

Structs§

Backtest
The replay engine itself. Configure via BacktestConfig, attach a Brain and one or more candle series, then .run().await for the result.