Class ConstantContinuousSingleBarrierKnockoutFunction
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.tree.ConstantContinuousSingleBarrierKnockoutFunction
-
- All Implemented Interfaces:
OptionFunction
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class ConstantContinuousSingleBarrierKnockoutFunction extends Object implements org.joda.beans.ImmutableBean, Serializable
Single barrier knock-out option function.The barrier is continuous and the level is constant.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConstantContinuousSingleBarrierKnockoutFunction.Meta
The meta-bean forConstantContinuousSingleBarrierKnockoutFunction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
double
getBarrierLevel()
Gets the constant barrier level.double
getBarrierLevel(int step)
Obtains the barrier level for the time layer specified bystep
.BarrierType
getBarrierType()
Gets the barrier type.DoubleArray
getNextOptionValues(double discountFactor, DoubleMatrix transitionProbability, DoubleArray stateValue, DoubleArray values, int i)
Computes the option values in the intermediate nodes.int
getNumberOfSteps()
Gets the number of time steps.DoubleArray
getPayoffAtExpiryTrinomial(DoubleArray stateValue)
Computes payoff at expiry for trinomial tree.DoubleArray
getRebate()
Gets the rebate.double
getRebate(int step)
Obtains the rebate for the time layer specified bystep
.double
getSign()
Gets the sign.double
getStrike()
Gets the strike value.double
getTimeToExpiry()
Gets the time to expiry.int
hashCode()
static ConstantContinuousSingleBarrierKnockoutFunction.Meta
meta()
The meta-bean forConstantContinuousSingleBarrierKnockoutFunction
.ConstantContinuousSingleBarrierKnockoutFunction.Meta
metaBean()
static ConstantContinuousSingleBarrierKnockoutFunction
of(double strike, double timeToExpiry, PutCall putCall, int numberOfSteps, BarrierType barrierType, double barrierLevel, DoubleArray rebate)
Obtains an instance.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.pricer.impl.tree.OptionFunction
getNextOptionValues, getPayoffAtExpiryTrinomial
-
-
-
-
Method Detail
-
of
public static ConstantContinuousSingleBarrierKnockoutFunction of(double strike, double timeToExpiry, PutCall putCall, int numberOfSteps, BarrierType barrierType, double barrierLevel, DoubleArray rebate)
Obtains an instance.- Parameters:
strike
- the striketimeToExpiry
- the time to expiryputCall
- put or callnumberOfSteps
- number of stepsbarrierType
- the barrier typebarrierLevel
- the barrier levelrebate
- the rebate- Returns:
- the instance
-
getBarrierLevel
public double getBarrierLevel(int step)
Obtains the barrier level for the time layer specified bystep
.- Parameters:
step
- the step- Returns:
- the barrier level
-
getRebate
public double getRebate(int step)
Obtains the rebate for the time layer specified bystep
.- Parameters:
step
- the step- Returns:
- the rebate
-
meta
public static ConstantContinuousSingleBarrierKnockoutFunction.Meta meta()
The meta-bean forConstantContinuousSingleBarrierKnockoutFunction
.- Returns:
- the meta-bean, not null
-
metaBean
public ConstantContinuousSingleBarrierKnockoutFunction.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getStrike
public double getStrike()
Gets the strike value.- Returns:
- the value of the property
-
getTimeToExpiry
public double getTimeToExpiry()
Gets the time to expiry.- Specified by:
getTimeToExpiry
in interfaceOptionFunction
- Returns:
- the value of the property
-
getSign
public double getSign()
Gets the sign.The sign is +1 for call and -1 for put.
- Returns:
- the value of the property
-
getNumberOfSteps
public int getNumberOfSteps()
Gets the number of time steps.- Specified by:
getNumberOfSteps
in interfaceOptionFunction
- Returns:
- the value of the property
-
getBarrierType
public BarrierType getBarrierType()
Gets the barrier type.- Returns:
- the value of the property, not null
-
getBarrierLevel
public double getBarrierLevel()
Gets the constant barrier level.- Returns:
- the value of the property
-
getRebate
public DoubleArray getRebate()
Gets the rebate.The rebate amounts for individual time layer. The size must be equal to
numberOfSteps + 1
- Returns:
- the value of the property, not null
-
getPayoffAtExpiryTrinomial
public DoubleArray getPayoffAtExpiryTrinomial(DoubleArray stateValue)
Description copied from interface:OptionFunction
Computes payoff at expiry for trinomial tree.The payoff values for individual nodes at expiry are computed from state values at the final layer. For example, the state values represent underlying prices of an option at respective nodes.
- Specified by:
getPayoffAtExpiryTrinomial
in interfaceOptionFunction
- Parameters:
stateValue
- the state values- Returns:
- the payoff at expiry
-
getNextOptionValues
public DoubleArray getNextOptionValues(double discountFactor, DoubleMatrix transitionProbability, DoubleArray stateValue, DoubleArray values, int i)
Description copied from interface:OptionFunction
Computes the option values in the intermediate nodes.Given a set of option values in the (i+1)-th layer, option values in the i-th layer are derived. The down, middle and up probabilities of the j-th lowest node are stored in the {i,0}, {i,1}, {i,2} components of
transitionProbability
, respectively.For an option with path-dependence, this method should be overridden.
- Specified by:
getNextOptionValues
in interfaceOptionFunction
- Parameters:
discountFactor
- the discount factor between the two layerstransitionProbability
- the transition probabilitystateValue
- the state valuevalues
- the option valuei
- the step number for which the next option values are computed- Returns:
- the option values in the i-th layer
-
-