QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
RiskyBondEngine Class Reference

Risky pricing engine for bonds. More...

#include <ql/pricingengines/bond/riskybondengine.hpp>

+ Inheritance diagram for RiskyBondEngine:
+ Collaboration diagram for RiskyBondEngine:

Public Member Functions

 RiskyBondEngine (Handle< DefaultProbabilityTermStructure > defaultTS, Real recoveryRate, Handle< YieldTermStructure > yieldTS)
 
void calculate () const override
 
Handle< DefaultProbabilityTermStructuredefaultTS () const
 
Real recoveryRate () const
 
Handle< YieldTermStructureyieldTS () const
 
- Public Member Functions inherited from GenericEngine< Bond::arguments, Bond::results >
PricingEngine::argumentsgetArguments () const override
 
const PricingEngine::resultsgetResults () const override
 
void reset () override
 
void update () override
 
- Public Member Functions inherited from PricingEngine
 ~PricingEngine () override=default
 
virtual argumentsgetArguments () const =0
 
virtual const resultsgetResults () const =0
 
virtual void reset ()=0
 
virtual void calculate () const =0
 
- 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 Attributes

Handle< DefaultProbabilityTermStructuredefaultTS_
 
Real recoveryRate_
 
Handle< YieldTermStructureyieldTS_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Attributes inherited from GenericEngine< Bond::arguments, Bond::results >
Bond::arguments arguments_
 
Bond::results results_
 

Detailed Description

Risky pricing engine for bonds.

The value of each cashflow is contingent to survival, i.e., the knockout probability is considered.

In each of the \(n\) coupon periods, we can calculate the value in the case of survival and default, assuming that the issuer can only default in the middle of a coupon period. We denote this time \(T_{i}^{mid}=\frac{T_{i-1}+T_{i}}{2}\).

Given survival we receive the full cash flow (both coupons and notional). The time \(t\) value of these payments are given by

\[ \sum_{i=1}^{n}CF_{i}P(t,T_{i})Q(T_{i}<\tau) \]

where \(P(t,T)\) is the time \(T\) discount bond and \(Q(T<\tau)\) is the time \(T\) survival probability. \(n\) is the number of coupon periods. This takes care of the payments in the case of survival.

Given default we receive only a fraction of the notional at default.

\[ \sum_{i=1}^{n}Rec N(T_{i}^{mid}) P(t,T_{i}^{mid})Q(T_{i-1}<\tau\leq T_{i}) \]

where \(Rec\) is the recovery rate and \(N(T)\) is the time T notional. The default probability can be rewritten as

\[ Q(T_{i-1}<\tau\leq T_{i})=Q(T_{i}<\tau)-Q(T_{i-1}<\tau)=(1-Q(T_{i}\geq\tau))-(1-Q(T_{i-1}\geq\tau))=Q(T_{i-1}\geq\tau)-Q(T_{i}\geq\tau) \]

Definition at line 64 of file riskybondengine.hpp.

Constructor & Destructor Documentation

◆ RiskyBondEngine()

RiskyBondEngine ( Handle< DefaultProbabilityTermStructure defaultTS,
Real  recoveryRate,
Handle< YieldTermStructure yieldTS 
)

Definition at line 29 of file riskybondengine.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ calculate()

void calculate ( ) const
overridevirtual

Implements PricingEngine.

Definition at line 39 of file riskybondengine.cpp.

+ Here is the call graph for this function:

◆ defaultTS()

Handle< DefaultProbabilityTermStructure > defaultTS ( ) const

Definition at line 80 of file riskybondengine.hpp.

+ Here is the caller graph for this function:

◆ recoveryRate()

Real recoveryRate ( ) const

Definition at line 84 of file riskybondengine.hpp.

+ Here is the caller graph for this function:

◆ yieldTS()

Handle< YieldTermStructure > yieldTS ( ) const

Definition at line 86 of file riskybondengine.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ defaultTS_

Definition at line 74 of file riskybondengine.hpp.

◆ recoveryRate_

Real recoveryRate_
private

Definition at line 75 of file riskybondengine.hpp.

◆ yieldTS_

Handle<YieldTermStructure> yieldTS_
private

Definition at line 76 of file riskybondengine.hpp.