Class QdPlusAmericanEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The American engine based on the QD+ approximation to the exercise boundary (M. Li, "Analytical Approximations for the Critical Stock Prices of American Options: A Performance Comparison", 2009): the boundary at Chebyshev nodes in √τ, the early-exercise premium integrated over it by tanh-sinh quadrature.
public class QdPlusAmericanEngine : QdPutCallParityEngine
- Inheritance
-
QdPlusAmericanEngine
- Inherited Members
Remarks
Its main purpose is to provide a good initial guess to the exercise boundary for the superior fixed-point engine, QdFpAmericanEngine. The engine reports the value.
Immutable: each τ's boundary is solved by a working evaluator built for that solve, and each price builds its own
boundary, as QuantLib's does. The static Calculate builds an engine with the given settings and prices
through it. An extension point, as in QuantLib.
Constructors
QdPlusAmericanEngine(GeneralizedBlackScholesProcess, int, QdPlusAmericanEngineSolverType, double, int?)
Initializes a new instance of the QdPlusAmericanEngine class.
public QdPlusAmericanEngine(GeneralizedBlackScholesProcess process, int interpolationPoints = 8, QdPlusAmericanEngineSolverType solverType = QdPlusAmericanEngineSolverType.Halley, double eps = 1E-06, int? maxIter = null)
Parameters
processGeneralizedBlackScholesProcessThe Black-Scholes process.
interpolationPointsintThe number of Chebyshev nodes of the boundary.
solverTypeQdPlusAmericanEngineSolverTypeThe boundary's root finder.
epsdoubleThe boundary's and the premium's accuracy.
maxIterint?The most evaluations of a boundary solve, or null for QuantLib's default: 100 for Brent's, Newton's and Ridder's methods, 10 for the Halley iterations.
Exceptions
- ArgumentNullException
processis null.- ArgumentOutOfRangeException
interpolationPointsormaxIteris negative, or the solver type isn't a member of its type.
Methods
Calculate(VanillaOption, EvaluationContext, GeneralizedBlackScholesProcess, int, QdPlusAmericanEngineSolverType, double, int?)
Prices an American vanilla option by the QD+ approximation.
public static OneAssetOptionResults Calculate(VanillaOption option, EvaluationContext context, GeneralizedBlackScholesProcess process, int interpolationPoints = 8, QdPlusAmericanEngineSolverType solverType = QdPlusAmericanEngineSolverType.Halley, double eps = 1E-06, int? maxIter = null)
Parameters
optionVanillaOptionThe option.
contextEvaluationContextThe evaluation context.
processGeneralizedBlackScholesProcessThe Black-Scholes process.
interpolationPointsintThe number of Chebyshev nodes of the boundary.
solverTypeQdPlusAmericanEngineSolverTypeThe boundary's root finder.
epsdoubleThe boundary's and the premium's accuracy.
maxIterint?The most evaluations of a boundary solve, or null for QuantLib's default.
Returns
- OneAssetOptionResults
The option's results: the value.
Exceptions
- ArgumentNullException
An argument is null.
- NanoQLException
The engine refuses the option.
CalculatePut(double, double, double, double, double, double)
The value of an American put.
protected override double CalculatePut(double s, double k, double r, double q, double vol, double t)
Parameters
sdoubleThe spot.
kdoubleThe strike.
rdoubleThe risk-free rate.
qdoubleThe dividend yield.
voldoubleThe volatility.
tdoubleThe time to expiry.
Returns
- double
The value.
GetPutExerciseBoundary(double, double, double, double, double, double)
The put's exercise boundary as a Chebyshev interpolation, on the second kind's nodes in z = 2√(τ/T) − 1, of ln(b(τ)/x_max)²: each node's boundary solved by PutExerciseBoundaryAtTau(double, double, double, double, double, double, double).
public ChebyshevInterpolation GetPutExerciseBoundary(double s, double k, double r, double q, double vol, double t)
Parameters
sdoubleThe spot.
kdoubleThe strike.
rdoubleThe risk-free rate.
qdoubleThe dividend yield.
voldoubleThe volatility.
tdoubleThe time to expiry.
Returns
- ChebyshevInterpolation
The interpolation.
Exceptions
- NanoQLException
A node's solve refuses.
PutExerciseBoundaryAtTau(double, double, double, double, double, double, double)
The put's exercise boundary at a time to expiry, and the number of evaluations its solve took.
public (int Evaluations, double Boundary) PutExerciseBoundaryAtTau(double s, double k, double r, double q, double vol, double t, double tau)
Parameters
sdoubleThe spot.
kdoubleThe strike.
rdoubleThe risk-free rate.
qdoubleThe dividend yield.
voldoubleThe volatility.
tdoubleThe option's time to expiry.
taudoubleThe time to expiry the boundary is at.
Returns
- (int Evaluations, double Boundary)
The number of evaluations and the boundary; 0 and XMax(double, double, double) below a τ of ε.
Exceptions
- NanoQLException
The solver refuses.
XMax(double, double, double)
The exercise boundary's limit at expiry: Table 2 of L. Andersen and M. Lake (2021), "Fast American Option Pricing: The Double-Boundary Case".
public static double XMax(double k, double r, double q)
Parameters
Returns
- double
The limit; 0 in the European cases.
Exceptions
- NanoQLException
A rate is NaN ("internal error").