Class BinomialBarrierEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The binomial engine for barrier options: a discretized barrier asset 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. For Cox-Ross-Rubinstein trees the number of steps is raised to Boyle and Lau's optimum ("Bumping up against the barrier with the binomial method", Journal of Derivatives, 1/1994).
public static class BinomialBarrierEngine
- Inheritance
-
BinomialBarrierEngine
- Inherited Members
Remarks
QuantLib's template on the tree and the discretized asset: Calculate<TTree, TAsset>(BarrierOption, EvaluationContext, GeneralizedBlackScholesProcess, int, int) takes both as type arguments, the tree built through Create(StochasticProcess1D, double, int, double) and the asset through Create(BarrierOption, StochasticProcess, TimeGrid?), DiscretizedBarrierOption or DiscretizedDermanKaniBarrierOption or a user's own. The delta and gamma come from the lattice's first two steps, the gamma and delta null where the nodes don't separate, and the theta from the second step's middle node, as QuantLib's.
Documented divergences. The tree runs on the risk-free curve's day counter from the earliest reference date of the
structures, each structure on another day counter or reference date flattened on it from its discount or variance
at the maturity date, as BinomialVanillaEngine's tree, where QuantLib flattens each curve from the
risk-free curve's date on its own day counter (Divergences/BinomialBarrierMismatchedTimesTests.cs); where
every structure shares the risk-free curve's day counter and reference date, the tree is QuantLib's. The time grid
and the lattice take their step count from the tree, its columns less one, where QuantLib's take the count given;
Boyle and Lau's optimum reads the flattened volatility.
Methods
Calculate<TTree, TAsset>(BarrierOption, EvaluationContext, GeneralizedBlackScholesProcess, int, int)
Prices a barrier option on a binomial tree.
public static OneAssetOptionResults Calculate<TTree, TAsset>(BarrierOption option, EvaluationContext context, GeneralizedBlackScholesProcess process, int timeSteps, int maxTimeSteps = 0) where TTree : Tree, IBinomialTree<TTree> where TAsset : DiscretizedAsset, IDiscretizedBarrierAsset<TAsset>
Parameters
optionBarrierOptionThe option, with a striked payoff.
contextEvaluationContextThe evaluation context.
processGeneralizedBlackScholesProcessThe Black-Scholes process.
timeStepsintThe number of time steps, positive.
maxTimeStepsintThe most time steps Boyle and Lau's optimum may raise them to: 0, QuantLib's default, for the heuristic max(1000, 5 ×
timeSteps); equal totimeStepsto disable it. Ignored but for Cox-Ross-Rubinstein trees.
Returns
- OneAssetOptionResults
The value, delta, gamma and theta; the delta and the gamma null where the tree's first nodes don't separate.
Type Parameters
TTreeThe binomial tree.
TAssetThe discretized barrier asset.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
timeStepsisn't positive, ormaxTimeStepsis neither 0 nor at leasttimeSteps.- NanoQLException
The payoff isn't striked or its strike isn't positive, the underlying isn't positive or lies beyond the barrier ("barrier touched"), or the tree can't be built.