Class RiskyBondEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The risky engine for bonds: each future cash flow is weighted by its survival probability, and each coupon period adds the recovery on its nominal, paid at the period's midpoint, weighted by its default probability.
public static class RiskyBondEngine
- Inheritance
-
RiskyBondEngine
- Inherited Members
Remarks
The engine prices a bond on a default-probability curve and a recovery rate: each cash flow's amount is weighted by the probability of survival to its date and discounted; in each coupon period, from the later of the curve's reference date and the leg's start, the coupon's nominal times the recovery rate is weighted by the probability of default in the period and discounted from its midpoint. The settlement value counts the cash flows after the settlement date, discounted to it.
A static class: Calculate(Bond, EvaluationContext, DefaultProbabilityTermStructure, double, YieldTermStructure) takes the engine's inputs and returns the results, in place of QuantLib's engine object, as DiscountingBondEngine does. An expired bond's results are SetupExpired()'s.
Methods
Calculate(Bond, EvaluationContext, DefaultProbabilityTermStructure, double, YieldTermStructure)
Prices a bond.
public static BondResults Calculate(Bond bond, EvaluationContext context, DefaultProbabilityTermStructure defaultTS, double recoveryRate, YieldTermStructure yieldTS)
Parameters
bondBondThe bond.
contextEvaluationContextThe evaluation context, which gives the bond's settlement date.
defaultTSDefaultProbabilityTermStructureThe default-probability curve.
recoveryRatedoubleThe recovery rate.
yieldTSYieldTermStructureThe discount curve.
Returns
- BondResults
The bond's results: the NPV at the discount curve's reference date, its valuation date, and the settlement value; no error estimate. The expired results when the bond has expired.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
The bond has no cash flows, or a curve refuses a date.
- NanoQLException
The bond takes other engines' arguments, or its settlement date can't be computed on QuantLib's empty calendar.