Struct CsaSpec
pub struct CsaSpec {
pub currency: String,
pub overnight_index: OvernightIndex,
}Expand description
Collateral (CSA) specification: collateral currency + its overnight index.
This is the CSA definition used by cross-currency templates — distinct from
market::context::CollateralSpec, which
is the discount-curve key {cashflow_ccy, collateral_ccy}.
Fields§
§currency: StringCollateral currency (ISO 4217 code).
overnight_index: OvernightIndexOvernight index of the collateral CSA.
Implementations§
§impl CsaSpec
impl CsaSpec
pub fn new(overnight_index_code: &str) -> Self
pub fn new(overnight_index_code: &str) -> Self
A CSA collateralised against the overnight index named by
overnight_index_code (e.g. "USD-SOFR", "EUR-ESTR"). The collateral
currency is the index’s currency — an overnight index is currency-specific,
so "USD-SOFR" yields USD collateral. Panics if the code names no known
overnight index; the codes are reference data validated at the edge.
pub fn usd_sofr() -> Self
pub fn usd_sofr() -> Self
USD/SOFR collateral — the dominant CSA for cross-currency basis swaps.
pub fn eur_estr() -> Self
pub fn eur_estr() -> Self
EUR/ESTR collateral.
§impl CsaSpec
impl CsaSpec
pub fn on(overnight_index_code: &str) -> Result<Self, XccyTemplateError>
pub fn on(overnight_index_code: &str) -> Result<Self, XccyTemplateError>
A CSA paying the overnight index overnight_index_code, refusing a
code that names none rather than panicking as CsaSpec::new does
on reference data.
§Errors
XccyTemplateError::UnknownIndex or
XccyTemplateError::NotOvernight.
pub fn currency_of(csa: &str) -> Result<Currency, XccyTemplateError>
pub fn currency_of(csa: &str) -> Result<Currency, XccyTemplateError>
The collateral currency a CSA argument names, read by its shape: three
letters are a currency, a code with a - an overnight index, which
names its currency. What a trade’s discount key needs, so a currency
with no default index still serves.
§Errors
XccyTemplateError::NotACsa for anything else, and on’s
refusals for an index code that names no overnight index.
pub fn named(csa: &str) -> Result<Self, XccyTemplateError>
pub fn named(csa: &str) -> Result<Self, XccyTemplateError>
The CSA a CSA argument names: an overnight index ("EUR-ESTR"), or a
collateral currency ("EUR") read as its default index
(for_currency).
§Errors
As currency_of, and
XccyTemplateError::NoDefaultCsa for a currency with no default.
fn currency_code(csa: &str) -> Result<Currency, XccyTemplateError>
pub fn for_currency(currency: Currency) -> Result<Self, XccyTemplateError>
pub fn for_currency(currency: Currency) -> Result<Self, XccyTemplateError>
The CSA a currency names on its own: posting currency and paying the
overnight index its shipped own-collateral curve calibrates on — read
from that recipe, so it cannot drift from it.
§Errors
XccyTemplateError::NoDefaultCsa where no shipped currency recipe
calibrates on an overnight index.