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: CreditDefaultSwapThe underlying standard contract on the index identity — family,
series and version, read back through index.
index_factor: f64The remaining notional fraction, in (0, 1].
Implementations§
§impl IndexCreditDefaultSwap
impl IndexCreditDefaultSwap
pub fn standard(
template: &CreditIndexTemplate,
trade_date: NaiveDate,
series: u32,
tenor_years: u32,
notional: f64,
buys_protection: bool,
) -> Self
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
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>
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>
pub fn with_index_factor(self, factor: f64) -> Result<Self, CreditError>
pub fn after_credit_event(
&self,
event: &CreditEvent,
) -> Result<(Self, IndexSettlement), CreditError>
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>
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
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>
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
pub fn with_upfront(self, upfront: f64) -> Self
Sets the upfront on the underlying contract.
pub fn with_fixed_recovery(self, recovery: f64) -> Self
pub fn with_fixed_recovery(self, recovery: f64) -> Self
Locks a contractual recovery on the underlying contract.
Trait Implementations§
§impl Clone for IndexCreditDefaultSwap
impl Clone for IndexCreditDefaultSwap
§fn clone(&self) -> IndexCreditDefaultSwap
fn clone(&self) -> IndexCreditDefaultSwap
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 IndexCreditDefaultSwap
impl Debug for IndexCreditDefaultSwap
§impl PartialEq for IndexCreditDefaultSwap
impl PartialEq for IndexCreditDefaultSwap
§fn eq(&self, other: &IndexCreditDefaultSwap) -> bool
fn eq(&self, other: &IndexCreditDefaultSwap) -> bool
self and other values to be equal, and is used by ==.§impl<R: Scalar> Priceable<R> for IndexCreditDefaultSwap
impl<R: Scalar> Priceable<R> for IndexCreditDefaultSwap
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
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>
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>
fn par_spread(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
§impl PricingRiskFactors for IndexCreditDefaultSwap
impl PricingRiskFactors for IndexCreditDefaultSwap
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
The underlying contract’s factors: the index id is its entity.
§impl Product for IndexCreditDefaultSwap
impl Product for IndexCreditDefaultSwap
§fn restruck_at_rate(&self, rate: f64) -> Option<AnyInstrument>
fn restruck_at_rate(&self, rate: f64) -> Option<AnyInstrument>
Re-struck at the running coupon rate.
§fn currency(&self) -> Currency
fn currency(&self) -> Currency
§fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
(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>>
fn legs(&self) -> Option<Vec<&Leg>>
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>
fn final_payment_date(&self) -> Option<NaiveDate>
None for a product no ladder is built from.§fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
spread on its spread
leg, or None for a product that quotes none.