QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CDO Class Reference

collateralized debt obligation More...

#include <cdo.hpp>

+ Inheritance diagram for CDO:
+ Collaboration diagram for CDO:

Public Member Functions

 CDO (Real attachment, Real detachment, std::vector< Real > nominals, const std::vector< Handle< DefaultProbabilityTermStructure > > &basket, Handle< OneFactorCopula > copula, bool protectionSeller, Schedule premiumSchedule, Rate premiumRate, DayCounter dayCounter, Rate recoveryRate, Rate upfrontPremiumRate, Handle< YieldTermStructure > yieldTS, Size nBuckets, const Period &integrationStep=Period(10, Years))
 
Real nominal () const
 
Real lgd () const
 
Real attachment () const
 
Real detachment () const
 
std::vector< Realnominals ()
 
Size size ()
 
bool isExpired () const override
 returns whether the instrument might have value greater than zero. More...
 
Rate fairPremium () const
 
Rate premiumValue () const
 
Rate protectionValue () const
 
Size error () const
 
- Public Member Functions inherited from Instrument
 Instrument ()
 
Real NPV () const
 returns the net present value of the instrument. More...
 
Real errorEstimate () const
 returns the error estimate on the NPV when available. More...
 
const DatevaluationDate () const
 returns the date the net present value refers to. More...
 
template<typename T >
T result (const std::string &tag) const
 returns any additional result returned by the pricing engine. More...
 
const std::map< std::string, ext::any > & additionalResults () const
 returns all additional result returned by the pricing engine. More...
 
void setPricingEngine (const ext::shared_ptr< PricingEngine > &)
 set the pricing engine to be used. More...
 
virtual void setupArguments (PricingEngine::arguments *) const
 
virtual void fetchResults (const PricingEngine::results *) const
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Private Member Functions

void setupExpired () const override
 
void performCalculations () const override
 
Real expectedTrancheLoss (Date d) const
 

Private Attributes

Real attachment_
 
Real detachment_
 
std::vector< Realnominals_
 
std::vector< Handle< DefaultProbabilityTermStructure > > basket_
 
Handle< OneFactorCopulacopula_
 
bool protectionSeller_
 
Schedule premiumSchedule_
 
Rate premiumRate_
 
DayCounter dayCounter_
 
Rate recoveryRate_
 
Rate upfrontPremiumRate_
 
Handle< YieldTermStructureyieldTS_
 
Size nBuckets_
 
Period integrationStep_
 
std::vector< Reallgds_
 
Real nominal_
 
Real lgd_
 
Real xMax_
 
Real xMin_
 
Size error_
 
Real premiumValue_
 
Real protectionValue_
 
Real upfrontPremiumValue_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Instrument
void calculate () const override
 
void performCalculations () const override
 
- Protected Member Functions inherited from LazyObject
- Protected Attributes inherited from Instrument
Real NPV_
 
Real errorEstimate_
 
Date valuationDate_
 
std::map< std::string, ext::any > additionalResults_
 
ext::shared_ptr< PricingEngineengine_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Detailed Description

collateralized debt obligation

The instrument prices a mezzanine CDO tranche with loss given default between attachment point \( D_1\) and detachment point \( D_2 > D_1 \).

For purchased protection, the instrument value is given by the difference of the protection value \( V_1 \) and premium value \( V_2 \),

\[ V = V_1 - V_2. \]

The protection leg is priced as follows:

The premium is paid on the protected notional amount, initially \( D_2 - D_1. \) This notional amount is reduced by the expected protection payments \( E_i \) at times \( t_i, \) so that the premium value is calculated as

\[ V_2 = m \, \cdot \sum_{i=1}^N \,(D_2 - D_1 - E_i) \cdot \Delta_{i-1,i}\,d_i \]

where \( m \) is the premium rate, \( \Delta_{i-1, i}\) is the day count fraction between date/time \( t_{i-1}\) and \( t_i.\)

The construction of the portfolio loss distribution \( E_i \) is based on the probability bucketing algorithm described in

John Hull and Alan White, "Valuation of a CDO and nth to default CDS without Monte Carlo simulation", Journal of Derivatives 12, 2, 2004

The pricing algorithm allows for varying notional amounts and default termstructures of the underlyings.

Definition at line 98 of file cdo.hpp.

Constructor & Destructor Documentation

◆ CDO()

