Class FdG2SwaptionEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The finite-difference G2 swaption engine: the swaption rolled back on a two-dimensional mesh of the model's factors, its exercise value the swap's inner value on the model's curves (FdmAffineModelSwapInnerValue<TModel>).
public static class FdG2SwaptionEngine
- Inheritance
-
FdG2SwaptionEngine
- Inherited Members
Remarks
A static class: Calculate runs QuantLib's four steps (playbook §2.1) on the model, an argument where QuantLib's
engine holds it. The mesher is each factor's Ornstein-Uhlenbeck quantiles up to the last exercise; the swap's
coupons forecast on a G2 with the model's parameters on the index's curve, which must share the discount curve's
day counter and reference date, as QuantLib refuses otherwise; the value is read at the factors' origin.
An American exercise reaches the inner value at times off its exercise dates, which it refuses.
Methods
Calculate(Swaption, EvaluationContext, G2, int, int, int, int, double, FdmSchemeDesc?)
Prices a swaption on a G2 model by finite differences.
public static InstrumentResults Calculate(Swaption swaption, EvaluationContext context, G2 model, int tGrid = 100, int xGrid = 50, int yGrid = 50, int dampingSteps = 0, double invEps = 1E-05, FdmSchemeDesc? schemeDesc = null)
Parameters
swaptionSwaptionThe swaption.
contextEvaluationContextThe evaluation context.
modelG2The G2 model.
tGridintThe number of time steps.
xGridintThe number of points of the first factor's mesher.
yGridintThe number of points of the second factor's mesher.
dampingStepsintThe number of damping steps.
invEpsdoubleThe probability of the meshers' ends' quantiles.
schemeDescFdmSchemeDesc?The scheme; null for QuantLib's default, Hundsdorfer().
Returns
- InstrumentResults
The swaption's results, the NPV alone: the expired results when it has expired.
Exceptions
- ArgumentNullException
The swaption, the context or the model is null.
- ArgumentOutOfRangeException
A grid size or the number of damping steps is negative.
- ArgumentException
A mesher has no point.
- NanoQLException
The swaption's terms are inconsistent, an exercise date is past, the index has no curve or one on another day counter or reference date, the exercise is American, or a step fails.