Skip to main content

PricingError

Enum PricingError 

#[non_exhaustive]
pub enum PricingError {
Show 39 variants Curve(CurveError), MarketData(MarketDataError), MissingCurve { key: String, detail: Box<MissingCurveDetail>, }, Undated, NoSnapshot { as_of: NaiveDate, }, MissingVolSurface { pair: String, }, MissingSwaptionVols { currency: Currency, }, MissingBondYieldVols { key: String, }, MissingCapVols { currency: Currency, }, MissingCreditVols { credit: CreditCurveId, }, MissingYoyInflationVols { index: String, }, MissingCpiInflationVols { index: String, }, MissingExogenous { label: String, }, AmbiguousHullWhiteSigma { flat: String, dated: String, }, RepoChainCycle { keys: Vec<String>, }, TriangulatedChain { key: String, source: String, }, TriangulatedRead { key: String, }, RepoBasisMismatch { first: String, second: String, }, MissingBaseCorrelation { index: CreditIndexId, }, MissingBasketCorrelation { basket: String, }, MissingCmsSpreadCorrelation { first: String, second: String, }, MissingRecoveryFloor { index: CreditIndexId, }, MissingCopulaDof { index: CreditIndexId, }, GridReadOfSabr { surface: String, }, SeasonedReset { product: &'static str, reset: NaiveDate, }, AgreedRate { agreed: f64, expected: f64, quoted: Currency, other: Currency, }, UnfixedFunding { product: &'static str, start: NaiveDate, }, MissingFuturePrice { contract: ListedFutureId, }, MissingEquitySpot { name: String, }, MissingEquityVols { name: String, }, MissingFutureOptionVols { contract: ListedFutureId, }, DegenerateAnnuity { entry_point: &'static str, product: &'static str, }, MixedCurrencyBook { first: Currency, second: Currency, }, UnsupportedForProduct { entry_point: &'static str, product: &'static str, }, MalformedDeclaration { product: &'static str, detail: String, }, UnbracketedSolve { lo: f64, hi: f64, }, SolverUnconverged { solver: &'static str, residual: f64, iterations: usize, }, UndeclaredProjection { index: String, }, InTrade { trade: String, source: Box<PricingError>, },
}
Expand description

A pricing call that cannot be answered.

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

Curve(CurveError)

A curve could not answer a query.

§

MarketData(MarketDataError)

A market-data lookup could not be answered.

§

MissingCurve

The market held no curve under a key the product asked for.

Fields

§key: String

The key that did not resolve.

§detail: Box<MissingCurveDetail>

What the market holds instead, and what the valuation needed — boxed, as it is read only on this failure and would otherwise widen every pricing Result.

§

Undated

The market has no date, so it holds no snapshot to value against.

§

NoSnapshot

The book carries no market, or none holding a snapshot at the date asked for; a Rust book fetches only through fetch_market_data.

Fields

§as_of: NaiveDate

The date asked for.

§

MissingVolSurface

A declared FX vol surface is not carried by the market.

Fields

§pair: String

The pair asked for.

§

MissingSwaptionVols

A declared swaption vol surface is not carried by the market.

Fields

§currency: Currency

The currency asked for.

§

MissingBondYieldVols

A declared bond yield vol surface is not carried by the market.

Fields

§key: String

The key asked for: a currency code, or a security’s own.

§

MissingCapVols

A declared cap vol surface is not carried by the market.

Fields

§currency: Currency

The currency asked for.

§

MissingCreditVols

A declared credit vol surface is not carried by the market.

Fields

§credit: CreditCurveId

The credit identity asked for.

§

MissingYoyInflationVols

A declared year-on-year inflation optionlet vol surface is not carried by the market.

Fields

§index: String

The price index asked for.

§

MissingCpiInflationVols

A declared zero-coupon CPI option vol surface is not carried by the market.

Fields

§index: String

The price index asked for.

§

MissingExogenous

A declared exogenous market input has no value pinned under its label.

Fields

§label: String

The canonical label that did not resolve.

§

AmbiguousHullWhiteSigma

A currency’s Hull-White volatility is pinned under both spellings — the flat label and dated per-piece labels — so which one prices is not the market’s to guess.

