Class DoubleBarrierOption

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

public class DoubleBarrierOption extends Object implements FiniteDifferenceEquityEventProduct, FiniteDifferenceInternalStateConstraint
Finite-difference valuation of a continuously monitored vanilla double- barrier option.

The product is defined by a strike K, lower and upper barriers L < U, maturity T, and a call/put sign. Let S(t) denote the underlying. The alive region is the open band

L < S(t) < U.

For a knock-out contract, the option survives only as long as the path remains inside the band. For a knock-in contract, the option becomes active once the path hits either barrier. Writing

τ = inf { t in [0,T] : S(t) ≤ L or S(t) ≥ U },

the corresponding payoffs are

V(T) = 1_{τ > T} max(ω(S(T)-K),0) for knock-out,

V(T) = 1_{τ ≤ T} max(ω(S(T)-K),0) for knock-in,

where ω = 1 for a call and ω = -1 for a put.

This implementation supports:

The knock-out case is priced directly by imposing an internal-state constraint outside the alive band. The knock-in case is priced directly without parity decomposition:

  • outside the alive band, the option is already activated and equals the corresponding vanilla value,
  • inside the alive band, a pre-hit PDE is solved on the band (L,U) with time-dependent Dirichlet boundary data taken from the activated vanilla branch at the two barriers,
  • for Bermudan and American exercise, the obstacle is applied only in the activated vanilla branch, while the pre-hit branch remains a pure continuation problem up to barrier activation.

In the one-dimensional case this leads to a PDE on the truncated spatial interval (L,U). In the two-dimensional case the same idea is applied while preserving the second state-variable grid and imposing barrier traces that depend on time and on the second state variable.

For discrete monitoring, barrier activation / knock-out is applied only at the supplied monitoring dates via event conditions. In the discretely monitored knock-in case, the activated branch is the true vanilla branch with the product exercise style, while the pre-hit branch is solved as a European continuation problem between monitoring dates.

Author:
Alessandro Gnoatto
  • Constructor Details

    • DoubleBarrierOption

      public DoubleBarrierOption(String underlyingName, double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType, Exercise exercise)
      Creates a double-barrier option.
      Parameters:
      underlyingName - Name of the underlying. May be null.
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      doubleBarrierType - Double-barrier type.
      exercise - Exercise specification.
    • DoubleBarrierOption

      public DoubleBarrierOption(String underlyingName, double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes)
      Creates a double-barrier option.
      Parameters:
      underlyingName - Name of the underlying. May be null.
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      doubleBarrierType - Double-barrier type.
      exercise - Exercise specification.
      monitoringType - Monitoring type.
      monitoringTimes - Monitoring times for discrete monitoring.
    • DoubleBarrierOption

      public DoubleBarrierOption(String underlyingName, double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType)
      Creates a European double-barrier option.
      Parameters:
      underlyingName - Name of the underlying. May be null.
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      doubleBarrierType - Double-barrier type.
    • DoubleBarrierOption

      public DoubleBarrierOption(String underlyingName, double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType, MonitoringType monitoringType, double[] monitoringTimes)
      Creates a European double-barrier option.
      Parameters:
      underlyingName - Name of the underlying. May be null.
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      doubleBarrierType - Double-barrier type.
      monitoringType - Monitoring type.
      monitoringTimes - Monitoring times for discrete monitoring.
    • DoubleBarrierOption

      public DoubleBarrierOption(double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType)
      Creates a European double-barrier option with anonymous underlying.
      Parameters:
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      doubleBarrierType - Double-barrier type.
    • DoubleBarrierOption

      public DoubleBarrierOption(double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType, MonitoringType monitoringType, double[] monitoringTimes)
      Creates a European double-barrier option with anonymous underlying.
      Parameters:
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      doubleBarrierType - Double-barrier type.
      monitoringType - Monitoring type.
      monitoringTimes - Monitoring times for discrete monitoring.
    • DoubleBarrierOption

      public DoubleBarrierOption(double maturity, double strike, double lowerBarrier, double upperBarrier, double callOrPutSign, DoubleBarrierType doubleBarrierType)
      Creates a European double-barrier option using a numeric call/put sign.
      Parameters:
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Numeric sign, 1.0 for call and -1.0 for put.
      doubleBarrierType - Double-barrier type.
    • DoubleBarrierOption

      public DoubleBarrierOption(double maturity, double strike, double lowerBarrier, double upperBarrier, double callOrPutSign, DoubleBarrierType doubleBarrierType, MonitoringType monitoringType, double[] monitoringTimes)
      Creates a European double-barrier option using a numeric call/put sign.
      Parameters:
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Numeric sign, 1.0 for call and -1.0 for put.
      doubleBarrierType - Double-barrier type.
      monitoringType - Monitoring type.
      monitoringTimes - Monitoring times for discrete monitoring.
    • DoubleBarrierOption

      public DoubleBarrierOption(String underlyingName, double maturity, double strike, double lowerBarrier, double upperBarrier, double callOrPutSign, DoubleBarrierType doubleBarrierType, Exercise exercise)
      Creates a double-barrier option using a numeric call/put sign.
      Parameters:
      underlyingName - Name of the underlying. May be null.
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Numeric sign, 1.0 for call and -1.0 for put.
      doubleBarrierType - Double-barrier type.
      exercise - Exercise specification.
    • DoubleBarrierOption

      public DoubleBarrierOption(String underlyingName, double maturity, double strike, double lowerBarrier, double upperBarrier, double callOrPutSign, DoubleBarrierType doubleBarrierType, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes)
      Creates a double-barrier option using a numeric call/put sign.
      Parameters:
      underlyingName - Name of the underlying. May be null.
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Numeric sign, 1.0 for call and -1.0 for put.
      doubleBarrierType - Double-barrier type.
      exercise - Exercise specification.
      monitoringType - Monitoring type.
      monitoringTimes - Monitoring times for discrete monitoring.
    • DoubleBarrierOption

      public DoubleBarrierOption(double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType, Exercise exercise)
      Creates a double-barrier option with anonymous underlying.
      Parameters:
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      doubleBarrierType - Double-barrier type.
      exercise - Exercise specification.
    • DoubleBarrierOption

      public DoubleBarrierOption(double maturity, double strike, double lowerBarrier, double upperBarrier, CallOrPut callOrPutSign, DoubleBarrierType doubleBarrierType, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes)
      Creates a double-barrier option with anonymous underlying.
      Parameters:
      maturity - Option maturity.
      strike - Option strike.
      lowerBarrier - Lower barrier.
      upperBarrier - Upper barrier.
      callOrPutSign - Call/put sign.
      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 knock-out constraint is active.
      Specified by:
      isConstraintActive in interface FiniteDifferenceInternalStateConstraint
      Parameters:
      time - Evaluation time.
      stateVariables - State variables.
      Returns:
      true if the state is outside the alive band.
    • getConstrainedValue

      public double getConstrainedValue(double time, double... stateVariables)
      Returns the constrained value in the knocked-out 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.
    • getStrike

      public double getStrike()
      Returns the strike.
      Returns:
      The strike.
    • getLowerBarrier

      public double getLowerBarrier()
      Returns the lower barrier.
      Returns:
      The lower barrier.
    • getUpperBarrier

      public double getUpperBarrier()
      Returns the upper barrier.
      Returns:
      The upper barrier.
    • getCallOrPut

      public CallOrPut getCallOrPut()
      Returns the call/put sign.
      Returns:
      The call/put sign.
    • 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.