QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
|
Risky pricing engine for bonds. More...
#include <riskybondengine.hpp>
Public Member Functions | |
RiskyBondEngine (Handle< DefaultProbabilityTermStructure > defaultTS, Real recoveryRate, Handle< YieldTermStructure > yieldTS) | |
void | calculate () const override |
Handle< DefaultProbabilityTermStructure > | defaultTS () const |
Real | recoveryRate () const |
Handle< YieldTermStructure > | yieldTS () const |
![]() | |
PricingEngine::arguments * | getArguments () const override |
const PricingEngine::results * | getResults () const override |
void | reset () override |
void | update () override |
![]() | |
~PricingEngine () override=default | |
virtual arguments * | getArguments () const =0 |
virtual const results * | getResults () const =0 |
virtual void | reset ()=0 |
virtual void | calculate () const =0 |
![]() | |
Observable ()=default | |
Observable (const Observable &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
![]() | |
Observer ()=default | |
Observer (const Observer &) | |
Observer & | operator= (const Observer &) |
virtual | ~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 | update ()=0 |
virtual void | deepUpdate () |
Private Attributes | |
Handle< DefaultProbabilityTermStructure > | defaultTS_ |
Real | recoveryRate_ |
Handle< YieldTermStructure > | yieldTS_ |
Additional Inherited Members | |
![]() | |
typedef set_type::iterator | iterator |
![]() | |
Bond::arguments | arguments_ |
Bond::results | results_ |
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.
RiskyBondEngine | ( | Handle< DefaultProbabilityTermStructure > | defaultTS, |
Real | recoveryRate, | ||
Handle< YieldTermStructure > | yieldTS | ||
) |
|
overridevirtual |
Implements PricingEngine.
Definition at line 39 of file riskybondengine.cpp.
Handle< DefaultProbabilityTermStructure > defaultTS | ( | ) | const |
Real recoveryRate | ( | ) | const |
Handle< YieldTermStructure > yieldTS | ( | ) | const |
|
private |
Definition at line 74 of file riskybondengine.hpp.
|
private |
Definition at line 75 of file riskybondengine.hpp.
|
private |
Definition at line 76 of file riskybondengine.hpp.