Skip to main content

Module adapters

Module adapters 

Source
Expand description

Adapters between the generic simulation contracts (PathOutcome, PathStatistics) and the strategy-bound SimulationResult / SimulationStatsResult shapes. Backtesting owns the conversion so the simulation layer never has to name a strategy. Adapters between the generic simulation contracts and the strategy-bound result types.

The simulation layer reports a run as optionstratlib_simulation::simulation::PathOutcomes and summarises them as optionstratlib_simulation::simulation::PathStatistics. Backtesting keeps the richer crate::backtesting::results::SimulationResult (carrying a optionstratlib_analytics::pnl::PnL and optional risk metrics) and SimulationStatsResult; this module owns the conversion between the two shapes so that neither simulation nor strategies has to know about it. The aggregate figures of a SimulationStatsResult are always the ones optionstratlib_simulation::simulation::PathStatistics::from_outcomes computes.