use optionstratlib_core::error::DecimalError;
use rust_decimal::Decimal;
use thiserror::Error;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum QuadraticRoughHestonError {
#[error("alpha {alpha} is outside the open interval (1/2, 1)")]
AlphaOutOfRange {
alpha: Decimal,
},
#[error("the kernel needs at least one factor")]
NoFactors,
#[error("the geometric ratio {ratio} is not above one")]
RatioNotAboveOne {
ratio: Decimal,
},
#[error("the kernel {quantity} of factor {index} has no positive value in a decimal")]
KernelOutOfRange {
quantity: &'static str,
index: usize,
},
#[error("the step of a horizon of {horizon} years over {steps} steps is not positive")]
NonPositiveStep {
horizon: Decimal,
steps: usize,
},
#[error("invalid parameter {parameter} = {value}: {reason}")]
InvalidParameter {
parameter: &'static str,
value: Decimal,
reason: &'static str,
},
#[error("expected {expected} initial factors, got {actual}")]
InitialFactorCount {
expected: usize,
actual: usize,
},
#[error("the simulated {quantity} is not finite at step {step}")]
NonFinite {
quantity: &'static str,
step: usize,
},
#[error("cannot allocate {len} entries for the {buffer}")]
BufferTooLarge {
buffer: &'static str,
len: usize,
},
#[error(transparent)]
Decimal(#[from] DecimalError),
}