Class DigitalBarrierOption
java.lang.Object
net.finmath.finitedifference.assetderivativevaluation.products.DigitalBarrierOption
- All Implemented Interfaces:
FiniteDifferenceEquityEventProduct, FiniteDifferenceEquityProduct, FiniteDifferenceInternalStateConstraint, FiniteDifferenceOneDimensionalKnockInProduct, FiniteDifferenceProduct<FiniteDifferenceEquityModel>, Product
public class DigitalBarrierOption
extends Object
implements FiniteDifferenceEquityEventProduct, FiniteDifferenceInternalStateConstraint, FiniteDifferenceOneDimensionalKnockInProduct
Finite-difference valuation of a single-barrier digital option on one asset.
Supported payoff families:
- cash-or-nothing call / put,
- asset-or-nothing call / put,
- down-in / up-in / down-out / up-out.
Current implementation policy:
- continuously monitored knock-out options are priced directly by the finite-difference solver,
- continuously monitored 1D knock-in options are priced directly through a coupled two-state PDE on an auxiliary spatial grid where the barrier is placed on an interior node,
- continuously monitored 2D knock-in options use the activated-branch / pre-hit formulation,
- for one-dimensional models, terminal payoff initialization is cell- averaged in order to reduce strike-discontinuity grid bias,
- discretely monitored 1D and 2D knock-out options are handled through event-time zeroing on breached nodes,
- discretely monitored 1D and 2D knock-in options are handled through event-time replacement by the activated vanilla digital continuation surface,
- for discretely monitored knock-ins with Bermudan/American exercise, only the activated state carries exercise rights; the pre-hit state is solved as a European continuation problem,
- 2D discrete monitoring is supported for Heston / SABR models.
- Author:
- Alessandro Gnoatto
-
Constructor Summary
ConstructorsConstructorDescriptionDigitalBarrierOption(double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.DigitalBarrierOption(double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise) Performs the operation.DigitalBarrierOption(double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation.DigitalBarrierOption(double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.DigitalBarrierOption(double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise) Performs the operation.DigitalBarrierOption(double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation.DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise) Performs the operation.DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation.DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]applyEventCondition(double time, double[] valuesAfterEvent, FiniteDifferenceEquityModel model) Performs the operation.Returns the barrier type.doubleReturns the barrier level.Returns the value.doubleReturns the value.doublegetConstrainedValue(double time, double... stateVariables) Returns the value to impose at a constrained node.Returns the value.double[]Returns the value.Returns the value.doubleReturns the value prescribed in the inactive regime at maturity.doubleReturns the maturity.double[]Returns the value.Returns the value.doubleReturns the value.Returns the value.double[]getValue(double evaluationTime, FiniteDifferenceEquityModel model) Returns the value.double[][]Returns the value.booleanisConstraintActive(double time, double... stateVariables) Returns true if the internal constraint is active at the given node and time.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
-
DigitalBarrierOption
public DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise) Performs the operation.- Parameters:
underlyingName- The value.maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.exercise- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation.- Parameters:
underlyingName- The value.maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.exercise- The value.monitoringType- The value.monitoringTimes- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.- Parameters:
underlyingName- The value.maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation.- Parameters:
underlyingName- The value.maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.monitoringType- The value.monitoringTimes- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(String underlyingName, double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.- Parameters:
underlyingName- The value.maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.- Parameters:
maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise) Performs the operation.- Parameters:
maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.exercise- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(double maturity, double strike, double barrierValue, CallOrPut callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation.- Parameters:
maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.exercise- The value.monitoringType- The value.monitoringTimes- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff) Performs the operation.- Parameters:
maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise) Performs the operation.- Parameters:
maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.exercise- The value.
-
DigitalBarrierOption
public DigitalBarrierOption(double maturity, double strike, double barrierValue, double callOrPutSign, BarrierType barrierType, DigitalPayoffType digitalPayoffType, double cashPayoff, Exercise exercise, MonitoringType monitoringType, double[] monitoringTimes) Performs the operation.- Parameters:
maturity- The value.strike- The value.barrierValue- The value.callOrPutSign- The value.barrierType- The value.digitalPayoffType- The value.cashPayoff- The value.exercise- The value.monitoringType- The value.monitoringTimes- The value.
-
-
Method Details
-
getValue
Description copied from interface:FiniteDifferenceProductReturns the value.- Specified by:
getValuein interfaceFiniteDifferenceProduct<FiniteDifferenceEquityModel>- Parameters:
evaluationTime- The value.model- The value.- Returns:
- The value.
-
getValues
Description copied from interface:FiniteDifferenceProductReturns the value.- Specified by:
getValuesin interfaceFiniteDifferenceProduct<FiniteDifferenceEquityModel>- Parameters:
model- The value.- Returns:
- The value.
-
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) Description copied from interface:FiniteDifferenceInternalStateConstraintReturns true if the internal constraint is active at the given node and time.- Specified by:
isConstraintActivein interfaceFiniteDifferenceInternalStateConstraint- Parameters:
time- Running time.stateVariables- State variables at the grid node.- Returns:
- True if the node is constrained.
-
getConstrainedValue
public double getConstrainedValue(double time, double... stateVariables) Description copied from interface:FiniteDifferenceInternalStateConstraintReturns the value to impose at a constrained node.This method is called only if
FiniteDifferenceInternalStateConstraint.isConstraintActive(double, double...)returns true.- Specified by:
getConstrainedValuein interfaceFiniteDifferenceInternalStateConstraint- Parameters:
time- Running time.stateVariables- State variables at the grid node.- Returns:
- The constrained value.
-
getUnderlyingName
-
getMaturity
public double getMaturity()Description copied from interface:FiniteDifferenceOneDimensionalKnockInProductReturns the maturity.- Specified by:
getMaturityin interfaceFiniteDifferenceOneDimensionalKnockInProduct- Returns:
- The maturity.
-
getStrike
public double getStrike()Returns the value.- Returns:
- The value.
-
getBarrierValue
public double getBarrierValue()Description copied from interface:FiniteDifferenceOneDimensionalKnockInProductReturns the barrier level.- Specified by:
getBarrierValuein interfaceFiniteDifferenceOneDimensionalKnockInProduct- Returns:
- The barrier level.
-
getCallOrPut
-
getBarrierType
Description copied from interface:FiniteDifferenceOneDimensionalKnockInProductReturns the barrier type.- Specified by:
getBarrierTypein interfaceFiniteDifferenceOneDimensionalKnockInProduct- Returns:
- The barrier type.
-
getDigitalPayoffType
-
getCashPayoff
public double getCashPayoff()Returns the value.- Returns:
- The value.
-
getExercise
-
getMonitoringType
-
getMonitoringTimes
public double[] getMonitoringTimes()Returns the value.- Returns:
- The value.
-
getInactiveValueAtMaturity
public double getInactiveValueAtMaturity()Description copied from interface:FiniteDifferenceOneDimensionalKnockInProductReturns the value prescribed in the inactive regime at maturity.This is the terminal value in the no-hit region. For vanilla barrier options this is typically the rebate. For digital barrier options it is typically
0.0.- Specified by:
getInactiveValueAtMaturityin interfaceFiniteDifferenceOneDimensionalKnockInProduct- Returns:
- The inactive value at maturity.
-