Class 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
    • 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 strike
        timeToExpiry - the time to expiry
        putCall - put or call
        numberOfSteps - number of steps
        barrierType - the barrier type
        barrierLevel - the barrier level
        rebate - the rebate
        Returns:
        the instance
      • getBarrierLevel

        public double getBarrierLevel​(int step)
        Obtains the barrier level for the time layer specified by step.
        Parameters:
        step - the step
        Returns:
        the barrier level
      • getRebate

        public double getRebate​(int step)
        Obtains the rebate for the time layer specified by step.
        Parameters:
        step - the step
        Returns:
        the rebate
      • 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 interface OptionFunction
        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 interface OptionFunction
        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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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 interface OptionFunction
        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 interface OptionFunction
        Parameters:
        discountFactor - the discount factor between the two layers
        transitionProbability - the transition probability
        stateValue - the state value
        values - the option value
        i - the step number for which the next option values are computed
        Returns:
        the option values in the i-th layer