Class SabrParametersIborCapletFloorletVolatilities
- java.lang.Object
-
- com.opengamma.strata.pricer.capfloor.SabrParametersIborCapletFloorletVolatilities
-
- All Implemented Interfaces:
MarketDataView
,ParameterizedData
,BlackSabrIborCapletFloorletVolatilities
,IborCapletFloorletVolatilities
,SabrIborCapletFloorletVolatilities
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class SabrParametersIborCapletFloorletVolatilities extends Object implements BlackSabrIborCapletFloorletVolatilities, org.joda.beans.ImmutableBean, Serializable
Volatility environment for Ibor caplet/floorlet in the SABR model.The volatility is represented in terms of SABR model parameters.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SabrParametersIborCapletFloorletVolatilities.Builder
The bean-builder forSabrParametersIborCapletFloorletVolatilities
.static class
SabrParametersIborCapletFloorletVolatilities.Meta
The meta-bean forSabrParametersIborCapletFloorletVolatilities
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
alpha(double expiry)
Calculates the alpha parameter for a pair of time to expiry.double
beta(double expiry)
Calculates the beta parameter for a pair of time to expiry.static SabrParametersIborCapletFloorletVolatilities.Builder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
<T> Optional<T>
findData(MarketDataName<T> name)
Finds the market data with the specified name.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.DayCount
getDayCount()
Gets the day count used to calculate the expiry year fraction.IborIndex
getIndex()
Gets the Ibor index.IborCapletFloorletVolatilitiesName
getName()
Gets the name.double
getParameter(int parameterIndex)
Gets the value of the parameter at the specified index.int
getParameterCount()
Gets the number of parameters.ParameterMetadata
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.SabrParameters
getParameters()
Gets the SABR model parameters.ZonedDateTime
getValuationDateTime()
Gets the valuation date-time.int
hashCode()
static SabrParametersIborCapletFloorletVolatilities.Meta
meta()
The meta-bean forSabrParametersIborCapletFloorletVolatilities
.SabrParametersIborCapletFloorletVolatilities.Meta
metaBean()
double
nu(double expiry)
Calculates the nu parameter for a pair of time to expiry.static SabrParametersIborCapletFloorletVolatilities
of(IborCapletFloorletVolatilitiesName name, IborIndex index, ZonedDateTime valuationDateTime, SabrParameters parameters)
Obtains an instance from the SABR model parameters and the date-time for which it is valid.CurrencyParameterSensitivities
parameterSensitivity(PointSensitivities pointSensitivities)
Calculates the parameter sensitivity.double
price(double expiry, PutCall putCall, double strike, double forward, double volatility)
Calculates the price.double
priceDelta(double expiry, PutCall putCall, double strike, double forward, double volatility)
Calculates the price delta.double
priceGamma(double expiry, PutCall putCall, double strike, double forward, double volatility)
Calculates the price gamma.double
priceTheta(double expiry, PutCall putCall, double strike, double forward, double volatility)
Calculates the price theta.double
priceVega(double expiry, PutCall putCall, double strike, double forward, double volatility)
Calculates the price vega.double
relativeTime(ZonedDateTime dateTime)
Converts a time and date to a relative year fraction.double
rho(double expiry)
Calculates the rho parameter for a pair of time to expiry.double
shift(double expiry)
Calculates the shift parameter for the specified time to expiry.SabrParametersIborCapletFloorletVolatilities.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
double
volatility(double expiry, double strike, double forwardRate)
Calculates the volatility at the specified expiry.ValueDerivatives
volatilityAdjoint(double expiry, double strike, double forward)
Calculates the volatility and associated sensitivities.SabrParametersIborCapletFloorletVolatilities
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.SabrParametersIborCapletFloorletVolatilities
withPerturbation(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.pricer.capfloor.BlackSabrIborCapletFloorletVolatilities
getVolatilityType
-
Methods inherited from interface com.opengamma.strata.pricer.capfloor.IborCapletFloorletVolatilities
getValuationDate, parameterSensitivity, volatility
-
Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData
findParameterIndex
-
-
-
-
Method Detail
-
of
public static SabrParametersIborCapletFloorletVolatilities of(IborCapletFloorletVolatilitiesName name, IborIndex index, ZonedDateTime valuationDateTime, SabrParameters parameters)
Obtains an instance from the SABR model parameters and the date-time for which it is valid.- Parameters:
name
- the nameindex
- the Ibor index for which the data is validvaluationDateTime
- 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:MarketDataView
Finds 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:
findData
in 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:ParameterizedData
Gets 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:
getParameterCount
in interfaceParameterizedData
- Returns:
- the number of parameters
-
getParameter
public double getParameter(int parameterIndex)
Description copied from interface:ParameterizedData
Gets the value of the parameter at the specified index.- Specified by:
getParameter
in 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:ParameterizedData
Gets the metadata of the parameter at the specified index.If there is no specific parameter metadata, an empty instance will be returned.
- Specified by:
getParameterMetadata
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the metadata of the parameter
-
withParameter
public SabrParametersIborCapletFloorletVolatilities withParameter(int parameterIndex, double newValue)
Description copied from interface:ParameterizedData
Returns 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:
withParameter
in interfaceIborCapletFloorletVolatilities
- Specified by:
withParameter
in interfaceParameterizedData
- Specified by:
withParameter
in interfaceSabrIborCapletFloorletVolatilities
- 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 SabrParametersIborCapletFloorletVolatilities withPerturbation(ParameterPerturbation perturbation)
Description copied from interface:ParameterizedData
Returns 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:
withPerturbation
in interfaceIborCapletFloorletVolatilities
- Specified by:
withPerturbation
in interfaceParameterizedData
- Specified by:
withPerturbation
in interfaceSabrIborCapletFloorletVolatilities
- 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 strike, double forwardRate)
Description copied from interface:IborCapletFloorletVolatilities
Calculates the volatility at the specified expiry.This relies on expiry supplied by
IborCapletFloorletVolatilities.relativeTime(ZonedDateTime)
.- Specified by:
volatility
in interfaceIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionstrike
- the option strike rateforwardRate
- the forward rate- Returns:
- the volatility
-
volatilityAdjoint
public ValueDerivatives volatilityAdjoint(double expiry, double strike, double forward)
Description copied from interface:SabrIborCapletFloorletVolatilities
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
- Specified by:
volatilityAdjoint
in interfaceSabrIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionstrike
- the strikeforward
- the forward- Returns:
- the volatility and associated sensitivities
-
alpha
public double alpha(double expiry)
Description copied from interface:SabrIborCapletFloorletVolatilities
Calculates the alpha parameter for a pair of time to expiry.- Specified by:
alpha
in interfaceSabrIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fraction- Returns:
- the alpha parameter
-
beta
public double beta(double expiry)
Description copied from interface:SabrIborCapletFloorletVolatilities
Calculates the beta parameter for a pair of time to expiry.- Specified by:
beta
in interfaceSabrIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fraction- Returns:
- the beta parameter
-
rho
public double rho(double expiry)
Description copied from interface:SabrIborCapletFloorletVolatilities
Calculates the rho parameter for a pair of time to expiry.- Specified by:
rho
in interfaceSabrIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fraction- Returns:
- the rho parameter
-
nu
public double nu(double expiry)
Description copied from interface:SabrIborCapletFloorletVolatilities
Calculates the nu parameter for a pair of time to expiry.- Specified by:
nu
in interfaceSabrIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fraction- Returns:
- the nu parameter
-
shift
public double shift(double expiry)
Description copied from interface:SabrIborCapletFloorletVolatilities
Calculates the shift parameter for the specified time to expiry.- Specified by:
shift
in interfaceSabrIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fraction- Returns:
- the shift parameter
-
parameterSensitivity
public CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
Description copied from interface:IborCapletFloorletVolatilities
Calculates the parameter sensitivity.This computes the
CurrencyParameterSensitivities
associated with thePointSensitivities
. This corresponds to the projection of the point sensitivity to the internal parameters representation.- Specified by:
parameterSensitivity
in interfaceIborCapletFloorletVolatilities
- Parameters:
pointSensitivities
- the point sensitivities- Returns:
- the sensitivity to the underlying parameters
-
price
public double price(double expiry, PutCall putCall, double strike, double forward, double volatility)
Description copied from interface:IborCapletFloorletVolatilities
Calculates the price.This relies on expiry supplied by
IborCapletFloorletVolatilities.relativeTime(ZonedDateTime)
. This relies on volatility supplied byIborCapletFloorletVolatilities.volatility(double, double, double)
.- Specified by:
price
in interfaceIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionputCall
- whether the option is put or callstrike
- the option strike rateforward
- the forward ratevolatility
- the volatility- Returns:
- the price
-
priceDelta
public double priceDelta(double expiry, PutCall putCall, double strike, double forward, double volatility)
Description copied from interface:IborCapletFloorletVolatilities
Calculates the price delta.This is the first order sensitivity of the option price to the forward.
This relies on expiry supplied by
IborCapletFloorletVolatilities.relativeTime(ZonedDateTime)
. This relies on volatility supplied byIborCapletFloorletVolatilities.volatility(double, double, double)
.- Specified by:
priceDelta
in interfaceIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionputCall
- whether the option is put or callstrike
- the option strike rateforward
- the forward ratevolatility
- the volatility- Returns:
- the delta
-
priceGamma
public double priceGamma(double expiry, PutCall putCall, double strike, double forward, double volatility)
Description copied from interface:IborCapletFloorletVolatilities
Calculates the price gamma.This is the second order sensitivity of the option price to the forward.
This relies on expiry supplied by
IborCapletFloorletVolatilities.relativeTime(ZonedDateTime)
. This relies on volatility supplied byIborCapletFloorletVolatilities.volatility(double, double, double)
.- Specified by:
priceGamma
in interfaceIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionputCall
- whether the option is put or callstrike
- the option strike rateforward
- the forward ratevolatility
- the volatility- Returns:
- the gamma
-
priceTheta
public double priceTheta(double expiry, PutCall putCall, double strike, double forward, double volatility)
Description copied from interface:IborCapletFloorletVolatilities
Calculates the price theta.This is the driftless sensitivity of the option price to a change in time to maturity.
This relies on expiry supplied by
IborCapletFloorletVolatilities.relativeTime(ZonedDateTime)
. This relies on volatility supplied byIborCapletFloorletVolatilities.volatility(double, double, double)
.- Specified by:
priceTheta
in interfaceIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionputCall
- whether the option is put or callstrike
- the option strike rateforward
- the forward ratevolatility
- the volatility- Returns:
- the theta
-
priceVega
public double priceVega(double expiry, PutCall putCall, double strike, double forward, double volatility)
Description copied from interface:IborCapletFloorletVolatilities
Calculates the price vega.This is the sensitivity of the option price to the implied volatility.
This relies on expiry supplied by
IborCapletFloorletVolatilities.relativeTime(ZonedDateTime)
. This relies on volatility supplied byIborCapletFloorletVolatilities.volatility(double, double, double)
.- Specified by:
priceVega
in interfaceIborCapletFloorletVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionputCall
- whether the option is put or callstrike
- the option strike rateforward
- the forward ratevolatility
- the volatility- Returns:
- the vega
-
relativeTime
public double relativeTime(ZonedDateTime dateTime)
Description copied from interface:IborCapletFloorletVolatilities
Converts 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:
relativeTime
in interfaceIborCapletFloorletVolatilities
- Parameters:
dateTime
- the date-time to find the relative year fraction of- Returns:
- the relative year fraction
-
meta
public static SabrParametersIborCapletFloorletVolatilities.Meta meta()
The meta-bean forSabrParametersIborCapletFloorletVolatilities
.- Returns:
- the meta-bean, not null
-
builder
public static SabrParametersIborCapletFloorletVolatilities.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public SabrParametersIborCapletFloorletVolatilities.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getName
public IborCapletFloorletVolatilitiesName getName()
Gets the name.- Specified by:
getName
in interfaceIborCapletFloorletVolatilities
- Returns:
- the value of the property, not null
-
getIndex
public IborIndex getIndex()
Gets the Ibor index.The data must valid in terms of this Ibor index.
- Specified by:
getIndex
in interfaceIborCapletFloorletVolatilities
- 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:
getValuationDateTime
in interfaceIborCapletFloorletVolatilities
- Returns:
- the value of the property, not null
-
getParameters
public SabrParameters getParameters()
Gets the SABR model parameters.Each model parameter of SABR model is a curve. The x-value of the curve is the expiry, as a year fraction.
- 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 curve 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 curve 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 curve 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 curve parameter metadata.
- Returns:
- the optional value of the property, not null
-
toBuilder
public SabrParametersIborCapletFloorletVolatilities.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-