pub enum ParamError {
NegativeSlope {
b: f64,
},
CorrelationOutOfRange {
rho: f64,
},
NonPositiveSigma {
sigma: f64,
},
NegativeMinVariance {
w_min: f64,
},
NonPositiveMaturity {
t: f64,
},
NegativeWeight {
weight: f64,
},
NegativeTotalVariance {
w: f64,
},
InvalidPhiParameter {
name: &'static str,
value: f64,
},
NonPositiveTheta {
theta: f64,
},
NonFinite {
name: &'static str,
},
}Expand description
Error returned when SVI / SSVI parameters or market quotes fail validation.
Every SVI parametrisation has a validity domain (raw SVI: b >= 0,
|rho| < 1, sigma > 0, a + b*sigma*sqrt(1-rho^2) >= 0). A constructor
or validate method returns one of these variants when an input lies
outside that domain.
§Examples
use regit_svi::errors::ParamError;
let err = ParamError::NegativeSlope { b: -0.1 };
assert_eq!(format!("{err}"), "raw SVI slope b must be non-negative, got -0.1");Variants§
NegativeSlope
Raw SVI slope b is negative.
CorrelationOutOfRange
Raw SVI / SSVI correlation rho is outside (-1, 1).
NonPositiveSigma
Raw SVI curvature sigma is not strictly positive.
NegativeMinVariance
The minimum total variance a + b*sigma*sqrt(1-rho^2) is negative,
so the slice produces negative variance somewhere.
NonPositiveMaturity
A maturity t is not strictly positive.
NegativeWeight
A fitting weight on a market quote is negative.
NegativeTotalVariance
An observed total variance on a market quote is negative.
InvalidPhiParameter
An SSVI smoothing-function parameter is outside its valid domain
(lambda > 0, eta > 0, gamma in (0, 1)).
Fields
NonPositiveTheta
An SSVI ATM total variance theta is not strictly positive.
NonFinite
A non-finite (NaN or infinite) value was supplied where a finite
number is required.
Trait Implementations§
Source§impl Clone for ParamError
impl Clone for ParamError
Source§fn clone(&self) -> ParamError
fn clone(&self) -> ParamError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParamError
impl Debug for ParamError
Source§impl Display for ParamError
impl Display for ParamError
Source§impl Error for ParamError
impl Error for ParamError
1.30.0 · 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<ParamError> for CalibrationError
impl From<ParamError> for CalibrationError
Source§fn from(e: ParamError) -> Self
fn from(e: ParamError) -> Self
Source§impl From<ParamError> for ConvertError
impl From<ParamError> for ConvertError
Source§fn from(e: ParamError) -> Self
fn from(e: ParamError) -> Self
Source§impl PartialEq for ParamError
impl PartialEq for ParamError
Source§fn eq(&self, other: &ParamError) -> bool
fn eq(&self, other: &ParamError) -> bool
self and other values to be equal, and is used by ==.