#[non_exhaustive]pub struct MonteCarloConfig {
pub num_simulations: usize,
pub seed: Option<u64>,
pub method: MonteCarloMethod,
}Expand description
Configuration for Monte Carlo simulation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.num_simulations: usizeNumber of reshuffled equity-curve simulations to run.
Higher values give more stable percentile estimates but take longer.
Default: 1000.
seed: Option<u64>Optional seed for the PRNG, enabling reproducible results.
None (default) uses a fixed internal seed (12345). Provide an
explicit seed when you need deterministic output across runs.
method: MonteCarloMethodResampling method. Default: MonteCarloMethod::IidShuffle.
Implementations§
Source§impl MonteCarloConfig
impl MonteCarloConfig
Sourcepub fn num_simulations(self, n: usize) -> Self
pub fn num_simulations(self, n: usize) -> Self
Set the number of simulations.
Sourcepub fn method(self, method: MonteCarloMethod) -> Self
pub fn method(self, method: MonteCarloMethod) -> Self
Set the resampling method.
Sourcepub fn run(&self, result: &BacktestResult) -> MonteCarloResult
pub fn run(&self, result: &BacktestResult) -> MonteCarloResult
Run the Monte Carlo simulation against a completed backtest result.
Extracts trade returns, generates num_simulations synthetic sequences
using the configured MonteCarloMethod, rebuilds a synthetic equity
curve for each, and reports percentile statistics over all outcomes.
If the result has fewer than 2 trades, every percentile is derived from the single observed result.
Use the percentile outputs as a relative stress-test tool rather than a precise probability statement about future performance.
Trait Implementations§
Source§impl Clone for MonteCarloConfig
impl Clone for MonteCarloConfig
Source§fn clone(&self) -> MonteCarloConfig
fn clone(&self) -> MonteCarloConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MonteCarloConfig
impl Debug for MonteCarloConfig
Source§impl Default for MonteCarloConfig
impl Default for MonteCarloConfig
Source§impl<'de> Deserialize<'de> for MonteCarloConfig
impl<'de> Deserialize<'de> for MonteCarloConfig
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>,
Auto Trait Implementations§
impl Freeze for MonteCarloConfig
impl RefUnwindSafe for MonteCarloConfig
impl Send for MonteCarloConfig
impl Sync for MonteCarloConfig
impl Unpin for MonteCarloConfig
impl UnsafeUnpin for MonteCarloConfig
impl UnwindSafe for MonteCarloConfig
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,
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 more