pub trait PathEvaluator<X, Y>{
type Outcome;
type Error: From<SimulationError>;
// Required method
fn evaluate_path(
&self,
walk: &RandomWalk<X, Y>,
exit: &ExitPolicy,
) -> Result<Self::Outcome, Self::Error>;
}Expand description
Evaluates one simulated price path.
Implementors decide what a path is worth; the simulation layer only
generates the paths and, through evaluate_paths, drives the
evaluator over each of them. Outcome is usually PathOutcome so
the result can be summarised by PathStatistics, but any type is
admissible for evaluators with their own reporting.
§Type Parameters
X- Time-step type of the walk.Y- Price type of the walk.
Required Associated Types§
Sourcetype Error: From<SimulationError>
type Error: From<SimulationError>
What one evaluated path reports when it fails.
The evaluator lives in the caller’s layer, so it reports the caller’s
error: a backtest reports BacktestError, keeping the strategy and
simulation causes typed, without simulation naming either.
Required Methods§
Sourcefn evaluate_path(
&self,
walk: &RandomWalk<X, Y>,
exit: &ExitPolicy,
) -> Result<Self::Outcome, Self::Error>
fn evaluate_path( &self, walk: &RandomWalk<X, Y>, exit: &ExitPolicy, ) -> Result<Self::Outcome, Self::Error>
Evaluates walk under exit.
§Errors
Implementation-defined; typically a pricing failure or an invalid step along the walk.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".