Skip to main content

Module strategy_simulation

Module strategy_simulation 

Source
Expand description

Simulation orchestration for the single-leg strategies.

LongCall, LongPut, ShortCall and ShortPut are simulated the same way: the leg is re-priced with Black-Scholes at every step of a random walk, the exit policy is checked against the premium move, and the P&L is taken either at the exit or at expiry. This module owns that loop (backtesting composes strategies and simulation; neither may depend on the other) and provides the Simulate implementations for the four strategies. The per-strategy differences are captured by crate::backtesting::strategy_simulation::SingleLegSimulation: the side of the leg and the fee adjustment applied to every mark after the opening one.

Progress over the walks is reported as tracing events, one debug event per evaluated path and an info event at the end, so the caller’s subscriber decides whether and how to show it (ADR-0002 section 6, #538).

Structs§

SingleLegPathEvaluator
Evaluates one random walk for a single-leg strategy.

Traits§

Simulate
Trait for simulating trading strategies across multiple price paths.
SingleLegSimulation
A strategy made of one option leg that can be marked along a price path.

Functions§

simulate_single_leg
Simulates a single-leg strategy across every walk of sim.