Skip to main content

IndexCreditDefaultSwap

Struct IndexCreditDefaultSwap 

pub struct IndexCreditDefaultSwap {
    pub cds: CreditDefaultSwap,
    pub index_factor: f64,
}
Expand description

An index CDS (CDX / iTraxx): the homogeneous-pool product.

Priced as the single-name decomposition on the index survival curve — one curve standing in for every constituent, stored under the index id — scaled by the index factor, the remaining notional fraction after credit events (1.0 on the run). The fair spread is factor-invariant; the value scales linearly with the factor. The contract carries no constituents; given them, index_intrinsic values the replicating single-name portfolio and its duration-weighted spread, from which the index basis follows.

Fields§

§cds: CreditDefaultSwap

The underlying standard contract on the index identity — family, series and version, read back through index.

§index_factor: f64

The remaining notional fraction, in (0, 1].

Implementations§

§

impl IndexCreditDefaultSwap

pub fn standard( template: &CreditIndexTemplate, trade_date: NaiveDate, series: u32, tenor_years: u32, notional: f64, buys_protection: bool, ) -> Self

A contract on series from its family template: the index id is "{family}.{series}", the maturity the series’ own at tenor_years (CreditIndexTemplate::series_maturity — an off-the-run series keeps the maturity it was launched with, whatever the trade date), the coupon the family’s standard coupon, the schedule the standard CDS2015 generation, recovery floating (the family’s standard recovery is market data — store it under the index id), the factor 1.0.

§Panics

If the family’s currency code is not a currency, which a registered template’s never is.

pub fn standard_maturing( template: &CreditIndexTemplate, trade_date: NaiveDate, series: u32, maturity: NaiveDate, notional: f64, buys_protection: bool, ) -> Self

standard with the maturity supplied directly.

The pair mirrors CreditDefaultSwap::standard and its twin: the tenor-taking form computes the CDS2015 maturity and delegates, so the roll rule has one reading and a caller holding a maturity off a confirm need not reproduce it.

§Panics

If the family’s currency code is not a currency, which a registered template’s never is.

pub fn index(&self) -> Option<&CreditIndexId>

The index — family, series, version — the curve and marks are keyed by, or none where the underlying was built on a single name’s identity by hand.

pub fn with_index_factor(self, factor: f64) -> Result<Self, CreditError>

Sets the index factor, validated to (0, 1].

§Errors

CreditError::IndexFactor outside that range.

pub fn after_credit_event( &self, event: &CreditEvent, ) -> Result<(Self, IndexSettlement), CreditError>

The contract after event: the defaulted name removed, the factor reduced by its weight and the version incremented, as the index is re-versioned after an ISDA credit event — with what the event settles.

§Errors

CreditError for a weight that is not positive or exceeds the factor left, an auction recovery outside [0, 1], or an event outside the contract’s protection.

pub fn after_credit_events( &self, events: &[CreditEvent], ) -> Result<(Self, Vec<IndexSettlement>), CreditError>

The contract after each of events in turn, and what each settles.

§Errors

As after_credit_event, for the first event refused.

pub fn with_version(self, version: u32) -> Self

Sets the version inside the index identity — the contract on another version of the same series, keyed to that version’s curve.

pub fn with_protection_start( self, protection_start: NaiveDate, ) -> Result<Self, CreditError>

The underlying contract protecting from protection_start; see CreditDefaultSwap::with_protection_start.

§Errors

As the underlying’s.

pub fn with_upfront(self, upfront: f64) -> Self

Sets the upfront on the underlying contract.

pub fn with_fixed_recovery(self, recovery: f64) -> Self

Locks a contractual recovery on the underlying contract.

Trait Implementations§

§

impl Clone for IndexCreditDefaultSwap

§

fn clone(&self) -> IndexCreditDefaultSwap

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 IndexCreditDefaultSwap

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for IndexCreditDefaultSwap

§

fn eq(&self, other: &IndexCreditDefaultSwap) -> 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<R: Scalar> Priceable<R> for IndexCreditDefaultSwap

§

fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>

The single-name value on the index curve, scaled by the factor.

§

fn par_rate(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>

The fair spread — factor-invariant, the factor scaling both legs.

§

fn par_spread(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>

The par (breakeven) floating-leg spread. Zero for a product with no floating leg. Read more
§

impl PricingRiskFactors for IndexCreditDefaultSwap

§

fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>

The underlying contract’s factors: the index id is its entity.

§

impl Product for IndexCreditDefaultSwap

§

fn restruck_at_rate(&self, rate: f64) -> Option<AnyInstrument>

Re-struck at the running coupon rate.

§

fn currency(&self) -> Currency

The currency the product pays in. An FX product values in its quote currency; a book converts.
§

fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>

The contract dates the product resolved to, as (name, date) pairs — exactly the dates its stated constructor takes, so a product built through a derived form can be read back and rebuilt through the stated one. Empty for a product with no stated form. No default: every product states which it is — see AnyInstrument::contract_dates.
§

fn legs(&self) -> Option<Vec<&Leg>>

The legs the product itself holds, in a declared order, or None for a product that holds none — see AnyInstrument::legs. No default: every product states which it is.
§

fn final_payment_date(&self) -> Option<NaiveDate>

The date of the product’s final payment, where a calibration rung can be built on it; None for a product no ladder is built from.
§

fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>

This product re-struck at the basis spread spread on its spread leg, or None for a product that quotes none.
§

impl StructuralPartialEq for IndexCreditDefaultSwap

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.