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

Base class for CDS helpers. More...

#include <defaultprobabilityhelpers.hpp>

+ Inheritance diagram for CdsHelper:
+ Collaboration diagram for CdsHelper:

Public Member Functions

 CdsHelper (const Handle< Quote > &quote, const Period &tenor, Integer settlementDays, Calendar calendar, Frequency frequency, BusinessDayConvention paymentConvention, DateGeneration::Rule rule, DayCounter dayCounter, Real recoveryRate, const Handle< YieldTermStructure > &discountCurve, bool settlesAccrual=true, bool paysAtDefaultTime=true, const Date &startDate=Date(), DayCounter lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, CreditDefaultSwap::PricingModel model=CreditDefaultSwap::Midpoint)
 
 CdsHelper (Rate quote, const Period &tenor, Integer settlementDays, Calendar calendar, Frequency frequency, BusinessDayConvention paymentConvention, DateGeneration::Rule rule, DayCounter dayCounter, Real recoveryRate, const Handle< YieldTermStructure > &discountCurve, bool settlesAccrual=true, bool paysAtDefaultTime=true, const Date &startDate=Date(), DayCounter lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, CreditDefaultSwap::PricingModel model=CreditDefaultSwap::Midpoint)
 
void setTermStructure (DefaultProbabilityTermStructure *) override
 
ext::shared_ptr< CreditDefaultSwapswap () const
 
void update () override
 
- Public Member Functions inherited from RelativeDateBootstrapHelper< TS >
 RelativeDateBootstrapHelper (const Handle< Quote > &quote)
 
 RelativeDateBootstrapHelper (Real quote)
 
- Public Member Functions inherited from BootstrapHelper< TS >
 BootstrapHelper (Handle< Quote > quote)
 
 BootstrapHelper (Real quote)
 
 ~BootstrapHelper () override=default
 
const Handle< Quote > & quote () const
 
virtual Real impliedQuote () const =0
 
Real quoteError () const
 
virtual void setTermStructure (TS *)
 sets the term structure to be used for pricing More...
 
virtual Date earliestDate () const
 earliest relevant date More...
 
virtual Date maturityDate () const
 instrument's maturity date More...
 
virtual Date latestRelevantDate () const
 latest relevant date More...
 
virtual Date pillarDate () const
 pillar date More...
 
virtual Date latestDate () const
 latest date More...
 
virtual void accept (AcyclicVisitor &)
 
- 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 ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 

Protected Member Functions

void initializeDates () override
 
virtual void resetEngine ()=0
 
- Protected Member Functions inherited from RelativeDateBootstrapHelper< TS >

Protected Attributes

Period tenor_
 
Integer settlementDays_
 
Calendar calendar_
 
Frequency frequency_
 
BusinessDayConvention paymentConvention_
 
DateGeneration::Rule rule_
 
DayCounter dayCounter_
 
Real recoveryRate_
 
Handle< YieldTermStructurediscountCurve_
 
bool settlesAccrual_
 
bool paysAtDefaultTime_
 
DayCounter lastPeriodDC_
 
bool rebatesAccrual_
 
CreditDefaultSwap::PricingModel model_
 
Schedule schedule_
 
ext::shared_ptr< CreditDefaultSwapswap_
 
RelinkableHandle< DefaultProbabilityTermStructureprobability_
 
Date protectionStart_
 protection effective date. More...
 
Date startDate_
 
- Protected Attributes inherited from RelativeDateBootstrapHelper< TS >
Date evaluationDate_
 
- Protected Attributes inherited from BootstrapHelper< TS >
Handle< Quotequote_
 
TS * termStructure_
 
Date earliestDate_
 
Date latestDate_
 
Date maturityDate_
 
Date latestRelevantDate_
 
Date pillarDate_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 

Detailed Description

Base class for CDS helpers.

Definition at line 48 of file defaultprobabilityhelpers.hpp.

Constructor & Destructor Documentation

◆ CdsHelper() [1/2]

