Class SabrInterestRateParameters
- java.lang.Object
-
- com.opengamma.strata.pricer.model.SabrInterestRateParameters
-
- All Implemented Interfaces:
ParameterizedData,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class SabrInterestRateParameters extends Object implements ParameterizedData, org.joda.beans.ImmutableBean, Serializable
The volatility surface description under SABR model.This is used in interest rate modeling. Each SABR parameter is a
Surfacedefined by expiry and tenor.The implementation allows for shifted SABR model. The shift parameter is also
Surfacedefined by expiry and tenor.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublealpha(double expiry, double tenor)Calculates the alpha parameter for a pair of time to expiry and instrument tenor.doublebeta(double expiry, double tenor)Calculates the beta parameter for a pair of time to expiry and instrument tenor.booleanequals(Object obj)SurfacegetAlphaSurface()Gets the alpha (volatility level) surface.SurfacegetBetaSurface()Gets the beta (elasticity) surface.DayCountgetDayCount()Gets the day count used to calculate the expiry year fraction.SurfacegetNuSurface()Gets the nu (volatility of volatility) surface.doublegetParameter(int parameterIndex)Gets the value of the parameter at the specified index.intgetParameterCount()Gets the number of parameters.ParameterMetadatagetParameterMetadata(int parameterIndex)Gets the metadata of the parameter at the specified index.SurfacegetRhoSurface()Gets the rho (correlation) surface.SabrVolatilityFormulagetSabrVolatilityFormula()Gets the SABR volatility formula.SurfacegetShiftSurface()Gets the shift parameter of shifted SABR model.inthashCode()static org.joda.beans.TypedMetaBean<SabrInterestRateParameters>meta()The meta-bean forSabrInterestRateParameters.org.joda.beans.TypedMetaBean<SabrInterestRateParameters>metaBean()doublenu(double expiry, double tenor)Calculates the nu parameter for a pair of time to expiry and instrument tenor.static SabrInterestRateParametersof(Surface alphaSurface, Surface betaSurface, Surface rhoSurface, Surface nuSurface, Surface shiftSurface, SabrVolatilityFormula sabrFormula)Obtains an instance with shift from nodal surfaces and volatility function provider.static SabrInterestRateParametersof(Surface alphaSurface, Surface betaSurface, Surface rhoSurface, Surface nuSurface, SabrVolatilityFormula sabrFormula)Obtains an instance without shift from nodal surfaces and volatility function provider.doublerho(double expiry, double tenor)Calculates the rho parameter for a pair of time to expiry and instrument tenor.doubleshift(double expiry, double tenor)Calculates the shift parameter for a pair of time to expiry and instrument tenor.StringtoString()doublevolatility(double expiry, double tenor, double strike, double forward)Calculates the volatility for given expiry, tenor, strike and forward rate.ValueDerivativesvolatilityAdjoint(double expiry, double tenor, double strike, double forward)Calculates the volatility and associated sensitivities.SabrInterestRateParameterswithParameter(int parameterIndex, double newValue)Returns a copy of the data with the value at the specified index altered.SabrInterestRateParameterswithPerturbation(ParameterPerturbation perturbation)Returns a perturbed copy of the data.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData
findParameterIndex
-
-
-
-
Method Detail
-
of
public static SabrInterestRateParameters of(Surface alphaSurface, Surface betaSurface, Surface rhoSurface, Surface nuSurface, SabrVolatilityFormula sabrFormula)
Obtains an instance without shift from nodal surfaces and volatility function provider.Each surface is specified by an instance of
Surface, such asInterpolatedNodalSurface. The surfaces must contain the correct metadata:- The x-value type must be
ValueType.YEAR_FRACTION - The y-value type must be
ValueType.YEAR_FRACTION - The z-value type must be
ValueType.SABR_ALPHA,ValueType.SABR_BETA,ValueType.SABR_RHOorValueType.SABR_NU - The day count must be set in the additional information of the Alpha surface using
SurfaceInfoType.DAY_COUNT, if present on other surfaces it must match that on the Alpha
Surfaces.sabrParameterByExpiryTenor(String, DayCount, ValueType).- Parameters:
alphaSurface- the alpha surfacebetaSurface- the beta surfacerhoSurface- the rho surfacenuSurface- the nu surfacesabrFormula- the SABR formula- Returns:
SabrInterestRateParameters
- The x-value type must be
-
of
public static SabrInterestRateParameters of(Surface alphaSurface, Surface betaSurface, Surface rhoSurface, Surface nuSurface, Surface shiftSurface, SabrVolatilityFormula sabrFormula)
Obtains an instance with shift from nodal surfaces and volatility function provider.Each surface is specified by an instance of
Surface, such asInterpolatedNodalSurface. The surfaces must contain the correct metadata:- The x-value type must be
ValueType.YEAR_FRACTION - The y-value type must be
ValueType.YEAR_FRACTION - The z-value type must be
ValueType.SABR_ALPHA,ValueType.SABR_BETA,ValueType.SABR_RHOorValueType.SABR_NUas appropriate - The day count must be set in the additional information of the alpha surface using
SurfaceInfoType.DAY_COUNT, if present on other surfaces it must match that on the alpha
Suitable surface metadata can be created using
Surfaces.sabrParameterByExpiryTenor(String, DayCount, ValueType).- Parameters:
alphaSurface- the alpha surfacebetaSurface- the beta surfacerhoSurface- the rho surfacenuSurface- the nu surfaceshiftSurface- the shift surfacesabrFormula- the SABR formula- Returns:
SabrInterestRateParameters
- The x-value type must be
-
getDayCount
public DayCount getDayCount()
Gets the day count used to calculate the expiry year fraction.- Returns:
- the day count
-
getParameterCount
public int getParameterCount()
Description copied from interface:ParameterizedDataGets the number of parameters.This returns the number of parameters, which can be used to create a loop to access the other methods on this interface.
- Specified by:
getParameterCountin interfaceParameterizedData- Returns:
- the number of parameters
-
getParameter
public double getParameter(int parameterIndex)
Description copied from interface:ParameterizedDataGets the value of the parameter at the specified index.- Specified by:
getParameterin interfaceParameterizedData- Parameters:
parameterIndex- the zero-based index of the parameter to get- Returns:
- the value of the parameter
-
getParameterMetadata
public ParameterMetadata getParameterMetadata(int parameterIndex)
Description copied from interface:ParameterizedDataGets the metadata of the parameter at the specified index.If there is no specific parameter metadata, an empty instance will be returned.
- Specified by:
getParameterMetadatain interfaceParameterizedData- Parameters:
parameterIndex- the zero-based index of the parameter to get- Returns:
- the metadata of the parameter
-
withParameter
public SabrInterestRateParameters withParameter(int parameterIndex, double newValue)
Description copied from interface:ParameterizedDataReturns a copy of the data with the value at the specified index altered.This instance is immutable and unaffected by this method call.
- Specified by:
withParameterin interfaceParameterizedData- Parameters:
parameterIndex- the zero-based index of the parameter to getnewValue- the new value for the specified parameter- Returns:
- a parameterized data instance based on this with the specified parameter altered
-
withPerturbation
public SabrInterestRateParameters withPerturbation(ParameterPerturbation perturbation)
Description copied from interface:ParameterizedDataReturns a perturbed copy of the data.The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.
This instance is immutable and unaffected by this method call.
- Specified by:
withPerturbationin interfaceParameterizedData- Parameters:
perturbation- the perturbation to apply- Returns:
- a parameterized data instance based on this with the specified perturbation applied
-
alpha
public double alpha(double expiry, double tenor)Calculates the alpha parameter for a pair of time to expiry and instrument tenor.- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fraction- Returns:
- the alpha parameter
-
beta
public double beta(double expiry, double tenor)Calculates the beta parameter for a pair of time to expiry and instrument tenor.- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fraction- Returns:
- the beta parameter
-
rho
public double rho(double expiry, double tenor)Calculates the rho parameter for a pair of time to expiry and instrument tenor.- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fraction- Returns:
- the rho parameter
-
nu
public double nu(double expiry, double tenor)Calculates the nu parameter for a pair of time to expiry and instrument tenor.- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fraction- Returns:
- the nu parameter
-
shift
public double shift(double expiry, double tenor)Calculates the shift parameter for a pair of time to expiry and instrument tenor.- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fraction- Returns:
- the shift parameter
-
volatility
public double volatility(double expiry, double tenor, double strike, double forward)Calculates the volatility for given expiry, tenor, strike and forward rate.- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor as a year fractionstrike- the strikeforward- the forward- Returns:
- the volatility
-
volatilityAdjoint
public ValueDerivatives volatilityAdjoint(double expiry, double tenor, double strike, double forward)
Calculates the volatility and associated sensitivities.The derivatives are stored in an array with:
- [0] derivative with respect to the forward
- [1] derivative with respect to the forward 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
- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fractionstrike- the strikeforward- the forward- Returns:
- the volatility and associated derivatives
-
meta
public static org.joda.beans.TypedMetaBean<SabrInterestRateParameters> meta()
The meta-bean forSabrInterestRateParameters.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<SabrInterestRateParameters> metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getAlphaSurface
public Surface getAlphaSurface()
Gets the alpha (volatility level) surface.The first dimension is the expiry and the second the tenor.
- Returns:
- the value of the property, not null
-
getBetaSurface
public Surface getBetaSurface()
Gets the beta (elasticity) surface.The first dimension is the expiry and the second the tenor.
- Returns:
- the value of the property, not null
-
getRhoSurface
public Surface getRhoSurface()
Gets the rho (correlation) surface.The first dimension is the expiry and the second the tenor.
- Returns:
- the value of the property, not null
-
getNuSurface
public Surface getNuSurface()
Gets the nu (volatility of volatility) surface.The first dimension is the expiry and the second the tenor.
- Returns:
- the value of the property, not null
-
getShiftSurface
public Surface getShiftSurface()
Gets the shift parameter of shifted SABR model.The first dimension is the expiry and the second the tenor. The shift is set to be 0 unless specified.
- Returns:
- the value of the property, not null
-
getSabrVolatilityFormula
public SabrVolatilityFormula getSabrVolatilityFormula()
Gets the SABR volatility formula.- Returns:
- the value of the property, not null
-
-