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
impl CurveRecipe
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>
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>
pub fn with_policy_path(self, code: &str) -> Result<Self, RecipeError>
pub fn with_futures(self, code: &str) -> Result<Self, RecipeError>
pub fn with_futures(self, code: &str) -> Result<Self, RecipeError>
pub fn with_par_swaps(self, code: &str) -> Result<Self, RecipeError>
pub fn with_par_swaps(self, code: &str) -> Result<Self, RecipeError>
pub fn with_fx_swaps(self, code: &str) -> Result<Self, RecipeError>
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>
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>
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>
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>
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
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>
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>
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
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 segment(&self, role: Role) -> Option<&str>
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>
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]
pub fn windows(&self) -> &[ExplicitWindow]
The windows the recipe fixes.
pub fn fx_swaps_segment(&self) -> Option<&str>
pub fn fx_swaps_segment(&self) -> Option<&str>
The FX-swap segment’s template, or None.
pub fn basis_segment(&self) -> Option<&str>
pub fn basis_segment(&self) -> Option<&str>
The basis segment’s template, or None.
pub fn is_fixed_float_xccy(&self) -> bool
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
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>
pub fn discount_via(&self) -> Option<&str>
The hub currency of a triangulated cross discount, or None.
pub fn is_triangulated(&self) -> bool
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
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
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>
pub fn projection_indices(&self) -> impl Iterator<Item = &str>
The projection-index names this recipe covers.
pub fn projection(&self, index: &str) -> Option<&Projection>
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>
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
pub fn covers_projection(&self, index: &str) -> bool
Whether this recipe covers projection index.
pub fn telescopes(&self, index: &str) -> bool
pub fn telescopes(&self, index: &str) -> bool
Whether projection index telescopes onto the discount curve.
pub fn projection_topology(&self) -> Vec<ProjectionTopologyEntry>
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
impl Clone for CurveRecipe
§fn clone(&self) -> CurveRecipe
fn clone(&self) -> CurveRecipe
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CurveRecipe
impl Debug for CurveRecipe
§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]".
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]".