Class SabrParametersSwaptionVolatilities
- java.lang.Object
-
- com.opengamma.strata.pricer.swaption.SabrParametersSwaptionVolatilities
-
- All Implemented Interfaces:
MarketDataView,ParameterizedData,SabrSwaptionVolatilities,SwaptionVolatilities,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class SabrParametersSwaptionVolatilities extends Object implements SabrSwaptionVolatilities, org.joda.beans.ImmutableBean, Serializable
Volatility environment for swaptions in the SABR model.The volatility is represented in terms of SABR model parameters.
The
parameterSensitivity(),priceGamma()andpriceTheta()methods are not implemented.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSabrParametersSwaptionVolatilities.BuilderThe bean-builder forSabrParametersSwaptionVolatilities.static classSabrParametersSwaptionVolatilities.MetaThe meta-bean forSabrParametersSwaptionVolatilities.
-
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.static SabrParametersSwaptionVolatilities.Builderbuilder()Returns a builder used to create an instance of the bean.booleanequals(Object obj)<T> Optional<T>findData(MarketDataName<T> name)Finds the market data with the specified name.FixedFloatSwapConventiongetConvention()Gets the swap convention that the volatilities are to be used for.Optional<ImmutableList<DoubleArray>>getDataSensitivityAlpha()Gets the sensitivity of the Alpha parameters to the raw data used for calibration.Optional<ImmutableList<DoubleArray>>getDataSensitivityBeta()Gets the sensitivity of the Beta parameters to the raw data used for calibration.Optional<ImmutableList<DoubleArray>>getDataSensitivityNu()Gets the sensitivity of the Nu parameters to the raw data used for calibration.Optional<ImmutableList<DoubleArray>>getDataSensitivityRho()Gets the sensitivity of the Rho parameters to the raw data used for calibration.DayCountgetDayCount()Gets the day count used to calculate the expiry year fraction.SwaptionVolatilitiesNamegetName()Gets the name.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.SabrInterestRateParametersgetParameters()Gets the SABR model parameters.ZonedDateTimegetValuationDateTime()Gets the valuation date-time.inthashCode()static SabrParametersSwaptionVolatilities.Metameta()The meta-bean forSabrParametersSwaptionVolatilities.SabrParametersSwaptionVolatilities.MetametaBean()doublenu(double expiry, double tenor)Calculates the nu parameter for a pair of time to expiry and instrument tenor.static SabrParametersSwaptionVolatilitiesof(SwaptionVolatilitiesName name, FixedFloatSwapConvention convention, ZonedDateTime valuationDateTime, SabrInterestRateParameters parameters)Obtains an instance from the SABR model parameters and the date-time for which it is valid.CurrencyParameterSensitivitiesparameterSensitivity(PointSensitivities pointSensitivities)Calculates the parameter sensitivity.doubleprice(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Calculates the price.doublepriceDelta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Calculates the price delta.doublepriceGamma(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Calculates the price gamma.doublepriceTheta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Calculates the price theta.doublepriceVega(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Calculates the price vega.doublerelativeTime(ZonedDateTime dateTime)Converts a time and date to a relative year fraction.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 the specified time to expiry and instrument tenor.doubletenor(LocalDate startDate, LocalDate endDate)Calculates the tenor of the swap based on its start date and end date.SabrParametersSwaptionVolatilities.BuildertoBuilder()Returns a builder that allows this bean to be mutated.StringtoString()doublevolatility(double expiry, double tenor, double strike, double forwardRate)Calculates the volatility at the specified expiry.ValueDerivativesvolatilityAdjoint(double expiry, double tenor, double strike, double forward)Calculates the volatility and associated sensitivities.SabrParametersSwaptionVolatilitieswithParameter(int parameterIndex, double newValue)Returns a copy of the data with the value at the specified index altered.SabrParametersSwaptionVolatilitieswithPerturbation(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
-
Methods inherited from interface com.opengamma.strata.pricer.swaption.SabrSwaptionVolatilities
convertSwaptionSensitivity, getVolatilityType
-
Methods inherited from interface com.opengamma.strata.pricer.swaption.SwaptionVolatilities
getValuationDate, parameterSensitivity, volatility
-
-
-
-
Method Detail
-
of
public static SabrParametersSwaptionVolatilities of(SwaptionVolatilitiesName name, FixedFloatSwapConvention convention, ZonedDateTime valuationDateTime, SabrInterestRateParameters parameters)
Obtains an instance from the SABR model parameters and the date-time for which it is valid.- Parameters:
name- the nameconvention- the swap convention that the volatilities are to be used forvaluationDateTime- the valuation date-timeparameters- the SABR model parameters- Returns:
- the volatilities
-
getDayCount
public DayCount getDayCount()
Gets the day count used to calculate the expiry year fraction.- Returns:
- the day count
-
findData
public <T> Optional<T> findData(MarketDataName<T> name)
Description copied from interface:MarketDataViewFinds the market data with the specified name.This is most commonly used to find an underlying curve or surface by name. If the market data cannot be found, empty is returned.
- Specified by:
findDatain interfaceMarketDataView- Type Parameters:
T- the type of the market data value- Parameters:
name- the name to find- Returns:
- the market data value, empty if not found
-
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 SabrParametersSwaptionVolatilities 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- Specified by:
withParameterin interfaceSabrSwaptionVolatilities- Specified by:
withParameterin interfaceSwaptionVolatilities- 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 SabrParametersSwaptionVolatilities 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- Specified by:
withPerturbationin interfaceSabrSwaptionVolatilities- Specified by:
withPerturbationin interfaceSwaptionVolatilities- Parameters:
perturbation- the perturbation to apply- Returns:
- a parameterized data instance based on this with the specified perturbation applied
-
volatility
public double volatility(double expiry, double tenor, double strike, double forwardRate)Description copied from interface:SwaptionVolatilitiesCalculates the volatility at the specified expiry.This relies on expiry supplied by
SwaptionVolatilities.relativeTime(ZonedDateTime). This relies on tenor supplied bySwaptionVolatilities.tenor(LocalDate, LocalDate).- Specified by:
volatilityin interfaceSwaptionVolatilities- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fractionstrike- the option strike rateforwardRate- the forward rate of the underlying swap- Returns:
- the volatility
-
volatilityAdjoint
public ValueDerivatives volatilityAdjoint(double expiry, double tenor, double strike, double forward)
Description copied from interface:SabrSwaptionVolatilitiesCalculates 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
- Specified by:
volatilityAdjointin interfaceSabrSwaptionVolatilities- 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 sensitivities
-
alpha
public double alpha(double expiry, double tenor)Description copied from interface:SabrSwaptionVolatilitiesCalculates the alpha parameter for a pair of time to expiry and instrument tenor.- Specified by:
alphain interfaceSabrSwaptionVolatilities- 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)Description copied from interface:SabrSwaptionVolatilitiesCalculates the beta parameter for a pair of time to expiry and instrument tenor.- Specified by:
betain interfaceSabrSwaptionVolatilities- 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)Description copied from interface:SabrSwaptionVolatilitiesCalculates the rho parameter for a pair of time to expiry and instrument tenor.- Specified by:
rhoin interfaceSabrSwaptionVolatilities- 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)Description copied from interface:SabrSwaptionVolatilitiesCalculates the nu parameter for a pair of time to expiry and instrument tenor.- Specified by:
nuin interfaceSabrSwaptionVolatilities- 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)Description copied from interface:SabrSwaptionVolatilitiesCalculates the shift parameter for the specified time to expiry and instrument tenor.- Specified by:
shiftin interfaceSabrSwaptionVolatilities- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fraction- Returns:
- the shift parameter
-
parameterSensitivity
public CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
Description copied from interface:SwaptionVolatilitiesCalculates the parameter sensitivity.This computes the
CurrencyParameterSensitivitiesassociated with thePointSensitivities. This corresponds to the projection of the point sensitivity to the internal parameters representation.- Specified by:
parameterSensitivityin interfaceSwaptionVolatilities- Parameters:
pointSensitivities- the point sensitivities- Returns:
- the sensitivity to the underlying parameters
-
price
public double price(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Description copied from interface:SwaptionVolatilitiesCalculates the price.This relies on expiry supplied by
SwaptionVolatilities.relativeTime(ZonedDateTime). This relies on tenor supplied bySwaptionVolatilities.tenor(LocalDate, LocalDate). This relies on volatility supplied bySwaptionVolatilities.volatility(double, double, double, double).- Specified by:
pricein interfaceSwaptionVolatilities- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fractionputCall- whether the option is put or callstrike- the option strike rateforward- the forward rate of the underlying swapvolatility- the volatility- Returns:
- the price
-
priceDelta
public double priceDelta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Description copied from interface:SwaptionVolatilitiesCalculates the price delta.This is the forward driftless delta.
This relies on expiry supplied by
SwaptionVolatilities.relativeTime(ZonedDateTime). This relies on tenor supplied bySwaptionVolatilities.tenor(LocalDate, LocalDate). This relies on volatility supplied bySwaptionVolatilities.volatility(double, double, double, double).- Specified by:
priceDeltain interfaceSwaptionVolatilities- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fractionputCall- whether the option is put or callstrike- the option strike rateforward- the forward rate of the underlying swapvolatility- the volatility- Returns:
- the delta
-
priceGamma
public double priceGamma(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Description copied from interface:SwaptionVolatilitiesCalculates the price gamma.This is the second order sensitivity of the forward option value to the forward.
This relies on expiry supplied by
SwaptionVolatilities.relativeTime(ZonedDateTime). This relies on tenor supplied bySwaptionVolatilities.tenor(LocalDate, LocalDate). This relies on volatility supplied bySwaptionVolatilities.volatility(double, double, double, double).- Specified by:
priceGammain interfaceSwaptionVolatilities- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fractionputCall- whether the option is put or callstrike- the option strike rateforward- the forward rate of the underlying swapvolatility- the volatility- Returns:
- the gamma
-
priceTheta
public double priceTheta(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Description copied from interface:SwaptionVolatilitiesCalculates the price theta.This is the driftless sensitivity of the present value to a change in time to maturity.
This relies on expiry supplied by
SwaptionVolatilities.relativeTime(ZonedDateTime). This relies on tenor supplied bySwaptionVolatilities.tenor(LocalDate, LocalDate). This relies on volatility supplied bySwaptionVolatilities.volatility(double, double, double, double).- Specified by:
priceThetain interfaceSwaptionVolatilities- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fractionputCall- whether the option is put or callstrike- the option strike rateforward- the forward rate of the underlying swapvolatility- the volatility- Returns:
- the theta
-
priceVega
public double priceVega(double expiry, double tenor, PutCall putCall, double strike, double forward, double volatility)Description copied from interface:SwaptionVolatilitiesCalculates the price vega.This is the sensitivity of the option forward price to the implied volatility.
This relies on expiry supplied by
SwaptionVolatilities.relativeTime(ZonedDateTime). This relies on tenor supplied bySwaptionVolatilities.tenor(LocalDate, LocalDate). This relies on volatility supplied bySwaptionVolatilities.volatility(double, double, double, double).- Specified by:
priceVegain interfaceSwaptionVolatilities- Parameters:
expiry- the time to expiry as a year fractiontenor- the tenor of the instrument as a year fractionputCall- whether the option is put or callstrike- the option strike rateforward- the forward rate of the underlying swapvolatility- the volatility- Returns:
- the vega
-
relativeTime
public double relativeTime(ZonedDateTime dateTime)
Description copied from interface:SwaptionVolatilitiesConverts a time and date to a relative year fraction.When the date is after the valuation date (and potentially time), the returned number is negative.
- Specified by:
relativeTimein interfaceSwaptionVolatilities- Parameters:
dateTime- the date-time to find the relative year fraction of- Returns:
- the relative year fraction
-
tenor
public double tenor(LocalDate startDate, LocalDate endDate)
Description copied from interface:SwaptionVolatilitiesCalculates the tenor of the swap based on its start date and end date.- Specified by:
tenorin interfaceSwaptionVolatilities- Parameters:
startDate- the start dateendDate- the end date- Returns:
- the tenor
-
meta
public static SabrParametersSwaptionVolatilities.Meta meta()
The meta-bean forSabrParametersSwaptionVolatilities.- Returns:
- the meta-bean, not null
-
builder
public static SabrParametersSwaptionVolatilities.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public SabrParametersSwaptionVolatilities.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getName
public SwaptionVolatilitiesName getName()
Gets the name.- Specified by:
getNamein interfaceSwaptionVolatilities- Returns:
- the value of the property, not null
-
getConvention
public FixedFloatSwapConvention getConvention()
Gets the swap convention that the volatilities are to be used for.- Specified by:
getConventionin interfaceSwaptionVolatilities- Returns:
- the value of the property, not null
-
getValuationDateTime
public ZonedDateTime getValuationDateTime()
Gets the valuation date-time.The volatilities are calibrated for this date-time.
- Specified by:
getValuationDateTimein interfaceSwaptionVolatilities- Returns:
- the value of the property, not null
-
getParameters
public SabrInterestRateParameters getParameters()
Gets the SABR model parameters.Each model parameter of SABR model is a surface. The x-value of the surface is the expiry, as a year fraction. The y-value of the surface is the swap tenor, as a year fraction rounded to the month.
- Returns:
- the value of the property, not null
-
getDataSensitivityAlpha
public Optional<ImmutableList<DoubleArray>> getDataSensitivityAlpha()
Gets the sensitivity of the Alpha parameters to the raw data used for calibration.The order of the sensitivities have to be coherent with the surface parameter metadata.
- Returns:
- the optional value of the property, not null
-
getDataSensitivityBeta
public Optional<ImmutableList<DoubleArray>> getDataSensitivityBeta()
Gets the sensitivity of the Beta parameters to the raw data used for calibration.The order of the sensitivities have to be coherent with the surface parameter metadata.
- Returns:
- the optional value of the property, not null
-
getDataSensitivityRho
public Optional<ImmutableList<DoubleArray>> getDataSensitivityRho()
Gets the sensitivity of the Rho parameters to the raw data used for calibration.The order of the sensitivities have to be coherent with the surface parameter metadata.
- Returns:
- the optional value of the property, not null
-
getDataSensitivityNu
public Optional<ImmutableList<DoubleArray>> getDataSensitivityNu()
Gets the sensitivity of the Nu parameters to the raw data used for calibration.The order of the sensitivities have to be coherent with the surface parameter metadata.
- Returns:
- the optional value of the property, not null
-
toBuilder
public SabrParametersSwaptionVolatilities.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-