Class DoubleBarrierBinaryOption
- All Implemented Interfaces:
FiniteDifferenceEquityEventProduct, FiniteDifferenceEquityProduct, FiniteDifferenceInternalStateConstraint, FiniteDifferenceProduct<FiniteDifferenceEquityModel>, Product
The contract is defined by a maturity T, a cash amount C, and two barriers L < U. Let S(t) denote the underlying and let
τL = inf { t in [0,T] : S(t) ≤ L },
τU = inf { t in [0,T] : S(t) ≥ U },
with the alive band given by
L < S(t) < U.
Supported barrier styles:
DoubleBarrierType.KNOCK_OUT: pays C if neither barrier is hit before maturity,DoubleBarrierType.KNOCK_IN: pays C if either barrier is hit before or at maturity,DoubleBarrierType.KIKO: pays C if the lower barrier is hit first while the upper barrier acts as knock-out,DoubleBarrierType.KOKI: pays C if the upper barrier is hit first while the lower barrier acts as knock-out.
For continuous monitoring, the implementation remains a direct one-state constrained PDE. For discrete monitoring, barrier activation / knock-out is applied only at the supplied monitoring dates via vector-level event conditions.
For discretely monitored knock-in / KIKO / KOKI cases, the activated branch is represented by cached activated cash vectors. The cache is stored in a thread-local stack so that nested valuations and concurrent valuations of the same product instance do not overwrite each other.
- Author:
- Alessandro Gnoatto
-
Constructor Summary
ConstructorsConstructorDescriptionDoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType) Creates a European double-barrier cash binary option with anonymous underlying.DoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise) Creates a double-barrier cash binary option with anonymous underlying.DoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Creates a double-barrier cash binary option with anonymous underlying.DoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, MonitoringType monitoringType, double[] monitoringTimes) Creates a European double-barrier cash binary option with anonymous underlying.DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType) Creates a European double-barrier cash binary option.DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise) Creates a double-barrier cash binary option.DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Creates a double-barrier cash binary option.DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, MonitoringType monitoringType, double[] monitoringTimes) Creates a European double-barrier cash binary option. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]applyEventCondition(double time, double[] valuesAfterEvent, FiniteDifferenceEquityModel model) Performs the operation.doubleReturns the cash payoff.doublegetConstrainedValue(double time, double... stateVariables) Returns the constrained value in the barrier region.Returns the double-barrier type.double[]Returns the value.Returns the exercise specification.doubleReturns the lower barrier.doubleReturns the maturity.double[]Returns the monitoring times.Returns the monitoring type.Returns the underlying name.doubleReturns the upper barrier.double[]getValue(double evaluationTime, FiniteDifferenceEquityModel model) Returns the values at the specified evaluation time on the model space grid.double[][]Returns the full value surface.booleanisConstraintActive(double time, double... stateVariables) Returns whether the internal constrained regime is active.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FiniteDifferenceEquityProduct
getModelClassMethods inherited from interface FiniteDifferenceProduct
getValue
-
Constructor Details
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise) Creates a double-barrier cash binary option.- Parameters:
underlyingName- Name of the underlying. May benull.maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.exercise- Exercise specification.
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Creates a double-barrier cash binary option.- Parameters:
underlyingName- Name of the underlying. May benull.maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.exercise- Exercise specification.monitoringType- Monitoring type.monitoringTimes- Monitoring times for discrete monitoring.
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType) Creates a European double-barrier cash binary option.- Parameters:
underlyingName- Name of the underlying. May benull.maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(String underlyingName, double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, MonitoringType monitoringType, double[] monitoringTimes) Creates a European double-barrier cash binary option.- Parameters:
underlyingName- Name of the underlying. May benull.maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.monitoringType- Monitoring type.monitoringTimes- Monitoring times for discrete monitoring.
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType) Creates a European double-barrier cash binary option with anonymous underlying.- Parameters:
maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, MonitoringType monitoringType, double[] monitoringTimes) Creates a European double-barrier cash binary option with anonymous underlying.- Parameters:
maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.monitoringType- Monitoring type.monitoringTimes- Monitoring times for discrete monitoring.
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise) Creates a double-barrier cash binary option with anonymous underlying.- Parameters:
maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.exercise- Exercise specification.
-
DoubleBarrierBinaryOption
public DoubleBarrierBinaryOption(double maturity, double cashPayoff, double lowerBarrier, double upperBarrier, DoubleBarrierType doubleBarrierType, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Creates a double-barrier cash binary option with anonymous underlying.- Parameters:
maturity- Option maturity.cashPayoff- Cash payoff amount.lowerBarrier- Lower barrier.upperBarrier- Upper barrier.doubleBarrierType- Double-barrier type.exercise- Exercise specification.monitoringType- Monitoring type.monitoringTimes- Monitoring times for discrete monitoring.
-
-
Method Details
-
getValue
Returns the values at the specified evaluation time on the model space grid.- Specified by:
getValuein interfaceFiniteDifferenceProduct<FiniteDifferenceEquityModel>- Parameters:
evaluationTime- Evaluation time.model- The finite-difference model.- Returns:
- The value vector at the requested evaluation time.
-
getValues
Returns the full value surface.- Specified by:
getValuesin interfaceFiniteDifferenceProduct<FiniteDifferenceEquityModel>- Parameters:
model- The finite-difference model.- Returns:
- The value surface indexed by space point and time index.
-
getEventTimes
public double[] getEventTimes()Description copied from interface:FiniteDifferenceEquityEventProductReturns the value.- Specified by:
getEventTimesin interfaceFiniteDifferenceEquityEventProduct- Returns:
- The value.
-
applyEventCondition
public double[] applyEventCondition(double time, double[] valuesAfterEvent, FiniteDifferenceEquityModel model) Description copied from interface:FiniteDifferenceEquityEventProductPerforms the operation.- Specified by:
applyEventConditionin interfaceFiniteDifferenceEquityEventProduct- Parameters:
time- The value.valuesAfterEvent- The value.model- The value.- Returns:
- The value.
-
isConstraintActive
public boolean isConstraintActive(double time, double... stateVariables) Returns whether the internal constrained regime is active.- Specified by:
isConstraintActivein interfaceFiniteDifferenceInternalStateConstraint- Parameters:
time- Evaluation time.stateVariables- State variables.- Returns:
trueif the underlying is outside the alive band.
-
getConstrainedValue
public double getConstrainedValue(double time, double... stateVariables) Returns the constrained value in the barrier region.- Specified by:
getConstrainedValuein interfaceFiniteDifferenceInternalStateConstraint- Parameters:
time- Evaluation time.stateVariables- State variables.- Returns:
- The constrained value.
-
getUnderlyingName
Returns the underlying name.- Returns:
- The underlying name, possibly
null.
-
getMaturity
public double getMaturity()Returns the maturity.- Returns:
- The maturity.
-
getCashPayoff
public double getCashPayoff()Returns the cash payoff.- Returns:
- The cash payoff.
-
getLowerBarrier
public double getLowerBarrier()Returns the lower barrier.- Returns:
- The lower barrier.
-
getUpperBarrier
public double getUpperBarrier()Returns the upper barrier.- Returns:
- The upper barrier.
-
getDoubleBarrierType
Returns the double-barrier type.- Returns:
- The double-barrier type.
-
getExercise
Returns the exercise specification.- Returns:
- The exercise specification.
-
getMonitoringType
Returns the monitoring type.- Returns:
- The monitoring type.
-
getMonitoringTimes
public double[] getMonitoringTimes()Returns the monitoring times.- Returns:
- The monitoring times, or
nullfor continuous monitoring.
-