#[non_exhaustive]pub enum MonteCarloMethod {
IidShuffle,
BlockBootstrap {
block_size: usize,
},
StationaryBootstrap {
mean_block_size: usize,
},
Parametric,
}Expand description
Resampling method used for Monte Carlo simulation.
Each method makes different assumptions about trade return structure. Choose based on your strategy’s autocorrelation characteristics.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
IidShuffle
Random IID shuffle (Fisher-Yates). Default.
Treats every trade return as an independent, identically distributed draw and randomises the sequence. Fast and appropriate for mean-reversion strategies whose trades are mostly independent. Destroys autocorrelation, which may underestimate the probability of sustained drawdowns for trend-following strategies.
BlockBootstrap
Fixed-size block bootstrap.
Samples consecutive blocks of block_size trades (with circular
wrap-around) and reassembles them in random order. Preserves short-range
autocorrelation and regime structure better than IID shuffle. A good
default block size is sqrt(n_trades). More conservative than IID for
trending strategies.
StationaryBootstrap
Stationary bootstrap with geometrically-distributed block lengths.
Like BlockBootstrap but block length is drawn from
Geometric(1 / mean_block_size) at each step. Less sensitive to the choice
of block size than the fixed variant — a good default when you are
uncertain about the true autocorrelation length.
Parametric
Parametric simulation assuming normally-distributed trade returns.
Fits N(μ, σ) to the observed trade returns and generates synthetic sequences by sampling from that distribution (Box-Muller transform). Useful when the observed trade count is very small and non-parametric resampling would produce near-identical sequences. Assumes normality, which may not hold in fat-tailed markets.
Trait Implementations§
Source§impl Clone for MonteCarloMethod
impl Clone for MonteCarloMethod
Source§fn clone(&self) -> MonteCarloMethod
fn clone(&self) -> MonteCarloMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MonteCarloMethod
impl Debug for MonteCarloMethod
Source§impl Default for MonteCarloMethod
impl Default for MonteCarloMethod
Source§fn default() -> MonteCarloMethod
fn default() -> MonteCarloMethod
Source§impl<'de> Deserialize<'de> for MonteCarloMethod
impl<'de> Deserialize<'de> for MonteCarloMethod
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 MonteCarloMethod
impl RefUnwindSafe for MonteCarloMethod
impl Send for MonteCarloMethod
impl Sync for MonteCarloMethod
impl Unpin for MonteCarloMethod
impl UnsafeUnpin for MonteCarloMethod
impl UnwindSafe for MonteCarloMethod
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