Skip to main content

CsaSpec

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: String

Collateral currency (ISO 4217 code).

§overnight_index: OvernightIndex

Overnight index of the collateral CSA.

Implementations§

§

impl CsaSpec

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

USD/SOFR collateral — the dominant CSA for cross-currency basis swaps.

pub fn eur_estr() -> Self

EUR/ESTR collateral.

§

impl CsaSpec

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>

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>

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>

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.

Trait Implementations§

§

impl Clone for CsaSpec

§

fn clone(&self) -> CsaSpec

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

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.