pub struct SimulationStatsResult {
pub results: Vec<SimulationResult>,
pub total_simulations: usize,
pub profitable_count: usize,
pub loss_count: usize,
pub average_pnl: Decimal,
pub median_pnl: Decimal,
pub std_dev_pnl: Decimal,
pub best_pnl: Decimal,
pub worst_pnl: Decimal,
pub win_rate: Decimal,
pub average_holding_period: Decimal,
}Expand description
Statistics aggregated from multiple simulation runs.
This struct contains a vector of individual simulation results along with aggregate statistics computed across all simulations.
Fields§
§results: Vec<SimulationResult>Individual results from each simulation run
total_simulations: usizeTotal number of simulations performed
profitable_count: usizeNumber of profitable simulations
loss_count: usizeNumber of loss-making simulations
average_pnl: DecimalAverage P&L across all simulations
median_pnl: DecimalMedian P&L across all simulations
std_dev_pnl: DecimalStandard deviation of P&L
best_pnl: DecimalBest (maximum) P&L achieved
worst_pnl: DecimalWorst (minimum) P&L achieved
win_rate: DecimalWin rate (percentage of profitable simulations)
average_holding_period: DecimalAverage holding period across all simulations
Implementations§
Source§impl SimulationStatsResult
impl SimulationStatsResult
Sourcepub fn from_results(
results: Vec<SimulationResult>,
) -> Result<Self, SimulationError>
pub fn from_results( results: Vec<SimulationResult>, ) -> Result<Self, SimulationError>
Builds the aggregate from a set of per-run results.
The statistics are PathStatistics::from_outcomes over the
generic projection of each result; the results themselves are kept
for the per-run report.
§Errors
Propagates the errors of PathStatistics::from_outcomes.
Sourcepub fn from_outcomes(
outcomes: Vec<PathOutcome>,
) -> Result<Self, SimulationError>
pub fn from_outcomes( outcomes: Vec<PathOutcome>, ) -> Result<Self, SimulationError>
Builds the aggregate from a generic run.
Each outcome is lifted into a SimulationResult through
From<PathOutcome>; the statistics are computed on the outcomes
before the lift so a None P&L is counted the same way either
entry point is used.
§Errors
Propagates the errors of PathStatistics::from_outcomes.
Trait Implementations§
Source§impl Clone for SimulationStatsResult
impl Clone for SimulationStatsResult
Source§impl Debug for SimulationStatsResult
impl Debug for SimulationStatsResult
Source§impl Default for SimulationStatsResult
impl Default for SimulationStatsResult
Source§impl<'de> Deserialize<'de> for SimulationStatsResult
impl<'de> Deserialize<'de> for SimulationStatsResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SimulationStatsResult
impl Display for SimulationStatsResult
Auto Trait Implementations§
impl Freeze for SimulationStatsResult
impl RefUnwindSafe for SimulationStatsResult
impl Send for SimulationStatsResult
impl Sync for SimulationStatsResult
impl Unpin for SimulationStatsResult
impl UnsafeUnpin for SimulationStatsResult
impl UnwindSafe for SimulationStatsResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
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> ⓘ
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.