Class NormalFormulaRepository


  • public final class NormalFormulaRepository
    extends Object
    The primary location for normal model formulas.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double delta​(double forward, double strike, double timeToExpiry, double normalVol, PutCall putCall)
      Computes the delta.
      static double gamma​(double forward, double strike, double timeToExpiry, double normalVol, PutCall putCall)
      Computes the gamma.
      static double impliedVolatility​(double optionPrice, double forward, double strike, double timeToExpiry, double initialNormalVol, double numeraire, PutCall putCall)
      Computes the implied volatility.
      static double impliedVolatilityFromBlackApproximated​(double forward, double strike, double timeToExpiry, double blackVolatility)
      Compute the implied volatility using an approximate explicit transformation formula.
      static ValueDerivatives impliedVolatilityFromBlackApproximatedAdjoint​(double forward, double strike, double timeToExpiry, double blackVolatility)
      Compute the implied volatility using an approximate explicit transformation formula and its derivative with respect to the input Black volatility.
      static double price​(double forward, double strike, double timeToExpiry, double normalVol, PutCall putCall)
      Computes the forward price.
      static ValueDerivatives priceAdjoint​(double forward, double strike, double timeToExpiry, double normalVol, double numeraire, PutCall putCall)
      Computes the price and first order derivatives.
      static double theta​(double forward, double strike, double timeToExpiry, double normalVol, PutCall putCall)
      Computes the theta.
      static double vega​(double forward, double strike, double timeToExpiry, double normalVol, PutCall putCall)
      Computes the vega.
    • Method Detail

      • price

        public static double price​(double forward,
                                   double strike,
                                   double timeToExpiry,
                                   double normalVol,
                                   PutCall putCall)
        Computes the forward price.

        Note that the 'numeraire' is a simple multiplier and is the responsibility of the caller.

        Parameters:
        forward - the forward value of the underlying
        strike - the strike
        timeToExpiry - the time to expiry
        normalVol - the normal volatility
        putCall - whether it is put or call
        Returns:
        the forward price
      • priceAdjoint

        public static ValueDerivatives priceAdjoint​(double forward,
                                                    double strike,
                                                    double timeToExpiry,
                                                    double normalVol,
                                                    double numeraire,
                                                    PutCall putCall)
        Computes the price and first order derivatives.

        The derivatives are stored in an array with:

        • [0] derivative with respect to the forward
        • [1] derivative with respect to the volatility
        • [2] derivative with respect to the strike
        Parameters:
        forward - the forward value of the underlying
        strike - the strike
        timeToExpiry - the time to expiry
        normalVol - the normal volatility
        numeraire - the numeraire
        putCall - whether it is put or call
        Returns:
        the price and associated derivatives
      • delta

        public static double delta​(double forward,
                                   double strike,
                                   double timeToExpiry,
                                   double normalVol,
                                   PutCall putCall)
        Computes the delta.

        Note that the 'numeraire' is a simple multiplier and is the responsibility of the caller.

        Parameters:
        forward - the forward value of the underlying
        strike - the strike
        timeToExpiry - the time to expiry
        normalVol - the normal volatility
        putCall - whether it is put or call
        Returns:
        the delta
      • gamma

        public static double gamma​(double forward,
                                   double strike,
                                   double timeToExpiry,
                                   double normalVol,
                                   PutCall putCall)
        Computes the gamma.

        Note that the 'numeraire' is a simple multiplier and is the responsibility of the caller.

        Parameters:
        forward - the forward value of the underlying
        strike - the strike
        timeToExpiry - the time to expiry
        normalVol - the normal volatility
        putCall - whether it is put or call
        Returns:
        the gamma
      • theta

        public static double theta​(double forward,
                                   double strike,
                                   double timeToExpiry,
                                   double normalVol,
                                   PutCall putCall)
        Computes the theta.

        Note that the 'numeraire' is a simple multiplier and is the responsibility of the caller.

        Parameters:
        forward - the forward value of the underlying
        strike - the strike
        timeToExpiry - the time to expiry
        normalVol - the normal volatility
        putCall - whether it is put or call
        Returns:
        the theta
      • vega

        public static double vega​(double forward,
                                  double strike,
                                  double timeToExpiry,
                                  double normalVol,
                                  PutCall putCall)
        Computes the vega.

        Note that the 'numeraire' is a simple multiplier and is the responsibility of the caller.

        Parameters:
        forward - the forward value of the underlying
        strike - the strike
        timeToExpiry - the time to expiry
        normalVol - the normal volatility
        putCall - whether it is put or call
        Returns:
        the vega
      • impliedVolatility

        public static double impliedVolatility​(double optionPrice,
                                               double forward,
                                               double strike,
                                               double timeToExpiry,
                                               double initialNormalVol,
                                               double numeraire,
                                               PutCall putCall)
        Computes the implied volatility.

        If the volatility data is not zero, it is used as a starting point for the volatility search.

        Note that the 'numeraire' is a simple multiplier and is the responsibility of the caller.

        Parameters:
        optionPrice - the price of the option
        forward - the forward value of the underlying
        strike - the strike
        timeToExpiry - the time to expiry
        initialNormalVol - the normal volatility used to start the search
        numeraire - the numeraire
        putCall - whether it is put or call
        Returns:
        the implied volatility
      • impliedVolatilityFromBlackApproximated

        public static double impliedVolatilityFromBlackApproximated​(double forward,
                                                                    double strike,
                                                                    double timeToExpiry,
                                                                    double blackVolatility)
        Compute the implied volatility using an approximate explicit transformation formula.

        Reference: Hagan, P. S. Volatility conversion calculator. Technical report, Bloomberg.

        Parameters:
        forward - the forward rate/price
        strike - the option strike
        timeToExpiry - the option time to maturity
        blackVolatility - the Black implied volatility
        Returns:
        the implied volatility
      • impliedVolatilityFromBlackApproximatedAdjoint

        public static ValueDerivatives impliedVolatilityFromBlackApproximatedAdjoint​(double forward,
                                                                                     double strike,
                                                                                     double timeToExpiry,
                                                                                     double blackVolatility)
        Compute the implied volatility using an approximate explicit transformation formula and its derivative with respect to the input Black volatility.

        Reference: Hagan, P. S. Volatility conversion calculator. Technical report, Bloomberg.

        Parameters:
        forward - the forward rate/price
        strike - the option strike
        timeToExpiry - the option time to maturity
        blackVolatility - the Black implied volatility
        Returns:
        the implied volatility and its derivative