Enum RiskError
#[non_exhaustive]pub enum RiskError {
NonDifferentiable {
curve: CurveId,
reason: &'static str,
},
Unlifted {
input: MarketInputId,
},
NoLadder {
curve: CurveId,
},
NoLadderRow {
input: MarketInputId,
},
LadderTooShort {
curve: CurveId,
node_index: usize,
rows: usize,
},
NoSabrFit {
surface: VolSurfaceId,
},
NoValuationDate,
BucketEdges {
edge: Option<Period>,
},
NotInOnePass {
measure: &'static str,
method: &'static str,
},
Pricing(PricingError),
}Expand description
A risk pass that cannot report what it was asked for.
Every arm names the input it is about. None of them is a zero: a sensitivity
that cannot be computed correctly is reported as absent, never as 0.0,
because a zero is indistinguishable from a genuine insensitivity and a desk
reading one would hedge nothing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NonDifferentiable
A curve’s interpolation cannot record correct first-order adjoints, so no amount of registering would make its ladder trustworthy. Carries the reason, which names the remedy.
Fields
Unlifted
A market input reached the read-back unregistered, so it would contribute
a silent zero. Distinct from NonDifferentiable
on purpose: this input could report and was not lifted, where that one
cannot report at all.
Fields
input: MarketInputIdThe input that was never registered.
NoLadder
A par-basis measure reached a curve pinned without the ladder that
calibrated it, so there is no ∂z/∂q to flip its pillars through.
A hand-pinned curve, or one a scenario shocked — the shock re-pins bare, because the original ladder does not reprice the shocked curve. Reporting a partial ladder over the curves that do carry one would be a par number that silently omits part of the book’s exposure.
NoLadderRow
A market input that belongs to no row of any ladder: a step curve’s meeting or turn pillar, which carries no position in a parameter vector, or an input that names no curve at all.
The calibration path produces no step curves, so this names an input a par basis was never able to describe rather than one it lost track of.
Fields
input: MarketInputIdThe input with no row.
LadderTooShort
A ladder shorter than the pillar asking for a row.
Pinning checks the two counts agree, so reaching this means a ladder and a curve came apart after they were pinned together.
Fields
NoSabrFit
A par-basis measure reached a SABR surface pinned from parameters rather than fitted, so there are no grid quotes to map its nodes onto.
Fields
surface: VolSurfaceIdThe surface pinned without a fit.
NoValuationDate
A tenor-bucketed reading with no date to measure tenors from — a market holding no curve at all.
BucketEdges
Bucket edges that are not a rising run of month, year, week or day tenors past zero, so they would leave a bucket empty by construction or put a date in two; or no edges at all.
NotInOnePass
A measure asked of a report that no single risk pass produces — a bumped revaluation or a model read-through — so the report refuses it before taking the pass rather than quietly taking several.
Fields
Pricing(PricingError)
The valuation itself failed, so there is nothing to attribute.
Implementations§
§impl RiskError
impl RiskError
pub fn lacks_ladder(&self) -> bool
pub fn lacks_ladder(&self) -> bool
Whether a par basis was asked of an input no calibration ladder has a row for — a curve pinned without its ladder, a SABR surface pinned without its fit, or an input no ladder describes — so the caller’s fallback is the zero-rate reading.
Exhaustive, so a new variant does not compile until someone decides.
Trait Implementations§
§impl Error for RiskError
impl Error for RiskError
§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()