Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BlackCdsOptionEngine Class Reference

#include <qle/pricingengines/blackcdsoptionengine.hpp>

+ Inheritance diagram for BlackCdsOptionEngine:
+ Collaboration diagram for BlackCdsOptionEngine:

Public Member Functions

 BlackCdsOptionEngine (const QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > &probability, QuantLib::Real recovery, const QuantLib::Handle< QuantLib::YieldTermStructure > &discount, const QuantLib::Handle< QuantExt::CreditVolCurve > &volatility)
 
Inspectors
const QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > & probability () const
 
QuantLib::Real recovery () const
 
const QuantLib::Handle< QuantLib::YieldTermStructure > discount () const
 
const QuantLib::Handle< QuantExt::CreditVolCurvevolatility () const
 

Instrument interface

QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > probability_
 
QuantLib::Real recovery_
 
QuantLib::Handle< QuantLib::YieldTermStructure > discount_
 
QuantLib::Handle< QuantExt::CreditVolCurvevolatility_
 
void calculate () const override
 

Detailed Description

Black single name CDS option engine

Prices single name CDS option instruments quoted in terms of strike spread. It is assumed that the volatility structure's strike dimension, if there is one, is in terms of spread also. This is the standard situation for single name CDS options.

The valuation follows the approach outlined in Modeling Single-name and Multi-name Credit Derivatives, Dominic O'Kane, 2008, Section 9.3.7. This is also the approach in A CDS Option Miscellany, Richard J. Martin, 2019, Section 2.1 and 2.2. If we need the approach in Section 2.4 of that paper, we would need to make adjustments to the forward spread and RPV01 in our calculation which may in turn need access to the ISDA supplied interest rate curve. We leave that as a possible future enhancement.

Definition at line 45 of file blackcdsoptionengine.hpp.

Constructor & Destructor Documentation

◆ BlackCdsOptionEngine()

BlackCdsOptionEngine ( const QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > &  probability,
QuantLib::Real  recovery,
const QuantLib::Handle< QuantLib::YieldTermStructure > &  discount,
const QuantLib::Handle< QuantExt::CreditVolCurve > &  volatility 
)

Definition at line 29 of file blackcdsoptionengine.cpp.

33 registerWith(probability_);
34 registerWith(discount_);
35 registerWith(volatility_);
36}
const QuantLib::Handle< QuantLib::YieldTermStructure > discount() const
QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > probability_
const QuantLib::Handle< QuantExt::CreditVolCurve > volatility() const
QuantLib::Handle< QuantLib::YieldTermStructure > discount_
QuantLib::Handle< QuantExt::CreditVolCurve > volatility_
const QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > & probability() const

Member Function Documentation

◆ probability()

const Handle< DefaultProbabilityTermStructure > & probability ( ) const

Definition at line 38 of file blackcdsoptionengine.cpp.

38 {
39 return probability_;
40}

◆ recovery()

Real recovery ( ) const

Definition at line 42 of file blackcdsoptionengine.cpp.

42 {
43 return recovery_;
44}

◆ discount()

const Handle< YieldTermStructure > discount ( ) const

Definition at line 46 of file blackcdsoptionengine.cpp.

46 {
47 return discount_;
48}

◆ volatility()

const Handle< CreditVolCurve > volatility ( ) const

Definition at line 50 of file blackcdsoptionengine.cpp.

50 {
51 return volatility_;
52}

◆ calculate()

void calculate ( ) const
override

Definition at line 55 of file blackcdsoptionengine.cpp.

55 {
56
57 QL_REQUIRE(arguments_.strikeType == CdsOption::Spread, "BlackCdsOptionEngine does not support valuation" <<
58 " of single name options quoted in terms of strike price.");
59
60 // Reference to the underlying forward starting CDS, from expiry date $t_E$ to maturity $T$.
61 const auto& cds = *arguments_.swap;
62
63 // Get the additional results of the underlying CDS (need to call NPV first for calculation).
64 cds.NPV();
65 results_.additionalResults = cds.additionalResults();
66
67 // Add some entries to additional results.
68 Real forward = cds.fairSpreadClean();
69 results_.additionalResults["forwardSpread"] = forward;
70 const Real& strike = arguments_.strike;
71 results_.additionalResults["strikeSpread"] = strike;
72
73 // Calculate risky PV01, as of the valuation date i.e. time 0, for the period from $t_E$ to underlying
74 // CDS maturity $T$. This risky PV01 does not include the non-risky accrual from the CDS premium leg coupon date
75 // immediately preceding the expiry date up to the expiry date.
76 Real rpv01 = std::abs(cds.couponLegNPV() + cds.accrualRebateNPV()) / (cds.notional() * cds.runningSpread());
77 results_.additionalResults["riskyAnnuity"] = rpv01;
78
79 // Read the volatility from the volatility surface, assumed to have strike dimension in terms of spread.
80 const Date& exerciseDate = arguments_.exercise->dates().front();
81 Real underlyingLength = volatility_->dayCounter().yearFraction(exerciseDate, cds.maturity());
82 Real vol = volatility_->volatility(exerciseDate, underlyingLength, strike, CreditVolCurve::Type::Spread);
83 Real stdDev = vol * std::sqrt(volatility_->timeFromReference(exerciseDate));
84 results_.additionalResults["volatility"] = vol;
85 results_.additionalResults["standardDeviation"] = stdDev;
86
87 // Option type
88 Option::Type callPut = cds.side() == Protection::Buyer ? Option::Call : Option::Put;
89 results_.additionalResults["callPut"] = callPut == Option::Call ? string("Call") : string("Put");
90
91 // NPV, Section 9.3.7 O'Kane 2008.
92 results_.value = rpv01 * cds.notional() * blackFormula(callPut, strike, forward, stdDev, 1.0);
93
94 // If it is non-knockout and a payer, add the value of the default payout.
95 // Section 2.2 of Richard J.Martin, 2019 or Section 9.3.7 O'Kane 2008.
96 if (!arguments_.knocksOut && cds.side() == Protection::Buyer) {
97
98 DiscountFactor disc = discount_->discount(exerciseDate);
99 results_.additionalResults["discountToExercise"] = disc;
100
101 Probability sp = probability_->survivalProbability(exerciseDate);
102 results_.additionalResults["survivalProbabilityToExercise"] = sp;
103
104 Real nonKoPv = disc * sp * (1 - recovery_);
105 results_.additionalResults["nonKnockoutPv"] = nonKoPv;
106
107 results_.value += nonKoPv;
108 }
109}
const Instrument::results * results_
Definition: cdsoption.cpp:81
Swap::arguments * arguments_

Member Data Documentation

◆ probability_

QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure> probability_
private

Definition at line 66 of file blackcdsoptionengine.hpp.

◆ recovery_

QuantLib::Real recovery_
private

Definition at line 67 of file blackcdsoptionengine.hpp.

◆ discount_

QuantLib::Handle<QuantLib::YieldTermStructure> discount_
private

Definition at line 68 of file blackcdsoptionengine.hpp.

◆ volatility_

QuantLib::Handle<QuantExt::CreditVolCurve> volatility_
private

Definition at line 69 of file blackcdsoptionengine.hpp.