Class SabrHaganVolatilityFunctionProvider
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.volatility.smile.VolatilityFunctionProvider<SabrFormulaData>
-
- com.opengamma.strata.pricer.impl.volatility.smile.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
-
-
Field Summary
Fields Modifier and Type Field Description static SabrHaganVolatilityFunctionProvider
DEFAULT
Default implementation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
ValueType
getVolatilityType()
Gets the type of volatility returned by theSabrVolatilityFormula.volatility(double, double, double, double, double, double, double)
method.int
hashCode()
static org.joda.beans.TypedMetaBean<SabrHaganVolatilityFunctionProvider>
meta()
The meta-bean forSabrHaganVolatilityFunctionProvider
.org.joda.beans.TypedMetaBean<SabrHaganVolatilityFunctionProvider>
metaBean()
String
toString()
double
volatility(double forward, double strike, double timeToExpiry, double alpha, double beta, double rho, double nu)
Calculates the volatility.double
volatility(double forward, double strike, double timeToExpiry, SabrFormulaData data)
Calculates the volatility.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.ValueDerivatives
volatilityAdjoint(double forward, double strike, double timeToExpiry, SabrFormulaData data)
Computes the implied volatility in the SABR model and its derivatives.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.
-
-
-
Field Detail
-
DEFAULT
public static final SabrHaganVolatilityFunctionProvider 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, SabrFormulaData data)
Description copied from class:VolatilityFunctionProvider
Calculates the volatility.- Specified by:
volatility
in classVolatilityFunctionProvider<SabrFormulaData>
- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optiondata
- 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 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, 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 classVolatilityFunctionProvider<SabrFormulaData>
- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optiondata
- 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 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
-
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 classVolatilityFunctionProvider<SabrFormulaData>
- Parameters:
forward
- the forward value of the underlyingstrike
- the strike value of the optiontimeToExpiry
- the time to expiry of the optiondata
- the SABR data.volatilityD
- the array used to return the first order derivativevolatilityD2
- the array of array used to return the second order derivative- Returns:
- the Black implied volatility
-
meta
public static org.joda.beans.TypedMetaBean<SabrHaganVolatilityFunctionProvider> meta()
The meta-bean forSabrHaganVolatilityFunctionProvider
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<SabrHaganVolatilityFunctionProvider> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
-