Skip to main content

RiskError

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
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.
§

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

§curve: CurveId

The curve that cannot report.

§reason: &'static str

Why, from the scheme itself.

§

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: MarketInputId

The 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.

Fields

§curve: CurveId

The curve pinned without a ladder.

§

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: MarketInputId

The 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

§curve: CurveId

The curve whose ladder is short.

§node_index: usize

The row asked for.

§rows: usize

The rows the ladder has.

§

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: VolSurfaceId

The 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.

Fields

§edge: Option<Period>

The edge that breaks the run, or None for no edges.

§

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

§measure: &'static str

The measure, by its catalogue name.

§method: &'static str

The method that does compute it.

§

Pricing(PricingError)

The valuation itself failed, so there is nothing to attribute.

Implementations§

§

impl RiskError

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 Clone for RiskError

§

fn clone(&self) -> RiskError

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 RiskError

§

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

Formats the value using the given formatter. Read more
§

impl Display for RiskError

§

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

Formats the value using the given formatter. Read more
§

impl Error for RiskError

§

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<PricingError> for RiskError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl From<RiskError> for PnlError

§

fn from(e: RiskError) -> Self

Converts to this type from the input type.
§

impl PartialEq for RiskError

§

fn eq(&self, other: &RiskError) -> 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 RiskError

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.