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
barrierTypeDoubleBarrierTypeThe barrier's type.
barrierLodoubleThe lower barrier.
barrierHidoubleThe upper barrier.
rebatedoubleThe rebate.
payoffStrikedTypePayoffThe striked payoff.
exerciseExerciseThe exercise.
Exceptions
- ArgumentOutOfRangeException
barrierTypeisn't a member of its type, with QuantLib's "Invalid barrier type".- ArgumentNullException
payofforexerciseis null.
Properties
BarrierHi
Gets the upper barrier.
public double BarrierHi { get; }
Property Value
BarrierLo
Gets the lower barrier.
public double BarrierLo { get; }
Property Value
BarrierType
Gets the barrier's type.
public DoubleBarrierType BarrierType { get; }
Property Value
Rebate
Gets the rebate.
public double Rebate { get; }
Property Value
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
targetValuedoubleThe target value.
processGeneralizedBlackScholesProcessThe process, whose Black volatility is replaced by a flat one at each trial.
contextEvaluationContextThe evaluation context.
accuracydoubleThe solver's accuracy.
maxEvaluationsintThe solver's maximum number of evaluations.
minVoldoubleThe lower end of the bracket.
maxVoldoubleThe 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
processorcontextis null.- ArgumentOutOfRangeException
maxEvaluationsis 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
underlyingdoubleThe underlying value.