Class FdCEVVanillaEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The finite-difference pricing engine for vanilla options, European, American or Bermudan, on the constant elasticity of variance (CEV) process df = α·f^β·dW, absorbed at f = 0: on FdmCEV1dMesher's grid, concentrating at the strike, with the analytic CEV value at the upper end and, where the process can reach zero (δ < 2), the payoff at the lower end discounted from maturity.
public static class FdCEVVanillaEngine
- Inheritance
-
FdCEVVanillaEngine
- Inherited Members
Remarks
The engine reports the value, delta, gamma and theta; the theta is null when the problem's first stopping time is time 0, as QuantLib's is. Its finite-difference working types are built inside each calculation and dropped after it. Its times are the discount curve's, from its reference date in its day counter, as QuantLib's; an exercise on or before that date leaves the engine no time to roll back over, and it is refused, as QuantLib's engine throws there (Boost's refusal of an infinite non-centrality, or a negative time in the incomplete gamma function), and as nanoql's other finite-difference engines refuse an exercise their clocks have no time for.
Near β = 1 the mesher's bounds and the upper end's value are the lognormal limit's and Black's formula at Hagan's equivalent volatility (FdmCEV1dMesher, CEVCalculator), where QuantLib's engine throws.
Methods
Calculate(VanillaOption, EvaluationContext, double, double, double, YieldTermStructure, int, int, int, double, double, FdmSchemeDesc?)
Prices a vanilla option.
public static OneAssetOptionResults Calculate(VanillaOption option, EvaluationContext context, double f0, double alpha, double beta, YieldTermStructure discountCurve, int tGrid = 50, int xGrid = 400, int dampingSteps = 0, double scalingFactor = 1, double eps = 0.0001, FdmSchemeDesc? schemeDesc = null)
Parameters
optionVanillaOptionThe option.
contextEvaluationContextThe evaluation context.
f0doubleThe forward's value today.
alphadoubleThe volatility parameter α.
betadoubleThe elasticity β.
discountCurveYieldTermStructureThe discount curve.
tGridintThe number of time steps.
xGridintThe number of the forward's points.
dampingStepsintThe number of implicit damping steps.
scalingFactordoubleThe factor the mesher's ends are widened by.
epsdoubleThe probability outside each end of the mesher.
schemeDescFdmSchemeDesc?The scheme; null for Douglas, QuantLib's default.
Returns
- OneAssetOptionResults
The option's results; the expired results when it has expired.
Exceptions
- ArgumentNullException
The option, the context or the curve is null.
- ArgumentOutOfRangeException
A grid size or the damping steps is negative.
- ArgumentException
The exercise is on or before the curve's reference date, or the grid is too small.
- NanoQLException
The payoff isn't striked, or the density, the analytic value or the solver refuses its arguments.