CDO ( Real  attachment,
Real  detachment,
std::vector< Real nominals,
const std::vector< Handle< DefaultProbabilityTermStructure > > &  basket,
Handle< OneFactorCopula copula,
bool  protectionSeller,
Schedule  premiumSchedule,
Rate  premiumRate,
DayCounter  dayCounter,
Rate  recoveryRate,
Rate  upfrontPremiumRate,
Handle< YieldTermStructure yieldTS,
Size  nBuckets,
const Period integrationStep = Period(10, Years) 
)
Parameters
attachmentfraction of the LGD where protection starts
detachmentfraction of the LGD where protection ends
nominalsvector of basket nominal amounts
basketdefault basket represented by a vector of default term structures that allow computing single name default probabilities depending on time
copulaone-factor copula
protectionSellersold protection if set to true, purchased otherwise
premiumScheduleschedule for premium payments
premiumRateannual premium rate, e.g. 0.05 for 5% p.a.
dayCounterday count convention for the premium rate
recoveryRaterecovery rate as a fraction
upfrontPremiumRatepremium as a tranche notional fraction
yieldTSyield term structure handle
nBucketsnumber of distribution buckets
integrationSteptime step for integrating over one premium period; if larger than premium period length, a single step is taken

Definition at line 28 of file cdo.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ nominal()

Real nominal ( ) const

Definition at line 136 of file cdo.hpp.

◆ lgd()

Real lgd ( ) const

Definition at line 137 of file cdo.hpp.

◆ attachment()

Real attachment ( ) const

Definition at line 138 of file cdo.hpp.

◆ detachment()

Real detachment ( ) const

Definition at line 139 of file cdo.hpp.

◆ nominals()

std::vector< Real > nominals ( )

Definition at line 140 of file cdo.hpp.

◆ size()

Size size ( )

Definition at line 141 of file cdo.hpp.

◆ isExpired()

bool isExpired ( ) const
overridevirtual

returns whether the instrument might have value greater than zero.

Implements Instrument.

Definition at line 84 of file cdo.cpp.

+ Here is the call graph for this function:

◆ fairPremium()

Rate fairPremium ( ) const

Definition at line 203 of file cdo.cpp.

+ Here is the call graph for this function:

◆ premiumValue()

Rate premiumValue ( ) const

Definition at line 188 of file cdo.cpp.

+ Here is the call graph for this function:

◆ protectionValue()

Rate protectionValue ( ) const

Definition at line 193 of file cdo.cpp.

+ Here is the call graph for this function:

◆ error()

Size error ( ) const

Definition at line 198 of file cdo.cpp.

+ Here is the call graph for this function:

◆ setupExpired()

void setupExpired ( ) const
overrideprivatevirtual

This method must leave the instrument in a consistent state when the expiration condition is met.

Reimplemented from Instrument.

Definition at line 90 of file cdo.cpp.

+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
overrideprivatevirtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Implements LazyObject.

Definition at line 118 of file cdo.cpp.

+ Here is the call graph for this function:

◆ expectedTrancheLoss()

Real expectedTrancheLoss ( Date  d) const
private

Definition at line 95 of file cdo.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ attachment_

Real attachment_
private

Definition at line 154 of file cdo.hpp.

◆ detachment_

Real detachment_
private

Definition at line 155 of file cdo.hpp.

◆ nominals_

std::vector<Real> nominals_
private

Definition at line 156 of file cdo.hpp.

◆ basket_

std::vector<Handle<DefaultProbabilityTermStructure> > basket_
private

Definition at line 157 of file cdo.hpp.

◆ copula_

Handle<OneFactorCopula> copula_
private

Definition at line 158 of file cdo.hpp.

◆ protectionSeller_

bool protectionSeller_
private

Definition at line 159 of file cdo.hpp.

◆ premiumSchedule_

Schedule premiumSchedule_
private

Definition at line 161 of file cdo.hpp.

◆ premiumRate_

Rate premiumRate_
private

Definition at line 162 of file cdo.hpp.

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 163 of file cdo.hpp.

◆ recoveryRate_

Rate recoveryRate_
private

Definition at line 164 of file cdo.hpp.

◆ upfrontPremiumRate_

Rate upfrontPremiumRate_
private

Definition at line 165 of file cdo.hpp.

◆ yieldTS_

Handle<YieldTermStructure> yieldTS_
private

Definition at line 166 of file cdo.hpp.

◆ nBuckets_

Size nBuckets_
private

Definition at line 167 of file cdo.hpp.

◆ integrationStep_

Period integrationStep_
private

Definition at line 168 of file cdo.hpp.

◆ lgds_

std::vector<Real> lgds_
private

Definition at line 170 of file cdo.hpp.

◆ nominal_

Real nominal_
private

Definition at line 172 of file cdo.hpp.

◆ lgd_

Real lgd_
private

Definition at line 173 of file cdo.hpp.

◆ xMax_

Real xMax_
private

Definition at line 174 of file cdo.hpp.

◆ xMin_

Real xMin_
private

Definition at line 175 of file cdo.hpp.

◆ error_

Size error_
mutableprivate

Definition at line 177 of file cdo.hpp.

◆ premiumValue_

Real premiumValue_
mutableprivate

Definition at line 179 of file cdo.hpp.

◆ protectionValue_

Real protectionValue_
mutableprivate

Definition at line 180 of file cdo.hpp.

◆ upfrontPremiumValue_

Real upfrontPremiumValue_
mutableprivate

Definition at line 181 of file cdo.hpp.