Class VolatilityFunctionProvider<T extends SmileModelData>

    • Constructor Detail

      • VolatilityFunctionProvider

        public VolatilityFunctionProvider()
    • Method Detail

      • volatility

        public abstract double volatility​(double forward,
                                          double strike,
                                          double timeToExpiry,
                                          T data)
        Calculates the volatility.
        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
      • volatilityAdjoint

        public ValueDerivatives volatilityAdjoint​(double forward,
                                                  double strike,
                                                  double timeToExpiry,
                                                  T data)
        Calculates volatility and the adjoint (volatility sensitivity to forward, strike and model parameters).

        By default the derivatives are computed by central finite difference approximation. This should be overridden in each subclass.

        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 and associated derivatives
      • volatilityAdjoint2

        public abstract double volatilityAdjoint2​(double forward,
                                                  double strike,
                                                  double timeToExpiry,
                                                  T data,
                                                  double[] volatilityD,
                                                  double[][] volatilityD2)
        Computes the first and second order derivatives of the volatility.

        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, then followed by model parameters. Thus the length of the array should be 2 + (number of model parameters).

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

        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
        volatilityD - the array used to return the first order derivative
        volatilityD2 - the array of array used to return the second order derivative
        Returns:
        the volatility