Skip to main content

CreditLinkedSwap

Struct CreditLinkedSwap 

pub struct CreditLinkedSwap {
    pub credit: CreditCurveId,
    pub currency: Currency,
    pub collateral: CollateralSpec,
    pub legs: Vec<RoleLeg>,
    pub accrual_on_default: AccrualOnDefault,
    pub fixed_recovery: Option<f64>,
    pub default_payment_time: DefaultPaymentTime,
    indices: Vec<String>,
    foreign_credits: Vec<CreditCurveId>,
    foreign_collaterals: Vec<CollateralSpec>,
    leg_currencies: Vec<Currency>,
}
Expand description

A credit-linked swap: legs tagged by role against one reference entity.

Built through new, which checks the legs and reads off what the swap declares: the projection indices its coupons read, the entity’s curve in every leg currency beyond the trade’s, and every discount key beyond the trade’s own.

Fields§

§credit: CreditCurveId

The entity’s curve in the trade currency — the primary curve, whose market recovery the default and recovery legs read.

§currency: Currency

The trade currency, that every leg’s value converts into.

§collateral: CollateralSpec

The trade’s own discount key, declared as the discount curve.

§legs: Vec<RoleLeg>

The legs, each with its role.

§accrual_on_default: AccrualOnDefault

How a contingent coupon’s accrual to the default is settled: Halfway, None or Proportional.

§fixed_recovery: Option<f64>

The recovery the contract fixes, if any; None reads the primary curve’s market recovery.

§default_payment_time: DefaultPaymentTime

When a default-contingent payment is made.

§indices: Vec<String>

Every index the legs read, each once in the order read: the first two declared in the projection slots, the rest in the basket.

§foreign_credits: Vec<CreditCurveId>

The entity’s curve in each leg currency other than the trade’s, in first-seen order — declared as the credit basket.

§foreign_collaterals: Vec<CollateralSpec>

Every leg collateral key other than the trade’s own, in first-seen order — declared as the foreign discount basket.

§leg_currencies: Vec<Currency>

Each leg’s currency, in leg order.

Implementations§

§

impl CreditLinkedSwap

pub fn new( credit: CreditCurveId, currency: Currency, collateral: CollateralSpec, legs: Vec<RoleLeg>, accrual_on_default: AccrualOnDefault, fixed_recovery: Option<f64>, default_payment_time: DefaultPaymentTime, ) -> Result<Self, CreditLinkedSwapError>

A swap on credit — the entity’s curve in currency, the trade currency — discounted on collateral, paying legs under their roles.

§Errors

CreditLinkedSwapError for no legs, an empty, accumulating or non-deliverable leg, a fixed recovery outside [0, 1], or a leg in another currency on an index curve.

pub fn indices(&self) -> &[String]

Every index the legs read, each once in the order read.

pub fn foreign_credits(&self) -> &[CreditCurveId]

The entity’s curve in each leg currency other than the trade’s.

pub fn foreign_collaterals(&self) -> &[CollateralSpec]

Every leg collateral key other than the trade’s own.

pub fn leg_currencies(&self) -> &[Currency]

Each leg’s currency, in leg order.

pub fn credit_in(&self, currency: Currency) -> Option<&CreditCurveId>

The entity’s curve in currency: the primary curve in the trade currency, else the one declared for that leg currency.

pub fn maturity(&self) -> NaiveDate

The last payment date across the legs.

§Panics

Never: new admits no empty leg, so there is a payment.

§

impl CreditLinkedSwap

fn unsupported(entry_point: &'static str) -> PricingError

fn undeclared(detail: String) -> PricingError

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

Every leg under its role, each on its own curves, converted at spot.

An independent leg is its ordinary value. A contingent leg’s payments are survival-weighted to their dates, each coupon’s accrual to the default settled as the swap says: the midpoint rule or the exact integral on the curves’ node grid. A default or recovery leg’s amounts stand for the notional per payment date, integrated on the node grid — every payment date, credit pillar and discount node, on which the flat-hazard, flat-forward form is exact — a default in an interval paying the amount of the first payment date on or after it, discounted as the timing says, scaled by the loss or the recovery.

pub fn diagnostics<R: Scalar>( &self, view: &PricingView<'_, R>, ) -> Result<CreditLinkedSwapDiagnostics, PricingError>

Each part of the swap’s value, in the trade currency, and their sum.

§Errors

As Priceable::npv.

Trait Implementations§

§

impl Clone for CreditLinkedSwap

§

fn clone(&self) -> CreditLinkedSwap

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 CreditLinkedSwap

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for CreditLinkedSwap

§

fn eq(&self, other: &CreditLinkedSwap) -> 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 CreditLinkedSwap

§

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

The five components, summed in the trade currency.

§

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

The par rate — the fixed rate at which the product is worth nothing. Read more
§

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 CreditLinkedSwap

§

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

The trade’s discount key; every other leg collateral in the foreign discount basket; the entity’s curve in the trade currency, and in every other leg currency in the credit basket; the market recovery unless the contract fixes one; every projection the legs read, the first two in their slots and the rest in the basket; the cap and swaption vols an optioned or CMS coupon reads — in one currency, as the declaration holds one surface of each kind; the CMS spread correlation and the price index the first leg to read one declares.

§

impl Product for CreditLinkedSwap

§

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_rate(&self, _rate: f64) -> Option<AnyInstrument>

This product re-struck at the par rate rate — the scalar a par calibration rung on it is quoted in — or None for a product that carries no such scalar. What a quote scenario moves a rung to.
§

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 CreditLinkedSwap

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.