Logo
Reference manual - version qle_version
DiscountingRiskyBondEngine Class Reference

Discounting Risky Bond Engine. More...

#include <qle/pricingengines/discountingriskybondengine.hpp>

Inheritance diagram for DiscountingRiskyBondEngine:

Classes

struct  BondNPVCalculationResults
struct  RecoveryContribution

Public Member Functions

 DiscountingRiskyBondEngine (const Handle< YieldTermStructure > &discountCurve, const Handle< DefaultProbabilityTermStructure > &defaultCurve, const Handle< Quote > &recoveryRate, const Handle< Quote > &securitySpread, Period timestepPeriod, QuantLib::ext::optional< bool > includeSettlementDateFlows=QuantLib::ext::nullopt, const bool includePastCashflows=false, const Handle< YieldTermStructure > &incomeCurve={}, const bool conditionalOnSurvival=true, const bool spreadOnIncome=true, const bool treatSecuritySpreadAsCreditSpread=false)
 DiscountingRiskyBondEngine (const Handle< YieldTermStructure > &discountCurve, const Handle< Quote > &securitySpread, Period timestepPeriod, QuantLib::ext::optional< bool > includeSettlementDateFlows=QuantLib::ext::nullopt, const Handle< YieldTermStructure > &incomeCurve={}, const bool conditionalOnSurvival=true, const bool spreadOnIncome=true, const bool treatSecuritySpreadAsCreditSpread=false)
 alternative constructor (does not require default curve or recovery rate)
void calculate () const override
std::pair< Real, Real > forwardPrice (const QuantLib::Date &forwardNpvDate, const QuantLib::Date &settlementDate, const bool conditionalOnSurvival=true, std::vector< CashFlowResults > *const cfResults=nullptr, QuantLib::Leg *const expectedCashflows=nullptr) const override
 ForwardEnabledBondEngine interface.
Handle< YieldTermStructure > discountCurve () const
Handle< DefaultProbabilityTermStructure > defaultCurve () const
Handle< QuoterecoveryRate () const
Handle< QuotesecuritySpread () const

Protected Member Functions

BondNPVCalculationResults calculateNpv (const Date &npvDate, const Date &settlementDate, QuantLib::ext::optional< bool > includeSettlementDateFlows, const bool conditionalOnSurvival, const bool additionalResults) const
DiscountingRiskyBondEngine::RecoveryContribution recoveryContribution (const Real dfNpv, const Real spNpv, const Real effRecovery, const QuantLib::ext::shared_ptr< DefaultProbabilityTermStructure > &effCreditCurve, const bool additionalResults, const Real nominal, const QuantLib::Date &startDate, const QuantLib::Date &endDate) const

Protected Attributes

Handle< YieldTermStructure > discountCurve_
Handle< DefaultProbabilityTermStructure > defaultCurve_
Handle< QuoterecoveryRate_
Handle< QuotesecuritySpread_
Period timestepPeriod_
QuantLib::ext::optional< boolincludeSettlementDateFlows_
bool includePastCashflows_
Handle< YieldTermStructure > incomeCurve_
bool conditionalOnSurvival_
bool spreadOnIncome_
bool treatSecuritySpreadAsCreditSpread_

Detailed Description

Discounting Risky Bond Engine.

WARNING: Only covers Vanilla coupon bonds (floating and fixed rate), and Zero Bonds (one cashflow, a redemption at maturity).

This class implements pricing of Risky Bonds by discounting the future nominal cash flows using the respective yield curves, and probability of survival. The nominal recovered in case of default is calculated as recovery rate times the integral of probability of default until maturity date. For coupon bonds the coupon periods are taken as the time step for integration, for a zero bond the time step period provided is used.

Member Function Documentation

◆ forwardPrice()

std::pair< Real, Real > forwardPrice ( const QuantLib::Date & forwardNpvDate,
const QuantLib::Date & settlementDate,
const bool conditionalOnSurvival = true,
std::vector< CashFlowResults > *const cfResults = nullptr,
QuantLib::Leg *const expectedCashflows = nullptr ) const
overridevirtual

◆ calculateNpv()

BondNPVCalculationResults calculateNpv ( const Date & npvDate,
const Date & settlementDate,
QuantLib::ext::optional< bool > includeSettlementDateFlows,
const bool conditionalOnSurvival,
const bool additionalResults ) const
protected

Calculate the npv, compoundFactorSettlement, cashflowsBeforeSettlementValue and the additional CashflowResults as of the npvDate including cashflows eligible w.r.t. the given settlement date

  • If conditionalOnSurvival is set to true, the npv is computed conditional on the survival until the npvDate, otherwise the npv is including the default probability between today and the npvDate
  • If an incomeCurve is given, this is used to compound the npv from today to the npvDate, otherwise the curve built in the engine as discount curve + security Spread is used.