Table of Contents

Class DoubleBarrierOption

Namespace
NanoQL.Instruments
Assembly
NanoQL.dll

A double barrier option on a single asset: a striked payoff and an exercise, knocked in or out at a lower and an upper barrier.

public class DoubleBarrierOption : OneAssetOption
Inheritance
DoubleBarrierOption
Derived
Inherited Members

Remarks

An extension point, as in QuantLib: the quanto double-barrier option derives from it, and the experimental double-barrier engines price it. Immutable. A knock-out's rebate is paid at the first touch of either barrier, a knock-in's at expiry if neither was touched (as the analytic and binary engines price it; the binary engine refuses a KIKO's or KOKI's); QuantLib's analytic and binary engines read no rebate.

Constructors

DoubleBarrierOption(DoubleBarrierType, double, double, double, StrikedTypePayoff, Exercise)

Initializes a new instance of the DoubleBarrierOption class.

public DoubleBarrierOption(DoubleBarrierType barrierType, double barrierLo, double barrierHi, double rebate, StrikedTypePayoff payoff, Exercise exercise)

Parameters

barrierType DoubleBarrierType

The barrier's type.

barrierLo double

The lower barrier.

barrierHi double

The upper barrier.

rebate double

The rebate.

payoff StrikedTypePayoff

The striked payoff.

exercise Exercise

The exercise.

Exceptions

ArgumentOutOfRangeException

barrierType isn't a member of its type, with QuantLib's "Invalid barrier type".

ArgumentNullException

payoff or exercise is null.

Properties

BarrierHi

Gets the upper barrier.

public double BarrierHi { get; }

Property Value

double

BarrierLo

Gets the lower barrier.

public double BarrierLo { get; }

Property Value

double

BarrierType

Gets the barrier's type.

public DoubleBarrierType BarrierType { get; }

Property Value

DoubleBarrierType

Rebate

Gets the rebate.

public double Rebate { get; }

Property Value

double

Methods

ImpliedVolatility(double, GeneralizedBlackScholesProcess, EvaluationContext, double, int, double, double)

The volatility at which the option's value is the target value: QuantLib's analytic double-barrier engine.

public double ImpliedVolatility(double targetValue, GeneralizedBlackScholesProcess process, EvaluationContext context, double accuracy = 0.0001, int maxEvaluations = 100, double minVol = 1E-07, double maxVol = 4)

Parameters

targetValue double

The target value.

process GeneralizedBlackScholesProcess

The process, whose Black volatility is replaced by a flat one at each trial.

context EvaluationContext

The evaluation context.

accuracy double

The solver's accuracy.

maxEvaluations int

The solver's maximum number of evaluations.

minVol double

The lower end of the bracket.

maxVol double

The upper end of the bracket.

Returns

double

The implied volatility.

Remarks

The solve prices through the analytic engine as nanoql fixes it (its rebate, its terms beyond five, each rate on the volatility's clock), so it moves where those fixes move the price. QuantLib's warning: the result is consistent only with prices from the same engine.

Exceptions

ArgumentNullException

process or context is null.

ArgumentOutOfRangeException

maxEvaluations is negative.

ArgumentException

The accuracy isn't positive, or the bracket is empty.

NanoQLException

The option has expired or isn't European, the value can't be bracketed, the solver exceeds its evaluations, or the engine fails.

Triggered(double)

Whether an underlying value lies on or beyond either barrier: QuantLib's double-barrier engines' triggered.

public bool Triggered(double underlying)

Parameters

underlying double

The underlying value.

Returns

bool

true when the value is at or below the lower barrier or at or above the upper one.