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 classConstantContinuousSingleBarrierKnockoutFunction.MetaThe meta-bean forConstantContinuousSingleBarrierKnockoutFunction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)doublegetBarrierLevel()Gets the constant barrier level.doublegetBarrierLevel(int step)Obtains the barrier level for the time layer specified bystep.BarrierTypegetBarrierType()Gets the barrier type.DoubleArraygetNextOptionValues(double discountFactor, DoubleMatrix transitionProbability, DoubleArray stateValue, DoubleArray values, int i)Computes the option values in the intermediate nodes.intgetNumberOfSteps()Gets the number of time steps.DoubleArraygetPayoffAtExpiryTrinomial(DoubleArray stateValue)Computes payoff at expiry for trinomial tree.DoubleArraygetRebate()Gets the rebate.doublegetRebate(int step)Obtains the rebate for the time layer specified bystep.doublegetSign()Gets the sign.doublegetStrike()Gets the strike value.doublegetTimeToExpiry()Gets the time to expiry.inthashCode()static ConstantContinuousSingleBarrierKnockoutFunction.Metameta()The meta-bean forConstantContinuousSingleBarrierKnockoutFunction.ConstantContinuousSingleBarrierKnockoutFunction.MetametaBean()static ConstantContinuousSingleBarrierKnockoutFunctionof(double strike, double timeToExpiry, PutCall putCall, int numberOfSteps, BarrierType barrierType, double barrierLevel, DoubleArray rebate)Obtains an instance.StringtoString()-
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:
metaBeanin 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:
getTimeToExpiryin 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:
getNumberOfStepsin 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:OptionFunctionComputes 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:
getPayoffAtExpiryTrinomialin 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:OptionFunctionComputes 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:
getNextOptionValuesin 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
-
-