CdsHelper ( const Handle< Quote > &  quote,
const Period tenor,
Integer  settlementDays,
Calendar  calendar,
Frequency  frequency,
BusinessDayConvention  paymentConvention,
DateGeneration::Rule  rule,
DayCounter  dayCounter,
Real  recoveryRate,
const Handle< YieldTermStructure > &  discountCurve,
bool  settlesAccrual = true,
bool  paysAtDefaultTime = true,
const Date startDate = Date(),
DayCounter  lastPeriodDayCounter = DayCounter(),
bool  rebatesAccrual = true,
CreditDefaultSwap::PricingModel  model = CreditDefaultSwap::Midpoint 
)

Constructor taking CDS market quote

Parameters
quoteThe helper's market quote.
tenorCDS tenor.
settlementDaysThe number of days from evaluation date to the start of the protection period. Prior to the CDS Big Bang in 2009, this was typically 1 calendar day. After the CDS Big Bang, this is typically 0 calendar days i.e. protection starts immediately.
calendarCDS calendar. Typically weekends only for standard non-JPY CDS and TYO for JPY.
frequencyCoupon frequency. Typically 3 months for standard CDS.
paymentConventionThe convention applied to coupons schedules and settlement dates.
ruleThe date generation rule for generating the CDS schedule. Typically, for CDS prior to the Big Bang, OldCDS should be used. After the Big Bang, CDS was typical and since 2015 CDS2015 is standard.
dayCounterThe day counter for CDS fee leg coupons. Typically it is Actual/360, excluding accrual end, for all but the final coupon period with Actual/360, including accrual end, for the final coupon. The lastPeriodDayCounter below allows for this distinction.
recoveryRateThe recovery rate of the underlying reference entity.
discountCurveA handle to the relevant discount curve.
settlesAccrualSet to true if accrued fee is paid on the occurrence of a credit event and set to false if it is not. Typically this is true.
paysAtDefaultTimeSet to true if default payment is made at time of credit event or postponed to the end of the coupon period. Typically this is true.
startDateUsed to specify an explicit start date for the CDS schedule and the date from which the CDS maturity is calculated via the tenor. Useful for off-the-run index schedules.
lastPeriodDayCounterThe day counter for the last fee leg coupon. See comment on dayCounter.
rebatesAccrualSet to true if the fee leg accrual is rebated on the cash settlement date. For CDS after the Big Bang, this is typically true.
modelThe pricing model to use for the helper.

Definition at line 32 of file defaultprobabilityhelpers.cpp.

+ Here is the call graph for this function:

◆ CdsHelper() [2/2]

CdsHelper ( Rate  quote,
const Period tenor,
Integer  settlementDays,
Calendar  calendar,
Frequency  frequency,
BusinessDayConvention  paymentConvention,
DateGeneration::Rule  rule,
DayCounter  dayCounter,
Real  recoveryRate,
const Handle< YieldTermStructure > &  discountCurve,
bool  settlesAccrual = true,
bool  paysAtDefaultTime = true,
const Date startDate = Date(),
DayCounter  lastPeriodDayCounter = DayCounter(),
bool  rebatesAccrual = true,
CreditDefaultSwap::PricingModel  model = CreditDefaultSwap::Midpoint 
)

Constructor taking CDS market quote

Parameters
quoteThe helper's market quote.
tenorCDS tenor.
settlementDaysThe number of days from evaluation date to the start of the protection period. Prior to the CDS Big Bang in 2009, this was typically 1 calendar day. After the CDS Big Bang, this is typically 0 calendar days i.e. protection starts immediately.
calendarCDS calendar. Typically weekends only for standard non-JPY CDS and TYO for JPY.
frequencyCoupon frequency. Typically 3 months for standard CDS.
paymentConventionThe convention applied to coupons schedules and settlement dates.
ruleThe date generation rule for generating the CDS schedule. Typically, for CDS prior to the Big Bang, OldCDS should be used. After the Big Bang, CDS was typical and since 2015 CDS2015 is standard.
dayCounterThe day counter for CDS fee leg coupons. Typically it is Actual/360, excluding accrual end, for all but the final coupon period with Actual/360, including accrual end, for the final coupon. The lastPeriodDayCounter below allows for this distinction.
recoveryRateThe recovery rate of the underlying reference entity.
discountCurveA handle to the relevant discount curve.
settlesAccrualSet to true if accrued fee is paid on the occurrence of a credit event and set to false if it is not. Typically this is true.
paysAtDefaultTimeSet to true if default payment is made at time of credit event or postponed to the end of the coupon period. Typically this is true.
startDateUsed to specify an explicit start date for the CDS schedule and the date from which the CDS maturity is calculated via the tenor. Useful for off-the-run index schedules.
lastPeriodDayCounterThe day counter for the last fee leg coupon. See comment on dayCounter.
rebatesAccrualSet to true if the fee leg accrual is rebated on the cash settlement date. For CDS after the Big Bang, this is typically true.
modelThe pricing model to use for the helper.

