Class HaganIrregularSwaptionEngine
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
The engine for European irregular swaptions by super-replication with a basket of vanilla swaptions: QuantLib's
HaganIrregularSwaptionEngine.
[Experimental("NQL0001")]
public static class HaganIrregularSwaptionEngine
- Inheritance
-
HaganIrregularSwaptionEngine
- Inherited Members
Remarks
References: P.S. Hagan, "Methodology for Callable Swaps and Bermudan 'Exercise into Swaptions'"; P.J. Hunt and J.E. Kennedy, "Implied interest rate pricing models", Finance Stochast. 2, 275-293 (1998).
A static class in the engines' form. The floating leg's spread moves to the fixed leg first, the fixed rates lowered by the rate whose fixed-leg value is the spread's; the swap then splits into vanilla swaps ending at each fixed payment date, whose weights solve a linear system (by SVD) and whose rates are shifted by a λ that Bisection finds in [−0.5, 0.5] to 1e-8 so that the basket's value matches the swap's; the price is the sum of the weighted vanilla swaptions, each by BachelierSwaptionEngine on a normal volatility. The basket is a working object per call. As QuantLib warns, a spread isn't handled exactly, and the swaptions assume that the exercise date is the swap's start. On a regular swap the replication is close to the Bachelier engine's price, not equal to it: within 5.1e-7 relative on a five-year swap a year forward at a flat normal 1%, QuantLib's values to 12 digits, and 7.5e-5 out of the money on a four-year swap at 0.8%.
QuantLib's engine takes the discount curve as an optional handle and dereferences it, so an empty one throws; here it is required.
Methods
Calculate(IrregularSwaption, EvaluationContext, SwaptionVolatilityStructure, YieldTermStructure)
Prices a European irregular swaption.
public static InstrumentResults Calculate(IrregularSwaption swaption, EvaluationContext context, SwaptionVolatilityStructure volatilityStructure, YieldTermStructure termStructure)
Parameters
swaptionIrregularSwaptionThe swaption.
contextEvaluationContextThe evaluation context.
volatilityStructureSwaptionVolatilityStructureThe swaption volatility, normal.
termStructureYieldTermStructureThe discount curve.
Returns
- InstrumentResults
The swaption's value: the expired results when the swaption has expired.
Exceptions
- ArgumentNullException
An argument is null.
- NanoQLException
A fixed cash flow isn't a fixed-rate coupon or a floating one an Ibor coupon, the swaption isn't European, the volatility isn't normal, λ can't be bracketed, or a leg can't be priced.