Class SabrHaganVolatilityFunctionProvider

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

    public final class SabrHaganVolatilityFunctionProvider
    extends VolatilityFunctionProvider<SabrFormulaData>
    implements SabrVolatilityFormula, org.joda.beans.ImmutableBean, Serializable
    The Hagan SABR volatility function provider.

    This class provides the functions of volatility and its sensitivity to the SABR model parameters based on the original Hagan SABR formula.

    Reference: Hagan, P.; Kumar, D.; Lesniewski, A. & Woodward, D. "Managing smile risk", Wilmott Magazine, 2002, September, 84-108

    OpenGamma documentation: SABR Implementation, OpenGamma documentation n. 33, April 2016.

    See Also:
    Serialized Form
    • Method Detail

      • volatility

        public double volatility​(double forward,
                                 double strike,
                                 double timeToExpiry,
                                 SabrFormulaData data)
        Description copied from class: VolatilityFunctionProvider
        Calculates the volatility.
        Specified by:
        volatility in class VolatilityFunctionProvider<SabrFormulaData>
        Parameters:
        forward - the forward value of the underlying
        strike - the strike value of the option
        timeToExpiry - the time to expiry of the option
        data - the model data
        Returns:
        the volatility
      • volatility

        public double volatility​(double forward,
                                 double strike,
                                 double timeToExpiry,
                                 double alpha,
                                 double beta,
                                 double rho,
                                 double nu)
        Description copied from interface: SabrVolatilityFormula
        Calculates the volatility.
        Specified by:
        volatility in interface SabrVolatilityFormula
        Parameters:
        forward - the forward value of the underlying
        strike - the strike value of the option
        timeToExpiry - the time to expiry of the option
        alpha - the SABR alpha value
        beta - the SABR beta value
        rho - the SABR rho value
        nu - the SABR nu value
        Returns:
        the volatility
      • volatilityAdjoint

        public ValueDerivatives volatilityAdjoint​(double forward,
                                                  double strike,
                                                  double timeToExpiry,
                                                  SabrFormulaData data)
        Computes the implied volatility in the SABR model and its derivatives.

        The derivatives are stored in an array with:

        • [0] derivative with respect to the forward
        • [1] derivative with respect to the 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
        Overrides:
        volatilityAdjoint in class VolatilityFunctionProvider<SabrFormulaData>
        Parameters:
        forward - the forward value of the underlying
        strike - the strike value of the option
        timeToExpiry - the time to expiry of the option
        data - the SABR data
        Returns:
        the volatility and associated derivatives
      • volatilityAdjoint

        public ValueDerivatives volatilityAdjoint​(double forward,
                                                  double strike,
                                                  double timeToExpiry,
                                                  double alpha,
                                                  double beta,
                                                  double rho,
                                                  double nu)
        Computes the implied volatility in the SABR model and its derivatives.

        The derivatives are stored in an array with:

        • [0] derivative with respect to the forward
        • [1] derivative with respect to the 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
        Specified by:
        volatilityAdjoint in interface SabrVolatilityFormula
        Parameters:
        forward - the forward value of the underlying
        strike - the strike value of the option
        timeToExpiry - the time to expiry of the option
        alpha - the SABR alpha value
        beta - the SABR beta value
        rho - the SABR rho value
        nu - the SABR nu value
        Returns:
        the volatility and associated derivatives
      • volatilityAdjoint2

        public double volatilityAdjoint2​(double forward,
                                         double strike,
                                         double timeToExpiry,
                                         SabrFormulaData data,
                                         double[] volatilityD,
                                         double[][] volatilityD2)
        Computes the first and second order derivatives of the Black implied volatility in the SABR model.

        The first derivative values will be stored in the input array volatilityD The array contains, [0] Derivative w.r.t the forward, [1] the derivative w.r.t the strike, [2] the derivative w.r.t. to alpha, [3] the derivative w.r.t. to beta, [4] the derivative w.r.t. to rho, and [5] the derivative w.r.t. to nu. Thus the length of the array should be 6.

        The second derivative values will be stored in the input array volatilityD2. Only the second order derivative with respect to the forward and strike are implemented. The array contains [0][0] forward-forward; [0][1] forward-strike; [1][1] strike-strike. Thus the size should be 2 x 2.

        Around ATM, a first order expansion is used to due to some 0/0-type indetermination. The second order derivative produced is poor around ATM.

        Specified by:
        volatilityAdjoint2 in class VolatilityFunctionProvider<SabrFormulaData>
        Parameters:
        forward - the forward value of the underlying
        strike - the strike value of the option
        timeToExpiry - the time to expiry of the option
        data - the SABR data.
        volatilityD - the array used to return the first order derivative
        volatilityD2 - the array of array used to return the second order derivative
        Returns:
        the Black implied volatility
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • meta

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