pub enum SimulationError {
Show 17 variants
WalkError {
reason: String,
},
InvalidParameters {
reason: String,
},
StepError {
reason: String,
},
InvalidWalkType {
expected: &'static str,
},
InvalidAutocorrelation {
value: Decimal,
},
GarchStationarity {
alpha: Positive,
beta: Positive,
},
InvalidCorrelation {
rho: Decimal,
},
InsufficientHistoricalData {
required: usize,
found: usize,
},
IndexConversion,
ExpirationReached,
Decimal(DecimalError),
Options(OptionsError),
Pricing(PricingError),
ExpirationDate(ExpirationDateError),
PositiveError(PositiveError),
NonFinite {
context: &'static str,
value: f64,
},
Volatility(Box<VolatilityError>),
}Expand description
Error type for simulation operations.
This enum represents the various errors that can occur during simulation operations, such as random walks, Monte Carlo simulations, and other stochastic processes.
Variants§
WalkError
Error during walk generation.
InvalidParameters
Error due to invalid simulation parameters.
StepError
Error during step calculation.
InvalidWalkType
The walk type in the parameters does not match the generator being invoked.
Raised from inside each WalkTypeAble implementation when the supplied
walk_type discriminator is not the one expected by the method.
InvalidAutocorrelation
Autocorrelation parameter is outside the required [-1, 1] interval.
GarchStationarity
GARCH stationarity constraint alpha + beta < 1 violated.
InvalidCorrelation
Heston correlation rho is outside the valid [-1, 1] interval.
InsufficientHistoricalData
Not enough historical price observations to generate the requested walk.
Fields
IndexConversion
Failed to convert the x-axis step index into a Decimal.
ExpirationReached
The simulated expiration has already been reached, no further steps can be generated.
Decimal(DecimalError)
Decimal arithmetic error surfaced from pricing or Greek calculations.
Options(OptionsError)
Options domain error surfaced during simulation.
Pricing(PricingError)
Pricing error surfaced during simulation.
ExpirationDate(ExpirationDateError)
Expiration-date conversion error.
PositiveError(PositiveError)
Positive value errors
NonFinite
A simulation kernel produced a non-finite f64 value (NaN /
±∞) at an f64 → Decimal boundary.
Emitted by Brownian / geometric Brownian motion, Heston,
telegraph, and general random-walk path generators whenever
an intermediate f64 would otherwise be silently cast into
Decimal::ZERO. context is a static call-site tag
following the same convention as
optionstratlib_core::error::DecimalError::Overflow.
Fields
Volatility(Box<VolatilityError>)
A volatility failure raised by the pricing capability this layer
depends on. Boxed because VolatilityError is the larger enum.
Implementations§
Source§impl SimulationError
impl SimulationError
Sourcepub fn walk_error(reason: &str) -> Self
pub fn walk_error(reason: &str) -> Self
Creates a new WalkError variant.
§Arguments
reason- Detailed reason for the walk generation failure
Sourcepub fn invalid_parameters(reason: &str) -> Self
pub fn invalid_parameters(reason: &str) -> Self
Creates a new InvalidParameters variant.
§Arguments
reason- Detailed reason for the invalid parameters
Sourcepub fn step_error(reason: &str) -> Self
pub fn step_error(reason: &str) -> Self
Creates a new StepError variant.
§Arguments
reason- Detailed reason for the step calculation failure
Sourcepub fn non_finite(context: &'static str, value: f64) -> Self
pub fn non_finite(context: &'static str, value: f64) -> Self
Creates a SimulationError::NonFinite from a static call-site
tag and the offending f64 value.
Trait Implementations§
Source§impl Debug for SimulationError
impl Debug for SimulationError
Source§impl Display for SimulationError
impl Display for SimulationError
Source§impl Error for SimulationError
impl Error for SimulationError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<DecimalError> for SimulationError
impl From<DecimalError> for SimulationError
Source§fn from(source: DecimalError) -> Self
fn from(source: DecimalError) -> Self
Source§impl From<ExpirationDateError> for SimulationError
impl From<ExpirationDateError> for SimulationError
Source§fn from(source: ExpirationDateError) -> Self
fn from(source: ExpirationDateError) -> Self
Source§impl From<OptionsError> for SimulationError
impl From<OptionsError> for SimulationError
Source§fn from(source: OptionsError) -> Self
fn from(source: OptionsError) -> Self
Source§impl From<PositiveError> for SimulationError
impl From<PositiveError> for SimulationError
Source§fn from(source: PositiveError) -> Self
fn from(source: PositiveError) -> Self
Source§impl From<PricingError> for SimulationError
impl From<PricingError> for SimulationError
Source§fn from(source: PricingError) -> Self
fn from(source: PricingError) -> Self
Source§impl From<VolatilityError> for SimulationError
impl From<VolatilityError> for SimulationError
Source§fn from(err: VolatilityError) -> Self
fn from(err: VolatilityError) -> Self
Auto Trait Implementations§
impl Freeze for SimulationError
impl RefUnwindSafe for SimulationError
impl Send for SimulationError
impl Sync for SimulationError
impl Unpin for SimulationError
impl UnsafeUnpin for SimulationError
impl UnwindSafe for SimulationError
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> 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.