Table of Contents

Class AnalyticPartialTimeBarrierOptionEngine

Namespace
NanoQL.PricingEngines
Assembly
NanoQL.dll

The analytic engine for partial-time barrier options: Haug's formulas ("Option Pricing Formulas"), a put priced by the put-call symmetry from the call.

public static class AnalyticPartialTimeBarrierOptionEngine
Inheritance
AnalyticPartialTimeBarrierOptionEngine
Inherited Members

Remarks

The value alone, as QuantLib's. The bivariate normal is QuantLib's default, BivariateCumulativeNormalDistributionWe04DP, where QuantLib's engine reads Drezner's 1978 algorithm, to six decimal places; on QuantLib's 40 cases the values move by at most 3.3e-5, within QuantLib's tolerance. The put's symmetric call runs on a process whose curves QuantLib's constructor call binds in each other's places, the standard put-call symmetry P(S, K, r, q) = (K/S)·C(S, S²/K, q, r), and prices a start-window knock-in's European on that call's payoff and process, upstream's fix after v1.44 (#2876, Divergences/BarrierUpstreamFixesTests.cs).

Documented divergences. Each rate is read on the volatility's clock, the curve's zero rate times its own time over the volatility's, and each time is the volatility's, as AnalyticBarrierEngine reads them, where QuantLib reads every structure at the risk-free curve's times (Divergences/BarrierClosedFormMismatchedTimesTests.cs). A start-window knock-out's rebate, paid at the hit before the cover event, is priced as the analytic barrier engine prices a knock-out's rebate to the cover event, where QuantLib's engine ignores the rebate; no formula covers the end windows' or the knock-ins' rebates, which are refused. A cover event on the evaluation date takes the formulas' limit: the start window's, the vanilla for a knock-out and 0 for a knock-in; the end windows', the standard barrier option through the analytic barrier engine, where QuantLib's formulas take infinite arguments. A start-window option whose spot lies beyond the barrier is refused ("barrier touched"), as the family's other engines refuse it, where QuantLib's prices it. The end-window knock-ins, which QuantLib refuses, are priced by in-out parity on QuantLib's European and end-window knock-out, the parity QuantLib applies to the start window's. And a non-European exercise is refused, as the family's European engines refuse it, where QuantLib prices it to its last date and its start-window knock-in crashes (Divergences/PartialTimeExerciseTests.cs).

The formulas are first-passage closed forms in equivalent-constant rates and volatilities: no exact closed form exists under general deterministic term structures, and on shaped markets they miss an independent Monte Carlo by up to +3.9%.

Methods

Calculate(PartialTimeBarrierOption, EvaluationContext, GeneralizedBlackScholesProcess)

Prices a partial-time barrier option.

public static OneAssetOptionResults Calculate(PartialTimeBarrierOption option, EvaluationContext context, GeneralizedBlackScholesProcess process)

Parameters

option PartialTimeBarrierOption

The option.

context EvaluationContext

The evaluation context.

process GeneralizedBlackScholesProcess

The Black-Scholes process.

Returns

OneAssetOptionResults

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

Exceptions

ArgumentNullException

An argument is null.

NanoQLException

The exercise isn't European; the payoff isn't plain vanilla or its strike isn't positive; the spot isn't positive; the cover event is before the evaluation date ("negative time"); a start-window spot lies beyond the barrier ("barrier touched"); a rebate is given for an end window or a knock-in; an end-window B2 option is struck beyond its barrier, as QuantLib refuses it.