Class DoubleBarrierBinaryOption

java.lang.Object
net.finmath.finitedifference.assetderivativevaluation.products.DoubleBarrierBinaryOption
All Implemented Interfaces:
FiniteDifferenceEquityEventProduct, FiniteDifferenceEquityProduct, FiniteDifferenceInternalStateConstraint, FiniteDifferenceProduct<FiniteDifferenceEquityModel>, Product

public class DoubleBarrierBinaryOption extends Object implements FiniteDifferenceEquityEventProduct, FiniteDifferenceInternalStateConstraint
Finite-difference valuation of a double-barrier cash binary option.

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:

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 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 be null.
      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 be null.
      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 be null.
      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 be null.
      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

      public double[] getValue(double evaluationTime, FiniteDifferenceEquityModel model)
      Returns the values at the specified evaluation time on the model space grid.
      Specified by:
      getValue in interface FiniteDifferenceProduct<FiniteDifferenceEquityModel>
      Parameters:
      evaluationTime - Evaluation time.
      model - The finite-difference model.
      Returns:
      The value vector at the requested evaluation time.
    • getValues

      public double[][] getValues(FiniteDifferenceEquityModel model)
      Returns the full value surface.
      Specified by:
      getValues in interface FiniteDifferenceProduct<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: FiniteDifferenceEquityEventProduct
      Returns the value.
      Specified by:
      getEventTimes in interface FiniteDifferenceEquityEventProduct
      Returns:
      The value.
    • applyEventCondition

      public double[] applyEventCondition(double time, double[] valuesAfterEvent, FiniteDifferenceEquityModel model)
      Description copied from interface: FiniteDifferenceEquityEventProduct
      Performs the operation.
      Specified by:
      applyEventCondition in interface FiniteDifferenceEquityEventProduct
      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:
      isConstraintActive in interface FiniteDifferenceInternalStateConstraint
      Parameters:
      time - Evaluation time.
      stateVariables - State variables.
      Returns:
      true if 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:
      getConstrainedValue in interface FiniteDifferenceInternalStateConstraint
      Parameters:
      time - Evaluation time.
      stateVariables - State variables.
      Returns:
      The constrained value.
    • getUnderlyingName

      public String 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

      public DoubleBarrierType getDoubleBarrierType()
      Returns the double-barrier type.
      Returns:
      The double-barrier type.
    • getExercise

      public Exercise getExercise()
      Returns the exercise specification.
      Returns:
      The exercise specification.
    • getMonitoringType

      public MonitoringType getMonitoringType()
      Returns the monitoring type.
      Returns:
      The monitoring type.
    • getMonitoringTimes

      public double[] getMonitoringTimes()
      Returns the monitoring times.
      Returns:
      The monitoring times, or null for continuous monitoring.