Class BaroneAdesiWhaleyApproximationEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The Barone-Adesi and Whaley pricing engine for American options (1987).
public static class BaroneAdesiWhaleyApproximationEngine
- Inheritance
-
BaroneAdesiWhaleyApproximationEngine
- Inherited Members
Remarks
The correctness of the returned value is tested by reproducing results available in literature. Where early exercise is never optimal the engine reports the European value and every Greek; otherwise the value alone.
The critical price's Newton step can leave (0, K) for a put, or (K, ∞) for a call, and the next Black formula then
throws (baroneadesiwhaleyengine.cpp:83-130); so does a call's seed where h > 0 takes it below zero
(:59-64, then the Black formula of :93). Here the critical price is then the root of QuantLib's own
equation over that range, by Brent's method. Every case where Newton stays in range keeps QuantLib's bits
(Divergences/BaroneAdesiWhaleyCriticalPriceTests.cs).
Each structure is read at the exercise date by date, nothing accrued before its own reference date; where early
exercise is never optimal the theta's terms run over each structure's own time, as the analytic European engine's,
where QuantLib's run over the volatility's (Divergences/ApproximationThetaMismatchedTimesTests.cs). An
exercise window opening after the reference date is priced by NanoQL.PricingEngines.ApproximationWindow, where QuantLib
reads the last date alone (Divergences/ApproximationWindowTests.cs).
Methods
Calculate(VanillaOption, EvaluationContext, GeneralizedBlackScholesProcess)
Prices an American vanilla option.
public static OneAssetOptionResults Calculate(VanillaOption option, EvaluationContext context, GeneralizedBlackScholesProcess process)
Parameters
optionVanillaOptionThe option.
contextEvaluationContextThe evaluation context.
processGeneralizedBlackScholesProcessThe Black-Scholes process.
Returns
- OneAssetOptionResults
The option's results; the expired results when it has expired.
Exceptions
- ArgumentNullException
An argument is null.
- NanoQLException
The exercise isn't American or pays at expiry, the payoff isn't striked, the underlying isn't positive, or the critical price refuses.
CriticalPrice(StrikedTypePayoff, double, double, double, double)
The critical commodity price: the underlying's level at which early exercise becomes optimal.
public static double CriticalPrice(StrikedTypePayoff payoff, double riskFreeDiscount, double dividendDiscount, double variance, double tolerance = 1E-06)
Parameters
payoffStrikedTypePayoffThe payoff.
riskFreeDiscountdoubleThe risk-free discount to expiry, at most 1.
dividendDiscountdoubleThe dividend discount to expiry.
variancedoubleThe Black variance to expiry.
tolerancedoubleThe tolerance on QuantLib's equation, relative to the strike.
Returns
- double
The critical price.
Exceptions
- ArgumentNullException
payoffis null.- NanoQLException
The risk-free discount is above 1, or the option type is unknown.