Class SabrParameters

  • All Implemented Interfaces:
    ParameterizedData, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class SabrParameters
    extends Object
    implements ParameterizedData, org.joda.beans.ImmutableBean, Serializable
    The volatility surface description under SABR model.

    This is used in interest rate modeling. Each SABR parameter is a Curve defined by expiry.

    The implementation allows for shifted SABR model. The shift parameter is also Curve defined by expiry.

    See Also:
    Serialized Form
    • Method Detail

      • getDayCount

        public DayCount getDayCount()
        Gets the day count used to calculate the expiry year fraction.
        Returns:
        the day count
      • 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 SabrParameters 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
        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 SabrParameters 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
        Parameters:
        perturbation - the perturbation to apply
        Returns:
        a parameterized data instance based on this with the specified perturbation applied
      • alpha

        public double alpha​(double expiry)
        Calculates the alpha parameter for time to expiry.
        Parameters:
        expiry - the time to expiry as a year fraction
        Returns:
        the alpha parameter
      • beta

        public double beta​(double expiry)
        Calculates the beta parameter for time to expiry.
        Parameters:
        expiry - the time to expiry as a year fraction
        Returns:
        the beta parameter
      • rho

        public double rho​(double expiry)
        Calculates the rho parameter for time to expiry.
        Parameters:
        expiry - the time to expiry as a year fraction
        Returns:
        the rho parameter
      • nu

        public double nu​(double expiry)
        Calculates the nu parameter for time to expiry.
        Parameters:
        expiry - the time to expiry as a year fraction
        Returns:
        the nu parameter
      • shift

        public double shift​(double expiry)
        Calculates the shift parameter for time to expiry.
        Parameters:
        expiry - the time to expiry as a year fraction
        Returns:
        the shift parameter
      • volatility

        public double volatility​(double expiry,
                                 double strike,
                                 double forward)
        Calculates the volatility for given expiry, strike and forward rate.
        Parameters:
        expiry - the time to expiry as a year fraction
        strike - the strike
        forward - the forward
        Returns:
        the volatility
      • volatilityAdjoint

        public ValueDerivatives volatilityAdjoint​(double expiry,
                                                  double strike,
                                                  double forward)
        Calculates the volatility and associated sensitivities.

        The derivatives are stored in an array with:

        • [0] derivative with respect to the forward
        • [1] derivative with respect to the forward strike
        • [2] derivative with respect to the alpha
        • [3] derivative with respect to the beta
        • [4] derivative with respect to the rho
        • [5] derivative with respect to the nu
        Parameters:
        expiry - the time to expiry as a year fraction
        strike - the strike
        forward - the forward
        Returns:
        the volatility and associated derivatives
      • meta

        public static org.joda.beans.TypedMetaBean<SabrParameters> meta()
        The meta-bean for SabrParameters.
        Returns:
        the meta-bean, not null
      • metaBean

        public org.joda.beans.TypedMetaBean<SabrParameters> metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getAlphaCurve

        public Curve getAlphaCurve()
        Gets the alpha (volatility level) curve.

        The x value of the curve is the expiry.

        Returns:
        the value of the property, not null
      • getBetaCurve

        public Curve getBetaCurve()
        Gets the beta (elasticity) curve.

        The x value of the curve is the expiry.

        Returns:
        the value of the property, not null
      • getRhoCurve

        public Curve getRhoCurve()
        Gets the rho (correlation) curve.

        The x value of the curve is the expiry.

        Returns:
        the value of the property, not null
      • getNuCurve

        public Curve getNuCurve()
        Gets the nu (volatility of volatility) curve.

        The x value of the curve is the expiry.

        Returns:
        the value of the property, not null
      • getShiftCurve

        public Curve getShiftCurve()
        Gets the shift parameter of shifted SABR model.

        The x value of the curve is the expiry. The shift is set to be 0 unless specified.

        Returns:
        the value of the property, not null
      • getSabrVolatilityFormula

        public SabrVolatilityFormula getSabrVolatilityFormula()
        Gets the SABR volatility formula.
        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object