|
QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
|
Credit default swap. More...
#include <ql/instruments/creditdefaultswap.hpp>
Public Types | |
| enum | PricingModel { Midpoint , ISDA } |
| Public Types inherited from Observer | |
| typedef set_type::iterator | iterator |
Public Member Functions | |
Constructors | |
| CreditDefaultSwap (Protection::Side side, Real notional, Rate spread, const Schedule &schedule, BusinessDayConvention paymentConvention, const DayCounter &dayCounter, bool settlesAccrual=true, bool paysAtDefaultTime=true, const Date &protectionStart=Date(), ext::shared_ptr< Claim >=ext::shared_ptr< Claim >(), const DayCounter &lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, const Date &tradeDate=Date(), Natural cashSettlementDays=3) | |
| CDS quoted as running-spread only. | |
| CreditDefaultSwap (Protection::Side side, Real notional, Rate upfront, Rate spread, const Schedule &schedule, BusinessDayConvention paymentConvention, const DayCounter &dayCounter, bool settlesAccrual=true, bool paysAtDefaultTime=true, const Date &protectionStart=Date(), const Date &upfrontDate=Date(), ext::shared_ptr< Claim >=ext::shared_ptr< Claim >(), const DayCounter &lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, const Date &tradeDate=Date(), Natural cashSettlementDays=3) | |
| CDS quoted as upfront and running spread. | |
Inspectors | |
| Protection::Side | side () const |
| Real | notional () const |
| Rate | runningSpread () const |
| ext::optional< Rate > | upfront () const |
| bool | settlesAccrual () const |
| bool | paysAtDefaultTime () const |
| const Leg & | coupons () const |
| const Date & | protectionStartDate () const |
| The first date for which defaults will trigger the contract. | |
| const Date & | protectionEndDate () const |
| The last date for which defaults will trigger the contract. | |
| bool | rebatesAccrual () const |
| const ext::shared_ptr< SimpleCashFlow > & | upfrontPayment () const |
| const ext::shared_ptr< SimpleCashFlow > & | accrualRebate () const |
| const Date & | tradeDate () const |
| Natural | cashSettlementDays () const |
Results | |
| Rate | fairUpfront () const |
| Rate | fairSpread () const |
| Real | couponLegBPS () const |
| Real | upfrontBPS () const |
| Real | couponLegNPV () const |
| Real | defaultLegNPV () const |
| Real | upfrontNPV () const |
| Real | accrualRebateNPV () const |
| Rate | impliedHazardRate (Real targetNPV, const Handle< YieldTermStructure > &discountCurve, const DayCounter &dayCounter, Real recoveryRate=0.4, Real accuracy=1.0e-8, PricingModel model=Midpoint) const |
| Implied hazard rate calculation. | |
| Rate | conventionalSpread (Real conventionalRecovery, const Handle< YieldTermStructure > &discountCurve, const DayCounter &dayCounter, PricingModel model=Midpoint) const |
| Conventional/standard upfront-to-spread conversion. | |
| Public Member Functions inherited from Instrument | |
| Real | NPV () const |
| returns the net present value of the instrument. | |
| Real | errorEstimate () const |
| returns the error estimate on the NPV when available. | |
| const Date & | valuationDate () const |
| returns the date the net present value refers to. | |
| template<typename T> | |
| T | result (const std::string &tag) const |
| returns any additional result returned by the pricing engine. | |
| const std::map< std::string, ext::any > & | additionalResults () const |
| returns all additional result returned by the pricing engine. | |
| void | setPricingEngine (const ext::shared_ptr< PricingEngine > &) |
| set the pricing engine to be used. | |
| Public Member Functions inherited from LazyObject | |
| void | update () override |
| bool | isCalculated () const |
| void | forwardFirstNotificationOnly () |
| void | alwaysForwardNotifications () |
| void | recalculate () |
| void | freeze () |
| void | unfreeze () |
| Public Member Functions inherited from Observable | |
| Observable (const Observable &) | |
| Observable & | operator= (const Observable &) |
| Observable (Observable &&)=delete | |
| Observable & | operator= (Observable &&)=delete |
| void | notifyObservers () |
| Public Member Functions inherited from Observer | |
| Observer (const Observer &) | |
| Observer & | operator= (const Observer &) |
| std::pair< iterator, bool > | registerWith (const ext::shared_ptr< Observable > &) |
| void | registerWithObservables (const ext::shared_ptr< Observer > &) |
| Size | unregisterWith (const ext::shared_ptr< Observable > &) |
| void | unregisterWithAll () |
| virtual void | deepUpdate () |
Instrument interface | |
| Protection::Side | side_ |
| Real | notional_ |
| ext::optional< Rate > | upfront_ |
| Rate | runningSpread_ |
| bool | settlesAccrual_ |
| bool | paysAtDefaultTime_ |
| ext::shared_ptr< Claim > | claim_ |
| Leg | leg_ |
| ext::shared_ptr< SimpleCashFlow > | upfrontPayment_ |
| ext::shared_ptr< SimpleCashFlow > | accrualRebate_ |
| Date | protectionStart_ |
| Date | tradeDate_ |
| Natural | cashSettlementDays_ |
| Date | maturity_ |
| Rate | fairUpfront_ |
| Rate | fairSpread_ |
| Real | couponLegBPS_ |
| Real | couponLegNPV_ |
| Real | upfrontBPS_ |
| Real | upfrontNPV_ |
| Real | defaultLegNPV_ |
| Real | accrualRebateNPV_ |
| bool | isExpired () const override |
| returns whether the instrument might have value greater than zero. | |
| void | setupArguments (PricingEngine::arguments *) const override |
| void | fetchResults (const PricingEngine::results *) const override |
| void | setupExpired () const override |
Additional Inherited Members | |
| Protected Member Functions inherited from Instrument | |
| void | calculate () const override |
| void | performCalculations () const override |
| Protected Attributes inherited from Instrument | |
| Real | NPV_ |
| Real | errorEstimate_ |
| Date | valuationDate_ |
| std::map< std::string, ext::any > | additionalResults_ |
| ext::shared_ptr< PricingEngine > | engine_ |
| bool | calculated_ = false |
| bool | frozen_ = false |
| bool | alwaysForward_ |
Credit default swap.
| CreditDefaultSwap | ( | Protection::Side | side, |
| Real | notional, | ||
| Rate | spread, | ||
| const Schedule & | schedule, | ||
| BusinessDayConvention | paymentConvention, | ||
| const DayCounter & | dayCounter, | ||
| bool | settlesAccrual = true, | ||
| bool | paysAtDefaultTime = true, | ||
| const Date & | protectionStart = Date(), | ||
| ext::shared_ptr< Claim > | = ext::shared_ptr< Claim >(), | ||
| const DayCounter & | lastPeriodDayCounter = DayCounter(), | ||
| bool | rebatesAccrual = true, | ||
| const Date & | tradeDate = Date(), | ||
| Natural | cashSettlementDays = 3 ) |
CDS quoted as running-spread only.
| side | Whether the protection is bought or sold. |
| notional | Notional value |
| spread | Running spread in fractional units. |
| schedule | Coupon schedule. |
| paymentConvention | Business-day convention for payment-date adjustment. |
| dayCounter | Day-count convention for accrual. |
| settlesAccrual | Whether or not the accrued coupon is due in the event of a default. |
| paysAtDefaultTime | If set to true, any payments triggered by a default event are due at default time. If set to false, they are due at the end of the accrual period. |
| protectionStart | The first date where a default event will trigger the contract. Before the CDS Big Bang 2009, this was typically trade date (T) + 1 calendar day. After the CDS Big Bang 2009, protection is typically effective immediately i.e. on trade date so this is what should be entered for protection start. Notice that there is no default lookback period and protection start here. In the way it determines the dirty amount it is more like the trade execution date. |
| lastPeriodDayCounter | Day-count convention for accrual in last period |
| rebatesAccrual | The protection seller pays the accrued scheduled current coupon at the start of the contract. The rebate date is not provided but computed to be two days after protection start. |
| tradeDate | The contract's trade date. It will be used with the cashSettlementDays to determine the date on which the cash settlement amount is paid. If not given, the trade date is guessed from the protection start date and schedule date generation rule. |
| cashSettlementDays | The number of business days from tradeDate to cash settlement date. |
| CreditDefaultSwap | ( | Protection::Side | side, |
| Real | notional, | ||
| Rate | upfront, | ||
| Rate | spread, | ||
| const Schedule & | schedule, | ||
| BusinessDayConvention | paymentConvention, | ||
| const DayCounter & | dayCounter, | ||
| bool | settlesAccrual = true, | ||
| bool | paysAtDefaultTime = true, | ||
| const Date & | protectionStart = Date(), | ||
| const Date & | upfrontDate = Date(), | ||
| ext::shared_ptr< Claim > | = ext::shared_ptr< Claim >(), | ||
| const DayCounter & | lastPeriodDayCounter = DayCounter(), | ||
| bool | rebatesAccrual = true, | ||
| const Date & | tradeDate = Date(), | ||
| Natural | cashSettlementDays = 3 ) |
CDS quoted as upfront and running spread.
| side | Whether the protection is bought or sold. |
| notional | Notional value |
| upfront | Upfront in fractional units. |
| spread | Running spread in fractional units. |
| schedule | Coupon schedule. |
| paymentConvention | Business-day convention for payment-date adjustment. |
| dayCounter | Day-count convention for accrual. |
| settlesAccrual | Whether or not the accrued coupon is due in the event of a default. |
| paysAtDefaultTime | If set to true, any payments triggered by a default event are due at default time. If set to false, they are due at the end of the accrual period. |
| protectionStart | The first date where a default event will trigger the contract. Before the CDS Big Bang 2009, this was typically trade date (T) + 1 calendar day. After the CDS Big Bang 2009, protection is typically effective immediately i.e. on trade date so this is what should be entered for protection start. Notice that there is no default lookback period and protection start here. In the way it determines the dirty amount it is more like the trade execution date. |
| upfrontDate | Settlement date for the upfront and accrual rebate (if any) payments. Typically T+3, this is also the default value. |
| lastPeriodDayCounter | Day-count convention for accrual in last period |
| rebatesAccrual | The protection seller pays the accrued scheduled current coupon at the start of the contract. The rebate date is not provided but computed to be two days after protection start. |
| tradeDate | The contract's trade date. It will be used with the cashSettlementDays to determine the date on which the cash settlement amount is paid if upfrontDate is empty. If not given, the trade date is guessed from the protection start date and schedule date generation rule. |
| cashSettlementDays | The number of business days from tradeDate to cash settlement date. |
|
overridevirtual |
returns whether the instrument might have value greater than zero.
Implements Instrument.
|
overridevirtual |
When a derived argument structure is defined for an instrument, this method should be overridden to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument.
|
overridevirtual |
When a derived result structure is defined for an instrument, this method should be overridden to read from it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument.
| Rate fairUpfront | ( | ) | const |
Returns the upfront spread that, given the running spread and the quoted recovery rate, will make the instrument have an NPV of 0.
| Rate fairSpread | ( | ) | const |
Returns the running spread that, given the quoted recovery rate, will make the running-only CDS have an NPV of 0.
| Real couponLegBPS | ( | ) | const |
Returns the variation of the fixed-leg value given a one-basis-point change in the running spread.
| Rate impliedHazardRate | ( | Real | targetNPV, |
| const Handle< YieldTermStructure > & | discountCurve, | ||
| const DayCounter & | dayCounter, | ||
| Real | recoveryRate = 0.4, | ||
| Real | accuracy = 1.0e-8, | ||
| PricingModel | model = Midpoint ) const |
Implied hazard rate calculation.
| Rate conventionalSpread | ( | Real | conventionalRecovery, |
| const Handle< YieldTermStructure > & | discountCurve, | ||
| const DayCounter & | dayCounter, | ||
| PricingModel | model = Midpoint ) const |
Conventional/standard upfront-to-spread conversion.
Under a standard ISDA model and a set of standardised instrument characteristics, it is the running only quoted spread that will make a CDS contract have an NPV of 0 when quoted for that running only spread. Refer to: "ISDA Standard CDS converter specification." May 2009.
The conventional recovery rate to apply in the calculation is as specified by ISDA, not necessarily equal to the market-quoted one. It is typically 0.4 for SeniorSec and 0.2 for subordinate.
|
overrideprotectedvirtual |
This method must leave the instrument in a consistent state when the expiration condition is met.
Reimplemented from Instrument.