Class InterpolatedStrikeSmileDeltaTermStructure

  • All Implemented Interfaces:
    ParameterizedData, SmileDeltaTermStructure, java.io.Serializable, Bean, ImmutableBean

    public final class InterpolatedStrikeSmileDeltaTermStructure
    extends java.lang.Object
    implements SmileDeltaTermStructure, ParameterizedData, ImmutableBean, java.io.Serializable
    An interpolated term structure of smiles as used in Forex market.

    The term structure defined here is composed of smile descriptions at different times. The data of each smile contains delta and volatility in SmileDeltaParameters. The delta values must be common to all of the smiles.

    Time interpolation and extrapolation are used to obtain a smile for the objective time. Strike interpolation and extrapolation are used in the expiry-strike space where the delta values are converted to strikes using the Black formula.

    The default for the time direction is time squire interpolation with flat extrapolation. The default for the strike direction is linear interpolation with flat extrapolation.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(java.util.List<SmileDeltaParameters> volatilityTerm,
                                                                   DayCount dayCount)
        Obtains volatility term structure from a set of smile descriptions.

        The time dimension will use 'TimeSquare' interpolation with flat extrapolation. The strike dimension will use 'Linear' interpolation with flat extrapolation.

        Parameters:
        volatilityTerm - the volatility descriptions
        dayCount - the day count used for the expiry year-fraction
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(java.util.List<SmileDeltaParameters> volatilityTerm,
                                                                   DayCount dayCount,
                                                                   CurveInterpolator strikeInterpolator,
                                                                   CurveExtrapolator strikeExtrapolatorLeft,
                                                                   CurveExtrapolator strikeExtrapolatorRight)
        Obtains volatility term structure from a set of smile descriptions with strike interpolator and extrapolators specified.

        The time dimension will use 'TimeSquare' interpolation with flat extrapolation.

        Parameters:
        volatilityTerm - the volatility descriptions
        dayCount - the day count used for the expiry year-fraction
        strikeInterpolator - interpolator used in the strike dimension
        strikeExtrapolatorLeft - left extrapolator used in the strike dimension
        strikeExtrapolatorRight - right extrapolator used in the strike dimension
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(java.util.List<SmileDeltaParameters> volatilityTerm,
                                                                   DayCount dayCount,
                                                                   CurveExtrapolator timeExtrapolatorLeft,
                                                                   CurveInterpolator timeInterpolator,
                                                                   CurveExtrapolator timeExtrapolatorRight,
                                                                   CurveExtrapolator strikeExtrapolatorLeft,
                                                                   CurveInterpolator strikeInterpolator,
                                                                   CurveExtrapolator strikeExtrapolatorRight)
        Obtains volatility term structure from a set of smile descriptions with interpolator and extrapolators fully specified.
        Parameters:
        volatilityTerm - the volatility descriptions
        dayCount - the day count used for the expiry year-fraction
        timeExtrapolatorLeft - left extrapolator used in the time dimension
        timeInterpolator - interpolator used in the time dimension
        timeExtrapolatorRight - right extrapolator used in the time dimension
        strikeExtrapolatorLeft - left extrapolator used in the strike dimension
        strikeInterpolator - interpolator used in the strike dimension
        strikeExtrapolatorRight - right extrapolator used in the strike dimension
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(DoubleArray expiries,
                                                                   DoubleArray delta,
                                                                   DoubleMatrix volatility,
                                                                   DayCount dayCount)
        Obtains volatility term structure from expiry times, delta values and volatilities.

        The market date consists of time to expiry, delta and volatility. The delta must be positive and sorted in ascending order. The range of delta is common to all time to expiry.

        volatility should be n * (2 * m + 1), where n is the length of expiry and m is the length of delta.

        The time dimension will use 'TimeSquare' interpolation with flat extrapolation. The strike dimension will use 'Linear' interpolation with flat extrapolation.

        Parameters:
        expiries - the expiry times of individual volatility smiles
        delta - the delta values
        volatility - the volatilities
        dayCount - the day count used for the expiry year-fraction
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(DoubleArray expiries,
                                                                   DoubleArray delta,
                                                                   DoubleMatrix volatility,
                                                                   DayCount dayCount,
                                                                   CurveInterpolator strikeInterpolator,
                                                                   CurveExtrapolator strikeExtrapolatorLeft,
                                                                   CurveExtrapolator strikeExtrapolatorRight)
        Obtains volatility term structure from expiry times, delta values and volatilities with strike interpolator and extrapolators specified.

        The market date consists of time to expiry, delta and volatility. The delta must be positive and sorted in ascending order. The range of delta is common to all time to expiry.

        volatility should be n * (2 * m + 1), where n is the length of expiry and m is the length of delta.

        The time dimension will use 'TimeSquare' interpolation with flat extrapolation.

        Parameters:
        expiries - the expiry times of individual volatility smiles
        delta - the delta values
        volatility - the volatilities
        dayCount - the day count used for the expiry year-fraction
        strikeInterpolator - interpolator used in the strike dimension
        strikeExtrapolatorLeft - left extrapolator used in the strike dimension
        strikeExtrapolatorRight - right extrapolator used in the strike dimension
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(DoubleArray expiries,
                                                                   DoubleArray delta,
                                                                   DoubleMatrix volatility,
                                                                   DayCount dayCount,
                                                                   CurveInterpolator timeInterpolator,
                                                                   CurveExtrapolator timeExtrapolatorLeft,
                                                                   CurveExtrapolator timeExtrapolatorRight,
                                                                   CurveInterpolator strikeInterpolator,
                                                                   CurveExtrapolator strikeExtrapolatorLeft,
                                                                   CurveExtrapolator strikeExtrapolatorRight)
        Obtains volatility term structure from expiry times, delta values and volatilities with interpolator and extrapolators fully specified.

        The market date consists of time to expiry, delta and volatility. The delta must be positive and sorted in ascending order. The range of delta is common to all time to expiry.

        volatility should be n * (2 * m + 1), where n is the length of expiry and m is the length of delta.

        Parameters:
        expiries - the expiry times of individual volatility smiles
        delta - the delta values
        volatility - the volatilities
        dayCount - the day count used for the expiry year-fraction
        timeInterpolator - interpolator used in the time dimension
        timeExtrapolatorLeft - left extrapolator used in the time dimension
        timeExtrapolatorRight - right extrapolator used in the time dimension
        strikeInterpolator - interpolator used in the strike dimension
        strikeExtrapolatorLeft - left extrapolator used in the strike dimension
        strikeExtrapolatorRight - right extrapolator used in the strike dimension
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(DoubleArray expiries,
                                                                   DoubleArray delta,
                                                                   DoubleArray atm,
                                                                   DoubleMatrix riskReversal,
                                                                   DoubleMatrix strangle,
                                                                   DayCount dayCount)
        Obtains volatility term structure from expiry times, delta values, ATM volatilities, risk reversal figures and strangle figures.

        The range of delta is common to all time to expiry. riskReversal and strangle should be n * m, and the length of atm should n, where n is the length of expiry and m is the length of delta.

        The time dimension will use 'TimeSquare' interpolation with flat extrapolation. The strike dimension will use 'Linear' interpolation with flat extrapolation.

        Parameters:
        expiries - the expiry times of individual volatility smiles
        delta - the delta values
        atm - the ATM volatilities
        riskReversal - the risk reversal figures
        strangle - the strangle figures
        dayCount - the day count used for the expiry year-fraction
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(DoubleArray expiries,
                                                                   DoubleArray delta,
                                                                   DoubleArray atm,
                                                                   DoubleMatrix riskReversal,
                                                                   DoubleMatrix strangle,
                                                                   DayCount dayCount,
                                                                   CurveInterpolator strikeInterpolator,
                                                                   CurveExtrapolator strikeExtrapolatorLeft,
                                                                   CurveExtrapolator strikeExtrapolatorRight)
        Obtains volatility term structure from expiry times, delta values, ATM volatilities, risk reversal figures and strangle figures with strike interpolator and extrapolators specified.

        The range of delta is common to all time to expiry. riskReversal and strangle should be n * m, and the length of atm should n, where n is the length of expiry and m is the length of delta.

        The time dimension will use 'TimeSquare' interpolation with flat extrapolation.

        Parameters:
        expiries - the expiry times of individual volatility smiles
        delta - the delta values
        atm - the ATM volatilities
        riskReversal - the risk reversal figures
        strangle - the strangle figures
        dayCount - the day count used for the expiry year-fraction
        strikeInterpolator - interpolator used in the strike dimension
        strikeExtrapolatorLeft - left extrapolator used in the strike dimension
        strikeExtrapolatorRight - right extrapolator used in the strike dimension
        Returns:
        the instance
      • of

        public static InterpolatedStrikeSmileDeltaTermStructure of​(DoubleArray expiries,
                                                                   DoubleArray delta,
                                                                   DoubleArray atm,
                                                                   DoubleMatrix riskReversal,
                                                                   DoubleMatrix strangle,
                                                                   DayCount dayCount,
                                                                   CurveInterpolator timeInterpolator,
                                                                   CurveExtrapolator timeExtrapolatorLeft,
                                                                   CurveExtrapolator timeExtrapolatorRight,
                                                                   CurveInterpolator strikeInterpolator,
                                                                   CurveExtrapolator strikeExtrapolatorLeft,
                                                                   CurveExtrapolator strikeExtrapolatorRight)
        Obtains volatility term structure from expiry times, delta values, ATM volatilities, risk reversal figures and strangle figures with interpolator and extrapolators fully specified.

        The range of delta is common to all time to expiry. riskReversal and strangle should be n * m, and the length of atm should n, where n is the length of expiry and m is the length of delta.

        Parameters:
        expiries - the expiry times of individual volatility smiles
        delta - the delta values
        atm - the ATM volatilities
        riskReversal - the risk reversal figures
        strangle - the strangle figures
        dayCount - the day count used for the expiry year-fraction
        timeInterpolator - interpolator used in the time dimension
        timeExtrapolatorLeft - left extrapolator used in the time dimension
        timeExtrapolatorRight - right extrapolator used in the time dimension
        strikeInterpolator - interpolator used in the strike dimension
        strikeExtrapolatorLeft - left extrapolator used in the strike dimension
        strikeExtrapolatorRight - right extrapolator used in the strike dimension
        Returns:
        the instance
      • getParameterCount

        public int getParameterCount()
        Description copied from interface: ParameterizedData
        Gets the number of parameters.

        This returns the number of parameters, which can be used to create a loop to access the other methods on this interface.

        Specified by:
        getParameterCount in interface ParameterizedData
        Returns:
        the number of parameters
      • getParameter

        public double getParameter​(int parameterIndex)
        Description copied from interface: ParameterizedData
        Gets the value of the parameter at the specified index.
        Specified by:
        getParameter in interface ParameterizedData
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        Returns:
        the value of the parameter
      • getParameterMetadata

        public ParameterMetadata getParameterMetadata​(int parameterIndex)
        Description copied from interface: ParameterizedData
        Gets the metadata of the parameter at the specified index.

        If there is no specific parameter metadata, an empty instance will be returned.

        Specified by:
        getParameterMetadata in interface ParameterizedData
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        Returns:
        the metadata of the parameter
      • withParameter

        public InterpolatedStrikeSmileDeltaTermStructure withParameter​(int parameterIndex,
                                                                       double newValue)
        Description copied from interface: ParameterizedData
        Returns a copy of the data with the value at the specified index altered.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withParameter in interface ParameterizedData
        Specified by:
        withParameter in interface SmileDeltaTermStructure
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        newValue - the new value for the specified parameter
        Returns:
        a parameterized data instance based on this with the specified parameter altered
      • withPerturbation

        public InterpolatedStrikeSmileDeltaTermStructure withPerturbation​(ParameterPerturbation perturbation)
        Description copied from interface: ParameterizedData
        Returns a perturbed copy of the data.

        The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withPerturbation in interface ParameterizedData
        Specified by:
        withPerturbation in interface SmileDeltaTermStructure
        Parameters:
        perturbation - the perturbation to apply
        Returns:
        a parameterized data instance based on this with the specified perturbation applied
      • volatility

        public double volatility​(double time,
                                 double strike,
                                 double forward)
        Description copied from interface: SmileDeltaTermStructure
        Calculates the volatility at a given time/strike/forward from the term structure.
        Specified by:
        volatility in interface SmileDeltaTermStructure
        Parameters:
        time - the time to expiry
        strike - the strike
        forward - the forward
        Returns:
        the volatility
      • smileAndSensitivitiesForExpiry

        public SmileAndBucketedSensitivities smileAndSensitivitiesForExpiry​(double expiry,
                                                                            DoubleArray volatilityAtTimeSensitivity)
        Description copied from interface: SmileDeltaTermStructure
        Calculates the smile at a given time and the sensitivities with respect to the volatility data points.
        Specified by:
        smileAndSensitivitiesForExpiry in interface SmileDeltaTermStructure
        Parameters:
        expiry - the time to expiry
        volatilityAtTimeSensitivity - the sensitivity to the volatilities of the smile at the given time
        Returns:
        the smile and sensitivities
      • getVolatilityTerm

        public com.google.common.collect.ImmutableList<SmileDeltaParameters> getVolatilityTerm()
        Gets the smile description at the different time to expiry. All item should have the same deltas.
        Specified by:
        getVolatilityTerm in interface SmileDeltaTermStructure
        Returns:
        the value of the property, not null
      • getTimeInterpolator

        public CurveInterpolator getTimeInterpolator()
        Gets the interpolator used in the time dimension.
        Returns:
        the value of the property, not null
      • getTimeExtrapolatorLeft

        public CurveExtrapolator getTimeExtrapolatorLeft()
        Gets the left extrapolator used in the time dimension.
        Returns:
        the value of the property, not null
      • getTimeExtrapolatorRight

        public CurveExtrapolator getTimeExtrapolatorRight()
        Gets the right extrapolator used in the time dimension.
        Returns:
        the value of the property, not null
      • getStrikeInterpolator

        public CurveInterpolator getStrikeInterpolator()
        Gets the interpolator used in the strike dimension.
        Returns:
        the value of the property, not null
      • getStrikeExtrapolatorLeft

        public CurveExtrapolator getStrikeExtrapolatorLeft()
        Gets the left extrapolator used in the strike dimension.
        Returns:
        the value of the property, not null
      • getStrikeExtrapolatorRight

        public CurveExtrapolator getStrikeExtrapolatorRight()
        Gets the right extrapolator used in the strike dimension.
        Returns:
        the value of the property, not null
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object