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: CreditCurveIdThe entity’s curve in the trade currency — the primary curve, whose market recovery the default and recovery legs read.
currency: CurrencyThe trade currency, that every leg’s value converts into.
collateral: CollateralSpecThe trade’s own discount key, declared as the discount curve.
legs: Vec<RoleLeg>The legs, each with its role.
accrual_on_default: AccrualOnDefaultHow 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: DefaultPaymentTimeWhen 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
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>
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 foreign_credits(&self) -> &[CreditCurveId]
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]
pub fn foreign_collaterals(&self) -> &[CollateralSpec]
Every leg collateral key other than the trade’s own.
pub fn leg_currencies(&self) -> &[Currency]
pub fn leg_currencies(&self) -> &[Currency]
Each leg’s currency, in leg order.
pub fn credit_in(&self, currency: Currency) -> Option<&CreditCurveId>
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.
§impl CreditLinkedSwap
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>
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>
pub fn diagnostics<R: Scalar>( &self, view: &PricingView<'_, R>, ) -> Result<CreditLinkedSwapDiagnostics, PricingError>
Trait Implementations§
§impl Clone for CreditLinkedSwap
impl Clone for CreditLinkedSwap
§fn clone(&self) -> CreditLinkedSwap
fn clone(&self) -> CreditLinkedSwap
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 CreditLinkedSwap
impl Debug for CreditLinkedSwap
§impl PartialEq for CreditLinkedSwap
impl PartialEq for CreditLinkedSwap
§fn eq(&self, other: &CreditLinkedSwap) -> bool
fn eq(&self, other: &CreditLinkedSwap) -> bool
self and other values to be equal, and is used by ==.§impl<R: Scalar> Priceable<R> for CreditLinkedSwap
impl<R: Scalar> Priceable<R> for CreditLinkedSwap
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
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>
fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§impl PricingRiskFactors for CreditLinkedSwap
impl PricingRiskFactors for CreditLinkedSwap
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
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
impl Product for CreditLinkedSwap
§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.