Fields

§flat: String

The flat label, HW-{CCY}-SIGMA.

§dated: String

The first dated label found, HW-{CCY}-SIGMA-{date}.

§

RepoChainCycle

A repo key’s base chain returns to a key already in it, so no base ends it.

Fields

§keys: Vec<String>

The keys walked, in order, ending with the one that repeats.

§

TriangulatedChain

A triangulated discount key reads a source that is itself triangulated: one hop is supported.

Fields

§key: String

The triangulated key priced.

§source: String

Its source that is itself triangulated.

§

TriangulatedRead

A triangulated discount key was asked for its stored curve: it holds none, being composed from its sources at pricing.

Fields

§key: String

The triangulated key.

§

RepoBasisMismatch

Two repo spreads in one chain accrue on different bases, so their simple spreads do not add.

Fields

§first: String

The first key in the chain.

§second: String

The key whose basis differs from it.

§

MissingBaseCorrelation

A product requiring base correlation found no curve under its index.

Fields

§index: CreditIndexId

The index asked for.

§

MissingBasketCorrelation

A basket on a market correlation found none under its key.

Fields

§basket: String

The key asked for.

§

MissingCmsSpreadCorrelation

A CMS spread on a market correlation found no mark for its pair of swap indices.

Fields

§first: String

The first swap-index code of the pair, in the market’s order.

§second: String

The second swap-index code of the pair.

§

MissingRecoveryFloor

A tranche on a market recovery floor found none for its index.

Fields

§index: CreditIndexId

The credit index asked for.

§

MissingCopulaDof

A tranche on market copula degrees of freedom found none for its index.

Fields

§index: CreditIndexId

The credit index asked for.

§

GridReadOfSabr

A grid read asked of a registry that holds a SABR surface.

Fields

§surface: String

The surface, as its identity prints.

§

SeasonedReset

A trade asked to value a period that began at a past reset whose struck price is a fact of the trade the market does not hold.

Fields

§product: &'static str

The product that refused.

§reset: NaiveDate

The past reset date.

§

AgreedRate

A cross-currency swap’s agreed FX rate is not a positive finite number, or reads as the market’s rate inverted: more than ten times away from it while its reciprocal is within ten times.

Fields

§agreed: f64

The agreed rate: units of other per one quoted.

§expected: f64

The market’s spot in the same orientation.

§quoted: Currency

The quoted leg’s currency.

§other: Currency

The other leg’s currency.

§

UnfixedFunding

A floating funding period under way names no index, so the rate it fixed at is a fact the market does not hold.

Fields

§product: &'static str

The product that refused.

§start: NaiveDate

The period’s start, before the valuation date.

§

MissingFuturePrice

An option on a listed future found no quoted price for its contract.

Fields

§contract: ListedFutureId

The contract asked for.

§

MissingEquitySpot

An equity product found no quoted spot for its equity.

Fields

§name: String

The equity asked for.

§

MissingEquityVols

An equity option found no vol surface for its equity.

Fields

§name: String

The equity asked for.

§

MissingFutureOptionVols

An option on a listed future found no option vol surface for its contract.

Fields

§contract: ListedFutureId

The underlying contract asked for.

§

DegenerateAnnuity

A par measure was asked of a trade with no annuity to solve against — a matured trade, or one whose coupons all pay on or before the valuation date. Reported rather than divided by: x / 0.0 is Ok(NaN) or Ok(±inf), a successful-looking result that poisons whatever consumes it.

Fields

§entry_point: &'static str

The entry point that has no solution.

§product: &'static str

The product it was asked of.

§

MixedCurrencyBook

A book whose trades pay in more than one currency was aggregated without a declared reporting currency. Amounts in different currencies do not add, so the sum is refused rather than produced in mixed units.

Fields

§first: Currency

The first currency encountered.

§second: Currency

The first differing currency encountered.

§

UnsupportedForProduct

The product’s market data exceeds what RiskFactors can express, or the entry point does not apply to it.

Named rather than answered: a product that needs two discount curves and an FX rate cannot report a single-curve shape, and fabricating one would resolve the wrong data and price successfully against it.

