Skip to main content

CdoTranche

Struct CdoTranche 

pub struct CdoTranche {
    pub cds: CreditDefaultSwap,
    pub attach: f64,
    pub detach: f64,
    pub upfront: f64,
    pub index_factor: f64,
    pub recovery_model: TrancheRecovery,
    pub copula: TrancheCopula,
    pub names: Option<u32>,
}
Expand description

A synthetic CDO tranche [attach, detach] on an index pool, priced off the large-homogeneous-pool expected tranche loss under base correlation.

The protection leg pays the tranche’s loss increments; the premium leg accrues the running spread on the outstanding tranche notional. Losses come from the one-factor Gaussian LHP model on the index survival curve with a uniform recovery, the correlation read per tranche off the index’s base-correlation curve and applied by equity-tranche differencing: ETL(A, D) = ETL(0, D; ρ(D)) − ETL(0, A; ρ(A)).

After credit events on the pool the tranche lives on the surviving portfolio: index_factor is that portfolio’s share of the original, and attach / detach are points on it (see after_credit_event).

The recovery is recovery_model: constant by default, or Amraoui–Hitier stochastic recovery falling with the common factor to a floor (see with_recovery_floor). The outstanding notional the premium accrues on is eroded by loss from the bottom; the expected recovery’s amortisation from the top is not modelled, under either.

Fields§

§cds: CreditDefaultSwap

The standard index contract on the pool notional; its premium schedule, coupon and protection start are the tranche’s.

§attach: f64

The attachment point, a fraction of the surviving pool.

§detach: f64

The detachment point, a fraction of the surviving pool.

§upfront: f64

The upfront the protection buyer pays, as a decimal of the tranche notional.

§index_factor: f64

The surviving pool as a share of the original, in [0, 1]: 1 at booking, reduced by each defaulted name’s weight.

§recovery_model: TrancheRecovery

How the pool recovers from a default: the model’s, not the event’s — a settled event recovers at its auction price. A contract model, or Amraoui–Hitier on the market’s floor for the index.

§copula: TrancheCopula

The one-factor copula the pool’s loss is read under: Gaussian unless with_student_t, or the double-t on the market’s degrees of freedom for the index.

§names: Option<u32>

The pool’s number of names, where the tranche is valued on a finite homogeneous pool — the conditional default count binomial — rather than in the large-pool limit; None is the limit.

Implementations§

§

impl CdoTranche

pub fn with_names(self, names: u32) -> Result<Self, CreditError>

The tranche valued on a finite homogeneous pool of names identical constituents rather than in the large-pool limit. Gaussian copula and the contract’s constant recovery only; the pricer refuses the rest by name.

§Errors

CreditError::PoolNames for zero names.

pub fn standard( template: &CreditIndexTemplate, trade_date: NaiveDate, series: u32, tenor_years: u32, pool_notional: f64, attach: f64, detach: f64, spread: f64, buys_protection: bool, ) -> Result<Self, CreditError>

A tranche on the standard index contract at spread.

§Errors

CreditError::Tranche unless 0 ≤ attach < detach ≤ 1.

§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, pool_notional: f64, attach: f64, detach: f64, spread: f64, buys_protection: bool, ) -> Result<Self, CreditError>

standard with the maturity supplied directly.

The pair mirrors CreditDefaultSwap::standard and its twin. The attachment check stays here, on the constructor that builds, so the tenor-taking form cannot skip it.

§Panics

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

§Errors

CreditError::Tranche for attachments outside 0 <= A < D <= 1.

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

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

pub fn width(&self) -> f64

The tranche width, detach − attach.

pub fn tranche_notional(&self) -> f64

The tranche notional, width · pool notional · index factor: the notional outstanding on the surviving pool.

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

Sets the index factor, validated to (0, 1]: the tranche booked on a pool that has already lost names, its points on the survivors.

§Errors

CreditError::IndexFactor outside that range.

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

The tranche after event on its pool, and what the event settles.

In the surviving pool’s terms the name weighs w/f; its loss l = w(1 − R)/f fills the pool from the bottom and its recovery r = wR/f from the top. The tranche [a, d] absorbs N·f·(clamp(l, a, d) − a), is written down by N·f·(d − clamp(1 − r, a, d)), and lands on the new pool [l, 1 − r], renormalised: a' = (clamp(a, l, 1 − r) − l)/(1 − l − r), likewise d'. Applied in turn, the events give the cumulative A' = (clamp(A, Lc, 1 − Rc) − Lc)/f, D' = (clamp(D, Lc, 1 − Rc) − Lc)/f. The factor falls by w, and the premium accrued on the removed notional over the running period is owed by the protection buyer. A tranche the event exhausts ends with attach == detach and is worth nothing.

§Errors

CreditError as for the index: 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<TrancheSettlement>), CreditError>

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

§Errors

As after_credit_event, for the first event refused.

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

Sets the upfront, as a decimal of the tranche notional.

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

Locks a contractual uniform recovery.

pub fn with_recovery_floor(self, floor: f64) -> Result<Self, CreditError>

Prices under Amraoui–Hitier stochastic recovery floored at floor (RecoveryModel::AmraouiHitier): recovery falls towards the floor in the bad states of the common factor, each name’s expected loss staying its CDS’s. Pricing refuses a floor above the mean recovery.

§Errors

CreditError::RecoveryFloor outside [0, 1).

pub fn on_market_recovery_floor(self) -> Self

Prices under Amraoui–Hitier stochastic recovery on the floor the market marks for this tranche’s index (index), so the floor carries a risk row on the recovery axis. A market without it is refused by name, as is a floor above the mean recovery.

pub fn on_market_copula_dof(self) -> Self

Prices under the double-t copula on the degrees of freedom the market marks for this tranche’s index, so each carries a risk row on the correlation axis. A market without them is refused by name.

pub fn with_student_t( self, factor_dof: f64, idiosyncratic_dof: f64, ) -> Result<Self, CreditError>

Prices under the double-t copula (Copula::StudentT): the factor and each name Student-t with factor_dof and idiosyncratic_dof degrees of freedom, scaled to unit variance. Composes with a recovery floor.

§Errors

CreditError::DegreesOfFreedom for a degree of freedom not in (2, ∞).

§

impl CdoTranche

fn index_or_unsupported(&self) -> Result<&CreditIndexId, PricingError>

The index the tranche’s marks are keyed by; a tranche hand-built on a single name’s identity has none to read them on.

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

(premium annuity on the outstanding tranche notional, protection) on the pool notional.

§

impl CdoTranche

fn resolved_recovery<R: Scalar>( &self, view: &PricingView<'_, R>, recovery: R, ) -> Result<ResolvedRecovery<R>, PricingError>

The recovery model against view, a floor above the mean recovery refused under either source.

fn resolved_copula<R: Scalar>( &self, view: &PricingView<'_, R>, ) -> Result<(Copula, Option<(R, R)>), PricingError>

The copula against view, and the degrees-of-freedom marks off its passive point where the market holds them.

Trait Implementations§

§

impl Clone for CdoTranche

§

fn clone(&self) -> CdoTranche

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 CdoTranche

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for CdoTranche

§

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

§

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

Buyer protection − premium − upfront · tranche notional, signed by side.

§

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

The fair running spread: protection over the outstanding-notional annuity.

§

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 CdoTranche

§

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

The index contract’s factors plus its base correlation, and the index’s market recovery floor and copula degrees of freedom where the tranche reads them from the market.

§

impl Product for CdoTranche

§

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 CdoTranche

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.