Table of Contents

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

swaption Swaption

The swaption.

context EvaluationContext

The evaluation context.

discountCurve YieldTermStructure

The discount curve, which the underlying swap is priced on.

vol SwaptionVolatilityStructure

The volatility structure, shifted lognormal.

model CashAnnuityModel

The 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

swaption Swaption

The swaption.

context EvaluationContext

The evaluation context.

discountCurve YieldTermStructure

The discount curve, which the underlying swap is priced on.

vol double

The shifted lognormal volatility.

dc DayCounter

The volatility's day counter; Actual365Fixed, QuantLib's default, when null.

displacement double

The volatility's shift.

model CashAnnuityModel

The 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.