Skip to main content

CalibrationError

Enum CalibrationError 

#[non_exhaustive]
pub enum CalibrationError {
Show 25 variants Malformed(&'static str), NoConvergence { pillar: usize, date: NaiveDate, residual: f64, }, NegativeHazard { pillar: usize, date: NaiveDate, hazard: f64, }, NoCorrelation { tranche: usize, detach: f64, }, SmoothingScheme { scheme: Interpolation, reason: &'static str, }, FitNotConverged { residual: f64, iterations: usize, }, OverlappingPillars { first: String, second: String, date: NaiveDate, }, Recipe(Box<RecipeQuoteError>), StepRequiresLogLinear { scheme: Interpolation, }, MixedCollateral { first: String, second: String, }, StepNotImproving { pillar: usize, date: NaiveDate, residual: f64, }, SweepsExhausted { scheme: Interpolation, sweeps: usize, date: NaiveDate, residual: f64, }, Insensitive { pillar: usize, date: NaiveDate, }, QuoteMismatch { pillar: usize, date: NaiveDate, declared: f64, reprices_at: f64, }, SingularJacobian, Pricing(PricingError), Curve(CurveError), EmptyStrip, MissingQuote { label: String, }, SurfaceNotNormal { currency: Currency, }, StripNoConvergence { residual: f64, }, SigmaAtBracketEdge { sigma: f64, }, InfeasibleTerm { expiry: NaiveDate, end: NaiveDate, }, DuplicateStripExpiry { expiry: NaiveDate, }, Rungs(RungBuildError),
}
Expand description

