Class MidPointCdsEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The mid-point engine for credit default swaps: each coupon period's default falls at its middle, from the later of its start and the evaluation date.
public static class MidPointCdsEngine
- Inheritance
-
MidPointCdsEngine
- Inherited Members
Remarks
A static class: Calculate(CreditDefaultSwap, EvaluationContext, DefaultProbabilityTermStructure?, double, YieldTermStructure?, bool?) takes the engine's inputs and returns the results, in place of QuantLib's engine object. An expired swap's results are SetupExpired()'s, as QuantLib's instrument gives them before it calls the engine; otherwise the swap is validated and priced.
A curve accrues nothing before its reference date: the discount at a default date before the discount curve's
reference date is 1, and the survival at a payment date before the probability curve's reference date is 1, its
default probability over a period ending before it 0, where QuantLib's reads refuse them ("negative time"): on a
curve that settles after the evaluation date, and on curves dated the evaluation date for a live coupon whose period
ended before it (one paid after the weekend that ended it). No default before the reference date is QuantLib's own
premise for its two-date default probability, which excuses the period's start and not its end
(defaulttermstructure.cpp:112-120). A documented divergence; wherever QuantLib's reads succeed, its values,
bit for bit.
Methods
Calculate(CreditDefaultSwap, EvaluationContext, DefaultProbabilityTermStructure?, double, YieldTermStructure?, bool?)
Prices a credit default swap.
public static CreditDefaultSwapResults Calculate(CreditDefaultSwap cds, EvaluationContext context, DefaultProbabilityTermStructure? probability, double recoveryRate, YieldTermStructure? discountCurve, bool? includeSettlementDateFlows = null)
Parameters
cdsCreditDefaultSwapThe swap.
contextEvaluationContextThe evaluation context.
probabilityDefaultProbabilityTermStructureThe default-probability curve, or null, QuantLib's empty handle.
recoveryRatedoubleThe recovery rate.
discountCurveYieldTermStructureThe discount curve, or null, QuantLib's empty handle.
includeSettlementDateFlowsbool?Whether flows on the discount curve's reference date count; the context's IncludeReferenceDateEvents when null.
Returns
- CreditDefaultSwapResults
The swap's results.
Exceptions
- ArgumentNullException
cdsorcontextis null.- NanoQLException
A curve is missing ("no discount term structure set", "no probability term structure set"); the swap fails its validation; or a curve refuses a date.