Class AnalyticBarrierEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The analytic engine for European barrier options: Haug's closed forms ("Option pricing formulas", 1998, pp. 69-72) on a Black-Scholes process.
public static class AnalyticBarrierEngine
- Inheritance
-
AnalyticBarrierEngine
- Inherited Members
Remarks
QuantLib's formulas, with four changes, each a documented divergence that leaves QuantLib's bits where it doesn't
apply. At a variance below machine epsilon the underlying follows its forward, as QuantLib's master prices it
(e29c64126): a knock-out pays its rebate at the hit or the vanilla payoff, a knock-in the vanilla payoff or
its rebate at expiry, a spot on the barrier a hit. A negative rebate is priced, where QuantLib's E and
F test rebate > 0 and drop it. Each rate is read on the volatility's clock, the curve's zero rate
times its own time over the volatility's, nothing accrued before a structure's reference date, so curves on other
day counters or dates price as QuantLib's engine does on the same market restated on the volatility's (a factor of
1.0, and QuantLib's bits, where the clocks agree; 1.0 where the volatility's time is 0). A knock-out's rebate whose
closed form has no real λ (λ² = μ² + 2r/σ² < 0, at negative rates), where QuantLib's is NaN, is the
rebate's present value at the hit, integrated over the barrier's first-passage density.
The formulas are first-passage closed forms in one equivalent-constant carry and 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 they miss QuantLib's finite-difference barrier engine by -1.6% to +0.6%; the term-structure-exact routes are FdBlackScholesBarrierEngine and the Monte Carlo engines.
QuantLib's references: Haug's formulas, and its testHaugValues table.
Methods
Calculate(BarrierOption, EvaluationContext, GeneralizedBlackScholesProcess)
Prices a barrier option.
public static OneAssetOptionResults Calculate(BarrierOption option, EvaluationContext context, GeneralizedBlackScholesProcess process)
Parameters
optionBarrierOptionThe option.
contextEvaluationContextThe evaluation context.
processGeneralizedBlackScholesProcessThe 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 payoff isn't a plain vanilla one or its strike isn't positive, the exercise isn't European, the spot isn't positive, or it lies beyond the barrier ("barrier touched").