Class SabrHaganNormalVolatilityFormula
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.volatility.smile.SabrHaganNormalVolatilityFormula
-
- All Implemented Interfaces:
SabrVolatilityFormula
public final class SabrHaganNormalVolatilityFormula extends Object implements SabrVolatilityFormula
Formulas related to the SABR implied normal volatility function.Only the "beta = 0" versions take strike/forward with negative values. The other formulas have a barrier at 0.
Reference: Hagan, P.; Kumar, D.; Lesniewski, A. & Woodward, D. "Managing smile risk", Wilmott Magazine, 2002, September, 84-108 Note: Formula references are related to the preprint version, e.g. available at https://www.researchgate.net/publication/235622441_Managing_Smile_Risk
-
-
Field Summary
Fields Modifier and Type Field Description static SabrHaganNormalVolatilityFormula
DEFAULT
Default implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueType
getVolatilityType()
Gets the type of volatility returned by theSabrVolatilityFormula.volatility(double, double, double, double, double, double, double)
method.double
volatility(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Calculates the volatility.ValueDerivatives
volatilityAdjoint(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Calculates volatility and the adjoint (volatility sensitivity to forward, strike and model parameters).double
volatilityBeta0(double forward, double strike, double timeToExpiry, double alpha, double rho, double nu)
Calculates the normal implied volatility for the special case of beta=0.ValueDerivatives
volatilityBeta0Adjoint(double forward, double strike, double timeToExpiry, double alpha, double rho, double nu)
Calculates the normal implied volatility and its derivatives (w.r.t.double
volatilityBetaNonZero(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Returns the volatility using the generic formula with barrier at 0.ValueDerivatives
volatilityBetaNonZeroAdjoint(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Returns the volatility using the generic formula with barrier at 0 at its derivatives.protected double
zetaOverXhat(double zeta, double rho)
Computes the ratio zeta over xHat.protected ValueDerivatives
zetaOverXhatAdjoint(double zeta, double rho)
Computes the ratio zeta over xHat and its derivatives.
-
-
-
Field Detail
-
DEFAULT
public static final SabrHaganNormalVolatilityFormula DEFAULT
Default implementation.
-
-
Method Detail
-
getVolatilityType
public ValueType getVolatilityType()
Description copied from interface:SabrVolatilityFormula
Gets the type of volatility returned by theSabrVolatilityFormula.volatility(double, double, double, double, double, double, double)
method.- Specified by:
getVolatilityType
in interfaceSabrVolatilityFormula
- Returns:
- the type
-
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 interfaceSabrVolatilityFormula
- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optionalpha
- the SABR alpha valuebeta
- the SABR beta valuerho
- the SABR rho valuenu
- the SABR nu value- Returns:
- the volatility
-
volatilityAdjoint
public ValueDerivatives volatilityAdjoint(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Description copied from interface:SabrVolatilityFormula
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.
- Specified by:
volatilityAdjoint
in interfaceSabrVolatilityFormula
- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optionalpha
- the SABR alpha valuebeta
- the SABR beta valuerho
- the SABR rho valuenu
- the SABR nu value- Returns:
- the volatility and associated derivatives
-
volatilityBetaNonZero
public double volatilityBetaNonZero(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Returns the volatility using the generic formula with barrier at 0. Formula B.69a in the preprint version- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optionalpha
- the SABR alpha valuebeta
- the SABR beta valuerho
- the SABR rho valuenu
- the SABR nu value- Returns:
- the volatility
-
volatilityBetaNonZeroAdjoint
public ValueDerivatives volatilityBetaNonZeroAdjoint(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Returns the volatility using the generic formula with barrier at 0 at its derivatives. Formula B.69a in the preprint version- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optionalpha
- the SABR alpha valuebeta
- the SABR beta valuerho
- the SABR rho valuenu
- the SABR nu value- Returns:
- the volatility
-
volatilityBeta0
public double volatilityBeta0(double forward, double strike, double timeToExpiry, double alpha, double rho, double nu)
Calculates the normal implied volatility for the special case of beta=0.The case beta=0 removes the barrier for forward/strike at 0 and lead to significant simplification in the implementation.
Formula B.70a in the preprint version. Note that the preprint version has a typo (missing the zeta/xhat term).
- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optionalpha
- the SABR alpha valuerho
- the SABR rho valuenu
- the SABR nu value- Returns:
- the volatility
-
volatilityBeta0Adjoint
public ValueDerivatives volatilityBeta0Adjoint(double forward, double strike, double timeToExpiry, double alpha, double rho, double nu)
Calculates the normal implied volatility and its derivatives (w.r.t. to forward, strike and model parameters) for the special case of beta=0.The case beta=0 removes the barrier for forward/strike at 0 and lead to significant simplification in the implementation.
- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optionalpha
- the SABR alpha valuerho
- the SABR rho valuenu
- the SABR nu value- Returns:
- the volatility and associated derivatives (forward, strike, alpha, beta, rho, nu)
-
zetaOverXhat
protected double zetaOverXhat(double zeta, double rho)
Computes the ratio zeta over xHat. Special treatment is required for zeta close to 0 (ATM).- Parameters:
zeta
- the zeta valuerho
- the rho parameter value- Returns:
- the ratio
-
zetaOverXhatAdjoint
protected ValueDerivatives zetaOverXhatAdjoint(double zeta, double rho)
Computes the ratio zeta over xHat and its derivatives. Special treatment is required for zeta close to 0 (ATM).- Parameters:
zeta
- the zeta valuerho
- the rho parameter value- Returns:
- the ratio
-
-