Definition at line 60 of file defaultprobabilityhelpers.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ setTermStructure()

void setTermStructure ( DefaultProbabilityTermStructure ts)
override

Definition at line 88 of file defaultprobabilityhelpers.cpp.

+ Here is the call graph for this function:

◆ swap()

ext::shared_ptr< CreditDefaultSwap > swap ( ) const

Definition at line 116 of file defaultprobabilityhelpers.hpp.

◆ update()

void update ( )
overridevirtual

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Reimplemented from RelativeDateBootstrapHelper< TS >.

Definition at line 98 of file defaultprobabilityhelpers.cpp.

+ Here is the call graph for this function:

◆ initializeDates()

void initializeDates ( )
overrideprotectedvirtual

Implements RelativeDateBootstrapHelper< TS >.

Reimplemented in UpfrontCdsHelper.

Definition at line 103 of file defaultprobabilityhelpers.cpp.

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

◆ resetEngine()

virtual void resetEngine ( )
protectedpure virtual

Implemented in SpreadCdsHelper, and UpfrontCdsHelper.

+ Here is the caller graph for this function:

Member Data Documentation

◆ tenor_

Period tenor_
protected

Definition at line 124 of file defaultprobabilityhelpers.hpp.

◆ settlementDays_

Integer settlementDays_
protected

Definition at line 125 of file defaultprobabilityhelpers.hpp.

◆ calendar_

Calendar calendar_
protected

Definition at line 126 of file defaultprobabilityhelpers.hpp.

◆ frequency_

Frequency frequency_
protected

Definition at line 127 of file defaultprobabilityhelpers.hpp.

◆ paymentConvention_

BusinessDayConvention paymentConvention_
protected

Definition at line 128 of file defaultprobabilityhelpers.hpp.

◆ rule_

DateGeneration::Rule rule_
protected

Definition at line 129 of file defaultprobabilityhelpers.hpp.

◆ dayCounter_

DayCounter dayCounter_
protected

Definition at line 130 of file defaultprobabilityhelpers.hpp.

◆ recoveryRate_

Real recoveryRate_
protected

Definition at line 131 of file defaultprobabilityhelpers.hpp.

◆ discountCurve_

Handle<YieldTermStructure> discountCurve_
protected

Definition at line 132 of file defaultprobabilityhelpers.hpp.

◆ settlesAccrual_

bool settlesAccrual_
protected

Definition at line 133 of file defaultprobabilityhelpers.hpp.

◆ paysAtDefaultTime_

bool paysAtDefaultTime_
protected

Definition at line 134 of file defaultprobabilityhelpers.hpp.

◆ lastPeriodDC_

DayCounter lastPeriodDC_
protected

Definition at line 135 of file defaultprobabilityhelpers.hpp.

◆ rebatesAccrual_

bool rebatesAccrual_
protected

Definition at line 136 of file defaultprobabilityhelpers.hpp.

◆ model_

Definition at line 137 of file defaultprobabilityhelpers.hpp.

◆ schedule_

Schedule schedule_
protected

Definition at line 139 of file defaultprobabilityhelpers.hpp.

◆ swap_

ext::shared_ptr<CreditDefaultSwap> swap_
protected

Definition at line 140 of file defaultprobabilityhelpers.hpp.

◆ probability_

Definition at line 141 of file defaultprobabilityhelpers.hpp.

◆ protectionStart_

Date protectionStart_
protected

protection effective date.

Definition at line 143 of file defaultprobabilityhelpers.hpp.

◆ startDate_

Date startDate_
protected

Definition at line 144 of file defaultprobabilityhelpers.hpp.