pub struct SingleLegPathEvaluator<'a, S> { /* private fields */ }Expand description
Evaluates one random walk for a single-leg strategy.
Holds the strategy and its opening premium (the Black-Scholes price of the leg at construction), which every path is measured against.
Implementations§
Source§impl<'a, S> SingleLegPathEvaluator<'a, S>where
S: SingleLegSimulation,
impl<'a, S> SingleLegPathEvaluator<'a, S>where
S: SingleLegSimulation,
Sourcepub fn new(strategy: &'a S) -> Result<Self, BacktestError>
pub fn new(strategy: &'a S) -> Result<Self, BacktestError>
Prices the leg once to fix the opening premium.
§Errors
Returns the SimulationError raised when the strategy has no
single leg or the closed-form price fails.
Opening premium every path is measured against, in quote currency.
Trait Implementations§
Source§impl<'a, S: Debug> Debug for SingleLegPathEvaluator<'a, S>
impl<'a, S: Debug> Debug for SingleLegPathEvaluator<'a, S>
Source§impl<S, X, Y> PathEvaluator<X, Y> for SingleLegPathEvaluator<'_, S>
impl<S, X, Y> PathEvaluator<X, Y> for SingleLegPathEvaluator<'_, S>
Source§type Outcome = SimulationResult
type Outcome = SimulationResult
What one evaluated path produces.
Source§type Error = BacktestError
type Error = BacktestError
What one evaluated path reports when it fails. Read more
Source§fn evaluate_path(
&self,
random_walk: &RandomWalk<X, Y>,
exit: &ExitPolicy,
) -> Result<SimulationResult, BacktestError>
fn evaluate_path( &self, random_walk: &RandomWalk<X, Y>, exit: &ExitPolicy, ) -> Result<SimulationResult, BacktestError>
Auto Trait Implementations§
impl<'a, S> Freeze for SingleLegPathEvaluator<'a, S>
impl<'a, S> RefUnwindSafe for SingleLegPathEvaluator<'a, S>where
&'a S: RefUnwindSafe,
impl<'a, S> Send for SingleLegPathEvaluator<'a, S>
impl<'a, S> Sync for SingleLegPathEvaluator<'a, S>
impl<'a, S> Unpin for SingleLegPathEvaluator<'a, S>
impl<'a, S> UnsafeUnpin for SingleLegPathEvaluator<'a, S>where
&'a S: UnsafeUnpin,
impl<'a, S> UnwindSafe for SingleLegPathEvaluator<'a, S>where
&'a S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.