A calibration that did not produce a curve.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Malformed(&'static str)

The quoted instruments and the pillars they determine disagree in count, or the pillar dates do not ascend.

§

NoConvergence

A pillar’s solve did not converge within its iteration budget.

Names the pillar and what it reached, because a calibration that quietly returned its last iterate would produce a curve that reprices nothing.

Fields

§pillar: usize

Which pillar failed, counting from the short end.

§date: NaiveDate

The pillar’s date.

§residual: f64

The residual still outstanding.

§

NegativeHazard

A credit pillar solved to a hazard below zero: no non-negative hazard reprices the rung’s quote on its segment.

Named rather than let through as a malformed-curve error, because the curve is not malformed — the quote is inconsistent with the pillars before it, and the pillar is what a caller needs to look at.

Fields

§pillar: usize

Which pillar, counting from the short end.

§date: NaiveDate

The pillar’s date.

§hazard: f64

The hazard the solve reached.

§

NoCorrelation

A tranche’s quote is repriced by no base correlation in [0, 1): the value keeps one sign across the whole bracket.

Fields

§tranche: usize

Which tranche, counting from the equity piece.

§detach: f64

The tranche’s detachment point.

§

SmoothingScheme

A smoothed fit needs the rung Jacobian under its scheme, and the scheme asked for declares an adjoint refusal: its coefficients are placed by comparing ordinates, so a Jacobian through them is frozen.

Fields

§scheme: Interpolation

The scheme asked for.

§reason: &'static str

The scheme’s own reason, from Interpolation::adjoint_refusal.

§

FitNotConverged

A global fit reached its iteration cap with this residual norm still outstanding.

Fields

§residual: f64

‖r‖₂ at the last iterate.

§iterations: usize

The iterations spent.

§

OverlappingPillars

Two rungs of one ladder node the same date, or a later rung nodes an earlier one. Named by the rungs’ labels so the caller can drop one: a later pillar never silently replaces an earlier.

Fields

§first: String

The earlier rung’s column label.

§second: String

The rung that landed on or before it.

§date: NaiveDate

The date the second rung nodes.

§

Recipe(Box<RecipeQuoteError>)

A recipe could not be resolved to rungs. Boxed: the refusal carries the pillar’s key.

§

StepRequiresLogLinear

A ladder with meeting or turn rungs was asked for a scheme other than log-linear; a step curve is a piecewise-constant forward.

Fields

§scheme: Interpolation

The scheme asked for.

§

MixedCollateral

A collateral ladder’s rungs solve two different collateral keys.

Fields

§first: String

The first key declared.

§second: String

The key that disagreed.

§

StepNotImproving

A step direction could not be improved along, however far it was cut.

Distinct from NoConvergence: that one is a root further away than the step budget reaches, this one is a direction that does not descend from here at any length. The diagnoses point at different causes — a hard solve against a mis-specified rung or a curve shape the scheme cannot represent — and collapsing them would erase the distinction exactly where a caller needs it.

Fields

§pillar: usize

Which pillar, counting from the short end.

§date: NaiveDate

The pillar’s date.

§residual: f64

The residual the step could not get below.

§

SweepsExhausted

The full-curve sweeps reached their bound without settling.

Distinct from NoConvergence on purpose: that one is a single pillar’s Newton solve running out of steps, this one is the fit failing to reach a fixed point. Under a local scheme the sweeps only correct lagged rungs and this is nearly unreachable; under a global scheme the sweeps are the fit, so it is a live outcome and the scheme is the first thing a caller needs to know.

Fields

§scheme: Interpolation

The scheme the ladder was solved under.

§sweeps: usize

How many sweeps were taken before giving up.

§date: NaiveDate

The date of the rung left worst off.

§residual: f64

Its outstanding residual.

§

Insensitive

A pillar the rung quoted against it cannot move. An instrument that does not depend on the pillar it is supposed to determine is a mis-specified ladder, not a hard solve.

Raised from either of the two places that dependence can be missing, and they are not the same test. The solve raises it when the residual has no gradient, so no Newton step exists. The Jacobian pass raises it when the quote has none — the diagonal of ∂q/∂z — which the solve cannot see: a rung’s residual and its quote are different quantities, and under a scheme whose segment does not reach its right-hand node the first can respond while the second is deaf. That solve converges, on a curve it has driven somewhere meaningless, so the question has to be put again to the quantity the rung actually declares.

Fields

§pillar: usize

Which pillar, counting from the short end.

§date: NaiveDate

The pillar’s date.

§

QuoteMismatch

A rung’s declared quote is not the quote its instrument reprices at on the solved curve.

The curve prices every rung to par, so the par quote read back is what the rung was booked at. A disagreement means the declared quote names a scalar other than the instrument’s own, and every par sensitivity in that column would be scaled by the wrong number.

Fields

§pillar: usize

Which rung, counting from the short end.

§date: NaiveDate

The rung’s pillar date.

§declared: f64

The quote the rung declared.

§reprices_at: f64

The quote it actually reprices at.

§

SingularJacobian

The calibration Jacobian ∂q/∂z is singular, so no ∂z/∂q exists.

A ladder whose quotes do not independently determine its pillars — two rungs quoting the same instrument, a rung with no sensitivity of its own.

§

Pricing(PricingError)

A valuation inside the solve failed.

§

Curve(CurveError)

A curve could not be constructed from the solved parameters.

§

EmptyStrip

A model calibration was asked to fit an empty instrument strip.

§

MissingQuote

A strip instrument’s quote is not pinned under its canonical label, and the currency carries no swaption surface to read it from.

Fields

§label: String

The label that did not resolve.

§

SurfaceNotNormal

The currency’s swaption surface is quoted in lognormal vol over a forward that is not positive, so a Hull-White strip fit has no Black price to read a normal vol from.

Fields

§currency: Currency

The currency.

§

StripNoConvergence

A model parameter fit did not converge within its iteration budget.

Fields

§residual: f64

The least-squares residual norm still outstanding.

§

SigmaAtBracketEdge

The fitted parameter sits on the edge of its bracket — the strip wants a value the model’s admissible range does not contain.

Fields

§sigma: f64

The value the fit stopped at.

§

InfeasibleTerm

A piecewise volatility fit met a strip point no non-negative piece reprices: the variance the earlier pieces carry to its expiry already prices it above its quote.

Fields

§expiry: NaiveDate

The failing point’s option expiry.

§end: NaiveDate

The failing point’s underlying end.

§

DuplicateStripExpiry

A piecewise volatility fit was given two strip points on one expiry, which would both claim the same piece.

Fields

§expiry: NaiveDate

The shared expiry.

§

Rungs(RungBuildError)

The ladder’s rungs could not be built from the template and quotes.

Implementations§

§

impl CalibrationError

pub fn is_unconverged(&self) -> bool

Whether the solve ran out of budget — steps, sweeps or iterations — rather than meeting a ladder that has no answer or is mis-specified.

Exhaustive, so a new variant does not compile until someone decides; a binding raises this kind as its own exception class.

Trait Implementations§

§

impl Clone for CalibrationError

§

fn clone(&self) -> CalibrationError

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
§

impl Debug for CalibrationError

§

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

Formats the value using the given formatter. Read more
§

impl Display for CalibrationError

§

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

Formats the value using the given formatter. Read more
§

impl Error for CalibrationError

§

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
§

impl From<CurveError> for CalibrationError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<PricingError> for CalibrationError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl From<RungBuildError> for CalibrationError

§

fn from(e: RungBuildError) -> Self

Converts to this type from the input type.
§

impl PartialEq for CalibrationError

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for CalibrationError

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.