Class SuoWangDoubleBarrierEngine
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
Suo and Wang's analytic engine for European double barrier options ("Barrier Option Pricing"): the knock-out as an image series, the knock-in as the European less it.
[Experimental("NQL0001")]
public static class SuoWangDoubleBarrierEngine
- Inheritance
-
SuoWangDoubleBarrierEngine
- Inherited Members
Remarks
The value, with QuantLib's additional results: "vanilla", the analytic European; "barrierOut" and "barrierIn", the knock-out and knock-in without their rebate; "rebateIn", QuantLib's own sum for a knock-in's rebate, unread by the value, as in QuantLib.
Documented divergences (each leaving QuantLib's value and bits where it doesn't apply). The strike limits are
clipped to the corridor on both sides, K↑ = max(min(H, K), L) and K↓ = min(max(L, K), H), where QuantLib clips one
side and prices a knock-out call struck above H or a put struck below L negative (#2881's class); the image series
runs from −series to series and on while the next pair of terms exceeds machine epsilon of the sum,
where QuantLib sums from −series to series − 1, ten terms, unconverged on narrow corridors; QuantLib's
sum stands wherever it agrees with that converged series within 1e-12 on the value's scale, max(|value|, 1),
QuantLib's cases among them; where that sum isn't finite or disagrees with the analytic engine's knock-out within
1e-12 on the value's scale, as at low volatility, where QuantLib returns NaN once a term's power overflows and, at
volatilities of 1% to 3%, sums that cancel, the knock-out is the analytic engine's, its terms taken in logs and its
deterministic limit below machine-epsilon variance, the two one image series; and the rebate is priced, a
knock-out's at the first touch of either barrier and a knock-in's at expiry where neither is touched, the analytic
engine's value, where QuantLib's engine reads none (Divergences/SuoWangDoubleBarrierTests.cs).
Each rate and discount is read to the residual time on the volatility's clock, the volatility at the strike, as the analytic engine reads them, where QuantLib reads every structure at the risk-free curve's time: equivalent-constant reads, as the analytic engine keeps them, no exact closed form existing for a first passage under general deterministic term structures.
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
optionDoubleBarrierOptionThe option.
contextEvaluationContextThe evaluation context.
processGeneralizedBlackScholesProcessThe Black-Scholes process.
seriesintThe number of terms either side of 0 the series takes at least; QuantLib's default 5.
Returns
- OneAssetOptionResults
The option's results: the value and QuantLib's additional results; the expired results when the option has expired.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentOutOfRangeException
seriesis negative.- NanoQLException
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 touched"), the type is KIKO or KOKI, the exercise isn't European, or the series doesn't converge.