Enum CollateralSpec
#[non_exhaustive]pub enum CollateralSpec {
Currency(Currency),
Named(String),
}Expand description
Which discount curve a product is collateralised against.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Currency(Currency)
The standard curve for a currency — cash collateral in that currency.
Named(String)
A named curve, for anything the currency default does not describe.
Implementations§
§impl CollateralSpec
impl CollateralSpec
pub fn under_csa(currency: Currency, collateral: Currency) -> Self
pub fn under_csa(currency: Currency, collateral: Currency) -> Self
The discount key for cash flows in currency collateralised in
collateral: the currency’s own key when the two coincide, the named
key "{currency}-CSA-{collateral}" otherwise. The one spelling a
cross-currency template’s foreign leg and a market pin agree on.
pub fn parts(&self) -> Option<(&str, &str)>
pub fn parts(&self) -> Option<(&str, &str)>
The cashflow and collateral currency codes this key names, or None
where it names no pair.
Currency(c) is own-currency cash collateral and answers (c, c); a
Named key of the form "X-CSA-Y" decomposes to (X, Y). Anything
else — a CSA agreement name, an implied-curve label, any string a caller
chose to pin under — answers None, because it names no pair.
This is the fallible half of the key: the recipe registry is keyed by currency pairs, and a key outside that space simply has no recipe.
pub fn cashflow_ccy(&self) -> Option<&str>
pub fn cashflow_ccy(&self) -> Option<&str>
The cashflow currency code — the currency a trade pays in — where this key names a currency pair.
pub fn collateral_ccy(&self) -> Option<&str>
pub fn collateral_ccy(&self) -> Option<&str>
The collateral currency code — the currency the CSA posts in — where this key names a currency pair.
pub fn is_own_collateral(&self) -> bool
pub fn is_own_collateral(&self) -> bool
Whether this is own-currency cash collateral — the cashflow currency and the collateral currency are the same.
A key naming no currency pair is not own-collateral: it is not a statement about collateral currencies at all.
Trait Implementations§
§impl Clone for CollateralSpec
impl Clone for CollateralSpec
§fn clone(&self) -> CollateralSpec
fn clone(&self) -> CollateralSpec
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 CollateralSpec
impl Debug for CollateralSpec
§impl Display for CollateralSpec
impl Display for CollateralSpec
impl Eq for CollateralSpec
§impl FromStr for CollateralSpec
The inverse of Display, so an emitted key round-trips: a
valid currency code reads as currency collateral, anything else as a named
curve. Total — every string names some collateral — which is why the
error is Infallible.
impl FromStr for CollateralSpec
The inverse of Display, so an emitted key round-trips: a
valid currency code reads as currency collateral, anything else as a named
curve. Total — every string names some collateral — which is why the
error is Infallible.
§impl Hash for CollateralSpec
impl Hash for CollateralSpec
§impl Ord for CollateralSpec
Ordered by the arm and then the code, the way CurrencyPair is, and for
the same reason: a market keyed by collateral must enumerate its curves in a
fixed order so two risk vectors over the same market compare row by row.
Currency itself carries no order — it is a validated three-byte code.
impl Ord for CollateralSpec
Ordered by the arm and then the code, the way CurrencyPair is, and for
the same reason: a market keyed by collateral must enumerate its curves in a
fixed order so two risk vectors over the same market compare row by row.
Currency itself carries no order — it is a validated three-byte code.