Skip to main content

ParamError

Enum ParamError 

Source
pub enum ParamError {
Show 13 variants EmptyCollection { name: &'static str, }, 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, }, NotStrictlyIncreasing { name: &'static str, index: usize, previous: f64, value: f64, }, DecreasingAtmVariance { index: usize, previous: f64, value: f64, },
}
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::error::ParamError;

let err = ParamError::NegativeSlope { b: -0.1 };
assert_eq!(format!("{err}"), "raw SVI slope b must be non-negative, got -0.1");

Variants§

§

EmptyCollection

A collection that must contain at least one observation was empty.

Fields

§name: &'static str

Name of the empty collection.

§

NegativeSlope

Raw SVI slope b is negative.

Fields

§b: f64

The offending value of b.

§

CorrelationOutOfRange

Raw SVI / SSVI correlation rho is outside (-1, 1).

Fields

§rho: f64

The offending value of rho.

§

NonPositiveSigma

Raw SVI curvature sigma is not strictly positive.

Fields

§sigma: f64

The offending value of sigma.

§

NegativeMinVariance

The minimum total variance a + b*sigma*sqrt(1-rho^2) is negative, so the slice produces negative variance somewhere.

Fields

§w_min: f64

The minimum value of w over the slice.

§

NonPositiveMaturity

A maturity t is not strictly positive.

Fields

§t: f64

The offending value of t.

§

NegativeWeight

A fitting weight on a market quote is negative.

Fields

§weight: f64

The offending weight.

§

NegativeTotalVariance

An observed total variance on a market quote is negative.

Fields

§w: f64

The offending total variance.

§

InvalidPhiParameter

An SSVI smoothing-function parameter is outside its valid domain (lambda > 0, eta > 0, gamma in (0, 1)).

Fields

§name: &'static str

Human-readable name of the offending parameter.

§value: f64

The offending value.

§

NonPositiveTheta

An SSVI ATM total variance theta is not strictly positive.

Fields

§theta: f64

The offending value of theta.

§

NonFinite

A non-finite (NaN or infinite) value was supplied where a finite number is required.

Fields

§name: &'static str

Human-readable name of the offending input.

§

NotStrictlyIncreasing

Values expected in strictly increasing order were unordered or duplicated.

Fields

§name: &'static str

Name of the coordinate.

§index: usize

Index of the offending value.

§previous: f64

Previous value.

§value: f64

Offending value.

§

DecreasingAtmVariance

An ATM total-variance term structure decreased with maturity.

Fields

§index: usize

Index of the offending knot.

§previous: f64

Previous ATM total variance.

§value: f64

Offending ATM total variance.

Trait Implementations§

Source§

impl Clone for ParamError

Source§

fn clone(&self) -> ParamError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ParamError

Source§

impl Debug for ParamError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParamError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ParamError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Infallible> for ParamError

Source§

fn from(value: Infallible) -> Self

Converts to this type from the input type.
Source§

impl From<ParamError> for ConvertError

Source§

fn from(e: ParamError) -> Self

Converts to this type from the input type.
Source§

impl From<ParamError> for CalibrationError

Source§

fn from(e: ParamError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ParamError

Source§

fn eq(&self, other: &ParamError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ParamError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.