Fields

§entry_point: &'static str

The entry point that cannot serve this product.

§product: &'static str

The product declining it.

§

MalformedDeclaration

A product’s declaration is internally inconsistent, so the identifiers it would cross the seam with cannot be decoded as it intends them.

Distinct from UnsupportedForProduct, which says a product’s needs exceed an entry point. This says the declaration itself does not hold together, and it exists because the alternative is worse than an error: a variadic slot crosses the seam as a flat list carrying no arity, so a list that does not match the shape its declarer will decode is read as market data that happens to be absent — which several slots treat as a documented fall back. Refused where the declaration is made, it is a typed failure; allowed through, it is a silent mispricing.

Fields

§product: &'static str

The product whose declaration does not hold together.

§detail: String

What does not hold, in the declarer’s own terms.

§

UnbracketedSolve

An implied-spread solve found no root inside its bracket: the quoted price is outside the range the instrument can reprice.

Fields

§lo: f64

The lower spread bound tried.

§hi: f64

The upper spread bound tried.

§

SolverUnconverged

A passive solve reached its iteration cap without meeting tolerance.

Fields

§solver: &'static str

The solver that gave up.

§residual: f64

The residual at the last iterate, in the target’s units.

§iterations: usize

The iterations spent.

§

UndeclaredProjection

A product asked its view for the projection curve of an index it did not declare. The view answers only from the declaration it was resolved for, so this names a defect in the product’s declaration rather than a curve the market lacks.

Fields

§index: String

The index no declared projection names.

§

InTrade

One trade of a book could not be resolved or valued. Names the trade, so a caller holding hundreds need not bisect the book to find it; root is the refusal itself.

Fields

§trade: String

The trade’s identifier.

§source: Box<PricingError>

Why it could not be valued.

Implementations§

§

impl PricingError

pub fn in_trade(self, trade: &str) -> Self

This refusal, as the refusal of the trade trade.

pub fn root(&self) -> &PricingError

The refusal underneath any trade it is reported against — what a caller matches on.

pub fn trade(&self) -> Option<&str>

The trade this refusal came from, where it came from one.

pub fn missing_input(&self) -> Option<(&'static str, String)>

The market input this refusal found missing, as the (kind, key) row MarketContext::contents lists once it is supplied — so the row reads as the builder call that would put it back. None for a refusal that is not a missing input.

Read through any trade the refusal is reported against. Exhaustive, so a new variant does not compile until someone decides; a binding raises a missing input as its own exception class.

pub fn is_unsolved(&self) -> bool

Whether this refusal is a solve that found no answer — no root in its bracket, or no convergence within its budget — read through any trade it is reported against. Exhaustive, as missing_input is.

§

impl PricingError

pub fn missing_cms_spread_correlation(first: &str, second: &str) -> Self

The refusal of a CMS spread correlation the market or the view does not hold for the swap indices first and second, naming the pair in the market’s order.

Trait Implementations§

§

impl Clone for PricingError

§

fn clone(&self) -> PricingError

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 PricingError

§

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

Formats the value using the given formatter. Read more
§

impl Display for PricingError

§

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

Formats the value using the given formatter. Read more
§

impl Error for PricingError

§

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

§

fn from(e: CashflowError) -> Self

Converts to this type from the input type.
§

impl From<CurveError> for PricingError

§

fn from(e: CurveError) -> Self

Converts to this type from the input type.
§

impl From<MarketDataError> for PricingError

§

fn from(e: MarketDataError) -> Self

Converts to this type from the input type.
§

impl From<NotTheProduct> for PricingError

§

fn from(e: NotTheProduct) -> Self

Converts to this type from the input type.
§

impl From<PricingError> for PnlError

§

fn from(e: PricingError) -> 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<PricingError> for BondFutureError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl From<PricingError> for BondReadingError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl From<PricingError> for RiskError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl From<PricingError> for BookPnlError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl From<PricingError> for ScenarioError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl From<PricingError> for CreditBumpError

§

fn from(e: PricingError) -> Self

Converts to this type from the input type.
§

impl PartialEq for PricingError

§

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

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.