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
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
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
NoCorrelation
A tranche’s quote is repriced by no base correlation in [0, 1): the
value keeps one sign across the whole bracket.
Fields
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: InterpolationThe scheme asked for.
reason: &'static strThe scheme’s own reason, from Interpolation::adjoint_refusal.
FitNotConverged
A global fit reached its iteration cap with this residual norm still outstanding.
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
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: InterpolationThe scheme asked for.
MixedCollateral
A collateral ladder’s rungs solve two different collateral keys.
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
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: InterpolationThe scheme the ladder was solved under.
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.
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
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.
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.
StripNoConvergence
A model parameter fit did not converge within its iteration budget.
SigmaAtBracketEdge
The fitted parameter sits on the edge of its bracket — the strip wants a value the model’s admissible range does not contain.
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
DuplicateStripExpiry
A piecewise volatility fit was given two strip points on one expiry, which would both claim the same piece.
Rungs(RungBuildError)
The ladder’s rungs could not be built from the template and quotes.
Implementations§
§impl CalibrationError
impl CalibrationError
pub fn is_unconverged(&self) -> bool
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
impl Clone for CalibrationError
§fn clone(&self) -> CalibrationError
fn clone(&self) -> CalibrationError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CalibrationError
impl Debug for CalibrationError
§impl Display for CalibrationError
impl Display for CalibrationError
§impl Error for CalibrationError
impl Error for CalibrationError
§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()
§impl From<CurveError> for CalibrationError
impl From<CurveError> for CalibrationError
§fn from(e: CurveError) -> Self
fn from(e: CurveError) -> Self
§impl From<PricingError> for CalibrationError
impl From<PricingError> for CalibrationError
§fn from(e: PricingError) -> Self
fn from(e: PricingError) -> Self
§impl From<RungBuildError> for CalibrationError
impl From<RungBuildError> for CalibrationError
§fn from(e: RungBuildError) -> Self
fn from(e: RungBuildError) -> Self
§impl PartialEq for CalibrationError
impl PartialEq for CalibrationError
§fn eq(&self, other: &CalibrationError) -> bool
fn eq(&self, other: &CalibrationError) -> bool
self and other values to be equal, and is used by ==.