Class SabrInterestRateParameters

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

    public final class SabrInterestRateParameters
    extends java.lang.Object
    implements ParameterizedData, ImmutableBean, java.io.Serializable
    The volatility surface description under SABR model.

    This is used in interest rate modeling. Each SABR parameter is a Surface defined by expiry and tenor.

    The implementation allows for shifted SABR model. The shift parameter is also Surface defined by expiry and tenor.

    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 SabrInterestRateParameters 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 SabrInterestRateParameters 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,
                            double tenor)
        Calculates the alpha parameter for a pair of time to expiry and instrument tenor.
        Parameters:
        expiry - the time to expiry as a year fraction
        tenor - the tenor of the instrument as a year fraction
        Returns:
        the alpha parameter
      • beta

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

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

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

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

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

        public ValueDerivatives volatilityAdjoint​(double expiry,
                                                  double tenor,
                                                  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
        tenor - the tenor of the instrument as a year fraction
        strike - the strike
        forward - the forward
        Returns:
        the volatility and associated derivatives
      • getAlphaSurface

        public Surface getAlphaSurface()
        Gets the alpha (volatility level) surface.

        The first dimension is the expiry and the second the tenor.

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

        public Surface getBetaSurface()
        Gets the beta (elasticity) surface.

        The first dimension is the expiry and the second the tenor.

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

        public Surface getRhoSurface()
        Gets the rho (correlation) surface.

        The first dimension is the expiry and the second the tenor.

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

        public Surface getNuSurface()
        Gets the nu (volatility of volatility) surface.

        The first dimension is the expiry and the second the tenor.

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

        public Surface getShiftSurface()
        Gets the shift parameter of shifted SABR model.

        The first dimension is the expiry and the second the tenor. 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
      • 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