pub trait SingleLegSimulation: PnLCalculator + Positionable {
const IS_LONG: bool;
// Provided methods
fn mark_adjustment(&self) -> Result<Positive, BacktestError> { ... }
fn simulated_option(&self) -> Result<&Options, SimulationError> { ... }
}Expand description
A strategy made of one option leg that can be marked along a price path.
Implemented for the four single-leg strategies. The leg is read through
Positionable::get_positions, so the strategy needs no extra state;
the implementation only states the side and the fee adjustment.
Required Associated Constants§
Provided Methods§
Sourcefn mark_adjustment(&self) -> Result<Positive, BacktestError>
fn mark_adjustment(&self) -> Result<Positive, BacktestError>
Amount added to every premium mark after the opening one, in quote
currency. Zero by default; ShortPut adds its fees.
§Errors
Returns SimulationError when the adjustment cannot be computed.
Sourcefn simulated_option(&self) -> Result<&Options, SimulationError>
fn simulated_option(&self) -> Result<&Options, SimulationError>
The single leg of the strategy.
§Errors
Returns SimulationError::InvalidParameters when the strategy
does not hold exactly one position.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".