Skip to main content

QuoteKind

Enum QuoteKind 

#[non_exhaustive]
pub enum QuoteKind { Par, Priced { money_per_quote: f64, settlement: Option<NaiveDate>, }, Spread, }
Expand description

The two are not interchangeable and the difference is not cosmetic: a par rung’s instrument is worth nothing at its quote, while a priced rung’s is worth its quote. The solver’s target, the Jacobian’s read, and the check that a rung reprices at what it declared all follow from this one choice, so they cannot disagree.

The kind is declared, never inferred from whether an instrument happens to support par_rate. Inferring it would make a ladder’s arithmetic depend on which error a product returns, and would silently change every ladder containing a product that later gained one.

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

Par

The instrument is at par: the residual is its value, driven to zero, and the quote is its par rate. Every deposit, swap, FRA and CDS rung.

§

Priced

The instrument trades at a price: the residual is its value less that price, and the quote is the price. A bond.

Carries the scale between the quote’s units and the instrument’s money — for a bond quoted per 100 face, face/100 — and not the target itself. The target is then quote × scale, so the two cannot disagree and the quote read back at the solution is npv / scale.

That the scale is a property of the instrument and not of the declared quote is what makes the verification mean anything. Carrying a target alongside the quote, and scaling the Jacobian read by their ratio, makes the declared quote cancel out — the check then passes for every quote, including wrong ones.

Fields

§money_per_quote: f64

Money per unit of quote. For a bond quoted per 100 face, face/100.

§settlement: Option<NaiveDate>

The date the price is for, when that is not the curve’s reference: a bond quoted for T+1 settlement.

The price is then compared with the instrument’s value forwarded to that date on the curve under solve — its flows after settlement, over DF(settlement) — rather than with its value today. The forwarding cannot be done before the solve, because DF(settlement) is on the curve being built. None, or a date at or before the reference, compares with today’s value, and is bit-identical to a rung that never carried one.

§

Spread

The instrument is at par, but what the market quotes is a spread: the residual is its value driven to zero exactly as for Par, and the quote is read back through par_spread rather than par_rate. A tenor basis swap, a cross-currency basis swap, an averaged-versus-compounded overnight basis.

The residual is the same quantity as Par’s, and this is not a duplicate variant for that reason: what differs is the quantity the Jacobian column is with respect to. A basis rung’s sensitivity is per unit of spread, and reading par_rate on a basis swap would differentiate a fixed rate the ladder never solved — the same failure Priced exists to prevent, one instrument along.

Implementations§

§

impl QuoteKind

pub fn code(&self) -> &'static str

Which quantity the quote is.

Trait Implementations§

§

impl Clone for QuoteKind

§

fn clone(&self) -> QuoteKind

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 Copy for QuoteKind

§

impl Debug for QuoteKind

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for QuoteKind

§

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

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