Table of Contents

Class AnalyticDoubleBarrierEngine

Namespace
NanoQL.PricingEngines
Assembly
NanoQL.dll

The analytic engine for European double barrier options: Ikeda and Kunitomo's image series ("Pricing Options with Curved Boundaries", Mathematical Finance 2/1992) as Haug gives it ("The complete guide to option pricing formulas", 2nd ed., p. 156 and following), for flat barriers.

public static class AnalyticDoubleBarrierEngine
Inheritance
AnalyticDoubleBarrierEngine
Inherited Members

Remarks

The value alone, as QuantLib's. Strikes outside the corridor integrate only over terminal spots inside it, upstream's fix after v1.44 (#2881; Divergences/BarrierUpstreamFixesTests.cs).

Documented divergences. Each rate is read on the volatility's clock and each time is the volatility's, as AnalyticBarrierEngine reads them, where QuantLib reads every structure at the risk-free curve's times. The series runs from −series to series, QuantLib's terms, and on while the next pair of terms exceeds machine epsilon of the sum, where QuantLib stops, unconverged on narrow corridors and long terms (Divergences/DoubleBarrierSeriesTests.cs). Where a term's power overflows, as at low volatility, it is taken in logs with its normal difference, QuantLib's own technique in the binary barrier engine, where QuantLib's product is NaN and its max(0, ·) prices 0; each difference of two normal probabilities whose arguments share a sign is taken from the small tail, ½erfc, where the plain difference cancels (Divergences/DoubleBarrierLowVolatilityTests.cs). QuantLib's value and bits stand wherever its five terms agree with this converged series within 1e-12 on the value's scale, max(|value|, 1), which QuantLib's own rounding of the plain sum's cancelling terms stays inside, QuantLib's cases among them. Below machine-epsilon variance the underlying follows its forward, a knock-out paying its payoff where the forward stays inside the corridor. And the rebate is priced, QuantLib's single-barrier convention, where QuantLib's engine reads none: a knock-out's paid at the first touch of either barrier, through the double-barrier binary engine's KIKO and KOKI at unit cash; a knock-in's paid at expiry where neither is touched, through its knock-out at unit cash (Divergences/DoubleBarrierRebateTests.cs).

The formula is a first-passage closed form in equivalent-constant rates and a volatility, the variance and discounts to expiry: no exact closed form exists for a first passage under general deterministic term structures, and on shaped markets an independent Monte Carlo finds a knock-out within two of its standard errors, +0.04%; the term-structure-exact route is a Monte Carlo on the process.

Methods

Calculate(DoubleBarrierOption, EvaluationContext, GeneralizedBlackScholesProcess, int)

Prices a double barrier option.

public static OneAssetOptionResults Calculate(DoubleBarrierOption option, EvaluationContext context, GeneralizedBlackScholesProcess process, int series = 5)

Parameters

option DoubleBarrierOption

The option.

context EvaluationContext

The evaluation context.

process GeneralizedBlackScholesProcess

The Black-Scholes process.

series int

The number of terms either side of 0 the series takes at least; QuantLib's default 5.

Returns

OneAssetOptionResults

The option's results: the value; the expired results when the option has expired.

Exceptions

ArgumentNullException

An argument is null.

ArgumentOutOfRangeException

series is negative.

NanoQLException

The exercise isn't European, the payoff isn't plain vanilla or its strike isn't positive, the spot isn't positive or lies on or beyond a barrier ("barrier(s) already touched"), or the type is KIKO or KOKI.