Skip to main content

CurveRecipe

Struct CurveRecipe 

pub struct CurveRecipe {
    currency: String,
    discount: Vec<Segment>,
    projection: BTreeMap<String, Projection>,
    windows: Vec<ExplicitWindow>,
    triangulated: Option<String>,
}
Expand description

A quote-less, per-currency topology: the discount segments in order, per projection index its source, and any windows the recipe fixes. Keyed by currency code (ISO 4217).

Fields§

§currency: String§discount: Vec<Segment>§projection: BTreeMap<String, Projection>§windows: Vec<ExplicitWindow>§triangulated: Option<String>

Some(via) declares a triangulated cross discount derived through hub currency via (see with_discount_via).

Implementations§

§

impl CurveRecipe

pub fn new(currency: impl Into<String>) -> Self

An empty recipe for currency.

fn checked(code: &str, role: Role) -> Result<String, RecipeError>

fn with_segment(self, role: Role, code: &str) -> Result<Self, RecipeError>

pub fn with_deposit(self, code: &str) -> Result<Self, RecipeError>

Appends a deposit segment on a money-market template.

§Errors

RecipeError for an unknown code or a template of another family.

pub fn with_policy_path(self, code: &str) -> Result<Self, RecipeError>

Appends a policy-path segment on a meeting-OIS template.

§Errors

As with_deposit.

pub fn with_futures(self, code: &str) -> Result<Self, RecipeError>

Appends a futures segment on a rate-future template.

§Errors

As with_deposit.

pub fn with_par_swaps(self, code: &str) -> Result<Self, RecipeError>

Appends a par-swap segment on an OIS or IRS template.

§Errors

As with_deposit.

pub fn with_fx_swaps(self, code: &str) -> Result<Self, RecipeError>

Appends an FX-swap segment on an FX-swap template: the short end of a cross-collateral discount, quoted as outrights or points against the collateral currency.

§Errors

As with_deposit.

pub fn with_basis(self, code: &str) -> Result<Self, RecipeError>

Appends a basis segment on a floating-floating cross-currency template, without clearing what precedes it, so an FX-swap short end may be followed by a basis long end on one discount list.

§Errors

As with_deposit.

pub fn with_fixed_float_xccy(self, code: &str) -> Result<Self, RecipeError>

Appends a fixed-vs-float cross-currency segment: the quote is the observable fixed rate, and the segment pins the cross discount directly from the collateral curves and the FX spot.

§Errors

As with_deposit.

pub fn with_ndf(self, code: &str) -> Result<Self, RecipeError>

Appends an NDF segment on an NDF template: the short end of an offshore discount, quoted as outrights or points against the settlement currency.

§Errors

As with_deposit.

pub fn with_nds_strip( self, index: impl Into<String>, code: &str, ) -> Result<Self, RecipeError>

Declares that projection index has its own strip on code, an NDS template whose floating leg is that index: its par rates mark the index’s forward curve against the settlement-currency discount and the local currency’s discount under that collateral, both held. It belongs on the index’s own-currency recipe, where its projection lives.

§Errors

RecipeError for an unknown code or a template that is not an NDS.

pub fn with_telescoping(self, index: impl Into<String>) -> Self

Declares that projection index telescopes onto the discount curve: a self-discounting overnight index with no strip of its own.

pub fn with_own_strip( self, index: impl Into<String>, code: &str, ) -> Result<Self, RecipeError>

Declares that projection index has its own strip on code, an IRS template whose floating leg is that index.

§Errors

RecipeError for an unknown code or a template that is not a swap.

pub fn with_window( self, code: &str, start: NaiveDate, end: NaiveDate, ) -> Result<Self, RecipeError>

Fixes a window on code, a meeting-OIS or OIS template, whatever the sheet says: its quote is read from the sheet under that window.

§Errors

RecipeError for an unknown code or a template of another family.

pub fn with_discount_via(self, via: impl Into<String>) -> Self

Declares the discount curve as triangulated through hub currency via: derived as the discount ratio DF(collateral-own) × DF(cashflow-via) / DF(collateral-via) with no quotes of its own. A triangulated recipe carries no segments: this clears any, and CurveRecipes::insert enforces the rest (cross key only, non-degenerate via, sources effective and themselves non-triangulated).

pub fn currency(&self) -> &str

The currency code this recipe builds for.

pub fn discount(&self) -> &[Segment]

The discount segments in declaration order.

pub fn segment(&self, role: Role) -> Option<&str>

The template of the segment playing role, if the recipe has one.

pub fn templates(&self) -> Vec<&str>

Every template the recipe names: the discount segments’ in order, then the own-strip projections’, then the explicit windows’.

pub fn windows(&self) -> &[ExplicitWindow]

The windows the recipe fixes.

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

The FX-swap segment’s template, or None.

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

The basis segment’s template, or None.

pub fn is_fixed_float_xccy(&self) -> bool

Whether the discount is a directly-observable fixed-vs-float cross-currency curve: every segment is of that role.

pub fn is_fx_implied(&self) -> bool

Whether the discount is FX-swap-implied alone: every segment is FX swaps.

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

The hub currency of a triangulated cross discount, or None.

pub fn is_triangulated(&self) -> bool

Whether this recipe’s discount curve is triangulated through a hub currency.

pub fn requires_cross_peers(&self) -> bool

Whether any discount segment solves only against peer curves plus an FX spot (FX swaps, basis, fixed-float cross) — through the cross seams, never through the peer-free own-currency calibration.

pub fn has_policy_path(&self) -> bool

Whether the recipe carries a policy path or an explicit window — the recipes whose solved discount curve may carry meeting knots.

pub fn projection_indices(&self) -> impl Iterator<Item = &str>

The projection-index names this recipe covers.

pub fn projection(&self, index: &str) -> Option<&Projection>

How projection index is sourced, or None if the recipe does not cover it.

pub fn own_strip(&self, index: &str) -> Option<&str>

The own-strip template of projection index, or None where it telescopes or is not covered.

pub fn covers_projection(&self, index: &str) -> bool

Whether this recipe covers projection index.

pub fn telescopes(&self, index: &str) -> bool

Whether projection index telescopes onto the discount curve.

pub fn projection_topology(&self) -> Vec<ProjectionTopologyEntry>

The projection topology: each covered index paired with whether it telescopes onto discount or has its own forward curve, in index order.

Trait Implementations§

§

impl Clone for CurveRecipe

§

fn clone(&self) -> CurveRecipe

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 CurveRecipe

§

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

Formats the value using the given formatter. Read more
§

impl Display for CurveRecipe

One line: the currency, the discount segments as role template, and the projection indices with their source — "USD discount [deposit USD-SOFR-DEPO, policy USD-SOFR-MeetingOIS, futures USD-SOFR-3M-FUT, swaps USD-SOFR-OIS], projection [SOFR telescoping]".

§

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

Formats the value using the given formatter. Read more
§

impl Eq for CurveRecipe

§

impl PartialEq for CurveRecipe

§

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

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.