Table of Contents

Class BinomialVanillaEngine

Namespace
NanoQL.PricingEngines
Assembly
NanoQL.dll

The binomial pricing engine for vanilla options: the option rolled back on a Black-Scholes lattice over a binomial tree, built on the process's curves and volatility flattened at the option's maturity.

public static class BinomialVanillaEngine
Inheritance
BinomialVanillaEngine
Inherited Members

Remarks

QuantLib's template on the tree: Calculate<TTree>(VanillaOption, EvaluationContext, GeneralizedBlackScholesProcess, int) takes the tree as its type argument, which the engine builds through Create(StochasticProcess1D, double, int, double); the seven named engines, as QuantLib-Python names them, fix it. The delta and gamma come from the lattice's first two steps, the theta from the Black-Scholes relation, as QuantLib's do.

The time grid and the lattice take their step count from the tree, its columns less one, where QuantLib's take the count given (binomialengine.hpp:111-116): the Leisen-Reimer and Joshi trees build an even count on the next odd one, so QuantLib rolls back a tree built for n + 1 steps over n, which at 250 steps errs by 4.7e-2 against the analytic engine. Every odd count and every other tree is QuantLib's. A documented divergence.

QuantLib's tree runs on the risk-free curve's time to maturity, and QuantLib flattens the dividend curve and the volatility on their own day counters and reads them over that time, so where either has another day counter or reference date it integrates the wrong dividend or variance. Here the tree runs on the risk-free curve's day counter from the earliest reference date of the structures, as the finite-difference engine's grid does, and a structure on another day counter or reference date is flattened on it, its rate or volatility the one whose discount or variance at the maturity date is the structure's own; where every structure shares the risk-free curve's day counter and reference date, the tree is QuantLib's (Divergences/BinomialMismatchedTimesTests.cs). A structure accrues nothing before its own date, so an option expiring before a later risk-free curve's is priced, where QuantLib's read throws, and the theta reads no rate or volatility of a structure dated on or after the exercise, where QuantLib reads each at the structure's own time 0 (Divergences/ExerciseBeforeReferenceDateTests.cs).

Methods

Calculate<TTree>(VanillaOption, EvaluationContext, GeneralizedBlackScholesProcess, int)

Prices a vanilla option on a binomial tree.

public static OneAssetOptionResults Calculate<TTree>(VanillaOption option, EvaluationContext context, GeneralizedBlackScholesProcess process, int timeSteps) where TTree : Tree, IBinomialTree<TTree>

Parameters

option VanillaOption

The option, with a plain-vanilla payoff.

context EvaluationContext

The evaluation context.

process GeneralizedBlackScholesProcess

The Black-Scholes process.

timeSteps int

The number of time steps, at least 2.

Returns

OneAssetOptionResults

The value, delta, gamma and theta; the delta, the gamma and the theta are null where the tree's first nodes don't separate, as QuantLib's Null<Real>().

Type Parameters

TTree

The binomial tree.

Exceptions

ArgumentNullException

An argument is null.

ArgumentException

timeSteps is below 2.

NanoQLException

The option's payoff isn't plain vanilla, the underlying isn't positive, or the tree can't be built.