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: CreditDefaultSwapThe standard index contract on the pool notional; its premium schedule, coupon and protection start are the tranche’s.
attach: f64The attachment point, a fraction of the surviving pool.
detach: f64The detachment point, a fraction of the surviving pool.
upfront: f64The upfront the protection buyer pays, as a decimal of the tranche notional.
index_factor: f64The surviving pool as a share of the original, in [0, 1]: 1 at
booking, reduced by each defaulted name’s weight.
recovery_model: TrancheRecoveryHow 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: TrancheCopulaThe 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
impl CdoTranche
pub fn with_names(self, names: u32) -> Result<Self, CreditError>
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>
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>
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>
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 tranche_notional(&self) -> f64
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>
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>
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>
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
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
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>
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
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
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>
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
impl CdoTranche
fn index_or_unsupported(&self) -> Result<&CreditIndexId, PricingError>
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>
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
impl CdoTranche
fn resolved_recovery<R: Scalar>(
&self,
view: &PricingView<'_, R>,
recovery: R,
) -> Result<ResolvedRecovery<R>, PricingError>
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>
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
impl Clone for CdoTranche
§fn clone(&self) -> CdoTranche
fn clone(&self) -> CdoTranche
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 CdoTranche
impl Debug for CdoTranche
§impl PartialEq for CdoTranche
impl PartialEq for CdoTranche
§impl<R: Scalar> Priceable<R> for CdoTranche
impl<R: Scalar> Priceable<R> for CdoTranche
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
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>
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>
fn par_spread(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
§impl PricingRiskFactors for CdoTranche
impl PricingRiskFactors for CdoTranche
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
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
impl Product for CdoTranche
§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_rate(&self, _rate: f64) -> Option<AnyInstrument>
fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
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>
fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
spread on its spread
leg, or None for a product that quotes none.