Class BlackSwaptionEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The shifted lognormal Black-formula swaption engine.
public static class BlackSwaptionEngine
- Inheritance
-
BlackSwaptionEngine
- Inherited Members
Remarks
A static class: Calculate runs QuantLib's four steps (playbook §2.1) and returns the swaption's results, with
QuantLib's eleven additional results, read by Result<T>(string). The engine assumes that
the exercise date lies before the start date of the passed swap, and fully supports an overnight-indexed
underlying.
QuantLib's constructors on a volatility value and on a quote coincide once a quote is a double: the overload on a double builds, at each call, the constant volatility QuantLib's builds, on no calendar and with its reference date the context's evaluation date. Its day counter defaults to QuantLib's, Actual365Fixed, for null; QuantLib's empty day counter, which fails at the volatility's first conversion of a date to a time, has no spelling.
Methods
Calculate(Swaption, EvaluationContext, YieldTermStructure, SwaptionVolatilityStructure, CashAnnuityModel)
Prices a swaption on a volatility structure.
public static InstrumentResults Calculate(Swaption swaption, EvaluationContext context, YieldTermStructure discountCurve, SwaptionVolatilityStructure vol, CashAnnuityModel model = CashAnnuityModel.DiscountCurve)
Parameters
swaptionSwaptionThe swaption.
contextEvaluationContextThe evaluation context.
discountCurveYieldTermStructureThe discount curve, which the underlying swap is priced on.
volSwaptionVolatilityStructureThe volatility structure, shifted lognormal.
modelCashAnnuityModelThe cash annuity model of a cash swaption settled at the par yield curve.
Returns
- InstrumentResults
The swaption's results: the expired results when the swaption has expired.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
The structure's volatilities aren't shifted lognormal.
- NanoQLException
The swaption's terms are inconsistent, it isn't European, its swap starts before its exercise date, or the swap, the volatility or the formula can't be priced.
Calculate(Swaption, EvaluationContext, YieldTermStructure, double, DayCounter?, double, CashAnnuityModel)
Prices a swaption on a constant volatility.
public static InstrumentResults Calculate(Swaption swaption, EvaluationContext context, YieldTermStructure discountCurve, double vol, DayCounter? dc = null, double displacement = 0, CashAnnuityModel model = CashAnnuityModel.DiscountCurve)
Parameters
swaptionSwaptionThe swaption.
contextEvaluationContextThe evaluation context.
discountCurveYieldTermStructureThe discount curve, which the underlying swap is priced on.
voldoubleThe shifted lognormal volatility.
dcDayCounterThe volatility's day counter; Actual365Fixed, QuantLib's default, when null.
displacementdoubleThe volatility's shift.
modelCashAnnuityModelThe cash annuity model of a cash swaption settled at the par yield curve.
Returns
- InstrumentResults
The swaption's results: the expired results when the swaption has expired.
Exceptions
- ArgumentNullException
The swaption, the context or the discount curve is null.
- NanoQLException
The swaption's terms are inconsistent, it isn't European, its swap starts before its exercise date, or the swap or the formula can't be priced.