Table of Contents

Class FdHestonDoubleBarrierEngine

Namespace
NanoQL.PricingEngines
Assembly
NanoQL.dll

The finite-difference Heston pricing engine for double barrier options: FdmHestonSolver on a log-spot grid bounded at both barriers, the rebate their Dirichlet value, paid at the first touch.

public static class FdHestonDoubleBarrierEngine
Inheritance
FdHestonDoubleBarrierEngine
Inherited Members

Remarks

European exercise only, as QuantLib's. The engine reports the value, delta, gamma and theta, on FdHestonBarrierEngine's grids and Clock(HestonProcess, FdmQuantoHelper?, LocalVolTermStructure?)'s times.

Documented divergences. A knock-in, which QuantLib refuses, is priced by in-out parity, the method QuantLib's single-barrier engine applies: the vanilla less the knock-out, both legs with the knock-out's leverage function and mixing factor, and a knock-in's rebate, paid at expiry where neither barrier is touched, as the rebate times the knock-out of a unit cash-or-nothing at strike 0 (the analytic engines' rebate convention; Divergences/FdHestonDoubleKnockInTests.cs). KIKO and KOKI options stay refused. And a spot on or beyond a barrier is refused before the solve ("barrier(s) already touched"), as the analytic engine refuses it, where QuantLib's grid interpolation fails outside its range.

Methods

Calculate(DoubleBarrierOption, EvaluationContext, HestonModel, int, int, int, int, FdmSchemeDesc?, LocalVolTermStructure?, double)

Prices a double barrier option.

public static OneAssetOptionResults Calculate(DoubleBarrierOption option, EvaluationContext context, HestonModel model, int tGrid = 100, int xGrid = 100, int vGrid = 50, int dampingSteps = 0, FdmSchemeDesc? schemeDesc = null, LocalVolTermStructure? leverageFct = null, double mixingFactor = 1)

Parameters

option DoubleBarrierOption

The option.

context EvaluationContext

The evaluation context.

model HestonModel

The Heston model.

tGrid int

The number of time steps.

xGrid int

The number of the log spot's points.

vGrid int

The number of the variance's points.

dampingSteps int

The number of implicit damping steps.

schemeDesc FdmSchemeDesc?

The scheme; null for Hundsdorfer's, QuantLib's default.

leverageFct LocalVolTermStructure

The leverage function, or null for none.

mixingFactor double

The factor scaling the variance's volatility σ.

Returns

OneAssetOptionResults

The option's results; the expired results when it has expired.

Exceptions

ArgumentNullException

The option, the context or the model is null.

ArgumentOutOfRangeException

A grid size or the damping steps is negative.

ArgumentException

A grid is too small, or the rollback's arguments are refused.

NanoQLException

The type is KIKO or KOKI, the payoff isn't striked, the exercise isn't European, the spot lies on or beyond a barrier ("barrier(s) already touched"), or a step or the spline fails.