Class SmileDeltaParameters
- java.lang.Object
-
- com.opengamma.strata.pricer.fxopt.SmileDeltaParameters
-
- All Implemented Interfaces:
ParameterizedData
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class SmileDeltaParameters extends Object implements ParameterizedData, org.joda.beans.ImmutableBean, Serializable
A delta dependent smile as used in Forex market.This contains the data for delta dependent smile from at-the-money, risk reversal and strangle. The delta used is the delta with respect to forward.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SmileDeltaParameters.Meta
The meta-bean forSmileDeltaParameters
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
DoubleArray
getDelta()
Gets the delta of the different data points.double
getExpiry()
Gets the time to expiry associated with the data.Optional<Tenor>
getExpiryTenor()
Gets the tenor associated with the time to expiry, optional.double
getParameter(int parameterIndex)
Gets the value of the parameter at the specified index.int
getParameterCount()
Gets the number of parameters.ImmutableList<ParameterMetadata>
getParameterMetadata()
Gets the associated metadata.ParameterMetadata
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.DoubleArray
getVolatility()
Gets the volatilities associated with the strikes.int
hashCode()
DoubleArray
impliedStrikesDerivativeToExpiry(double forward)
Calculates the derivatives of the implied strikes to expiry.DoubleArray
impliedStrikesDerivativeToSmileVols(double forward)
Calculates the derivatives of the implied strikes to volatility.static SmileDeltaParameters.Meta
meta()
The meta-bean forSmileDeltaParameters
.SmileDeltaParameters.Meta
metaBean()
static SmileDeltaParameters
of(double expiry, double atmVolatility, DoubleArray delta, DoubleArray riskReversal, DoubleArray strangle)
Obtains an instance from market data at-the-money, delta, risk-reversal and strangle.static SmileDeltaParameters
of(double expiry, double atmVolatility, DoubleArray delta, DoubleArray riskReversal, DoubleArray strangle, List<ParameterMetadata> parameterMetadata)
Obtains an instance from market data at-the-money, delta, risk-reversal and strangle.static SmileDeltaParameters
of(double expiry, Tenor expiryTenor, double atmVolatility, DoubleArray delta, DoubleArray riskReversal, DoubleArray strangle)
Obtains an instance from market data at-the-money, delta, risk-reversal and strangle.static SmileDeltaParameters
of(double expiry, Tenor expiryTenor, DoubleArray delta, DoubleArray volatility)
Obtains an instance from volatility.static SmileDeltaParameters
of(double expiry, DoubleArray delta, DoubleArray volatility)
Obtains an instance from volatility.static SmileDeltaParameters
of(double expiry, DoubleArray delta, DoubleArray volatility, List<ParameterMetadata> parameterMetadata)
Obtains an instance from volatility.DoubleArray
strike(double forward)
Calculates the strikes in ascending order.String
toString()
SmileDeltaParameters
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.SmileDeltaParameters
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.market.param.ParameterizedData
findParameterIndex
-
-
-
-
Method Detail
-
of
public static SmileDeltaParameters of(double expiry, DoubleArray delta, DoubleArray volatility)
Obtains an instance from volatility.GenericVolatilitySurfaceYearFractionParameterMetadata
is used for parameter metadata.- Parameters:
expiry
- the time to expiry associated to the datadelta
- the delta of the different data points, must be positive and sorted in ascending order, the put will have as delta the opposite of the numbersvolatility
- the volatilities- Returns:
- the smile definition
-
of
public static SmileDeltaParameters of(double expiry, Tenor expiryTenor, DoubleArray delta, DoubleArray volatility)
Obtains an instance from volatility.GenericVolatilitySurfaceYearFractionParameterMetadata
is used for parameter metadata.- Parameters:
expiry
- the time to expiry associated to the dataexpiryTenor
- the tenor associated with the expirydelta
- the delta of the different data points, must be positive and sorted in ascending order, the put will have as delta the opposite of the numbersvolatility
- the volatilities- Returns:
- the smile definition
-
of
public static SmileDeltaParameters of(double expiry, DoubleArray delta, DoubleArray volatility, List<ParameterMetadata> parameterMetadata)
Obtains an instance from volatility.- Parameters:
expiry
- the time to expiry associated to the datadelta
- the delta of the different data points, must be positive and sorted in ascending order, the put will have as delta the opposite of the numbersvolatility
- the volatilitiesparameterMetadata
- the parameter metadata- Returns:
- the smile definition
-
of
public static SmileDeltaParameters of(double expiry, double atmVolatility, DoubleArray delta, DoubleArray riskReversal, DoubleArray strangle)
Obtains an instance from market data at-the-money, delta, risk-reversal and strangle.GenericVolatilitySurfaceYearFractionParameterMetadata
is used for parameter metadata.- Parameters:
expiry
- the time to expiry associated to the dataatmVolatility
- the at-the-money volatilitydelta
- the delta of the different data points, must be positive and sorted in ascending order, the put will have as delta the opposite of the numbersriskReversal
- the risk reversal volatility figures, in the same order as the deltastrangle
- the strangle volatility figures, in the same order as the delta- Returns:
- the smile definition
-
of
public static SmileDeltaParameters of(double expiry, Tenor expiryTenor, double atmVolatility, DoubleArray delta, DoubleArray riskReversal, DoubleArray strangle)
Obtains an instance from market data at-the-money, delta, risk-reversal and strangle.This factory allows the tenor to be included in the parameter metadata.
- Parameters:
expiry
- the time to expiry associated to the dataexpiryTenor
- the tenor associated with the expiryatmVolatility
- the at-the-money volatilitydelta
- the delta of the different data points, must be positive and sorted in ascending order, the put will have as delta the opposite of the numbersriskReversal
- the risk reversal volatility figures, in the same order as the deltastrangle
- the strangle volatility figures, in the same order as the delta- Returns:
- the smile definition
-
of
public static SmileDeltaParameters of(double expiry, double atmVolatility, DoubleArray delta, DoubleArray riskReversal, DoubleArray strangle, List<ParameterMetadata> parameterMetadata)
Obtains an instance from market data at-the-money, delta, risk-reversal and strangle.- Parameters:
expiry
- the time to expiry associated to the dataatmVolatility
- the at-the-money volatilitydelta
- the delta of the different data points, must be positive and sorted in ascending order, the put will have as delta the opposite of the numbersriskReversal
- the risk reversal volatility figures, in the same order as the deltastrangle
- the strangle volatility figures, in the same order as the deltaparameterMetadata
- the parameter metadata- Returns:
- the smile definition
-
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 SmileDeltaParameters 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 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 SmileDeltaParameters 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 interfaceParameterizedData
- Parameters:
perturbation
- the perturbation to apply- Returns:
- a parameterized data instance based on this with the specified perturbation applied
-
strike
public DoubleArray strike(double forward)
Calculates the strikes in ascending order.The result has twice the number of values plus one as the delta/volatility. The put with lower delta (in absolute value) first, at-the-money and call with larger delta first.
- Parameters:
forward
- the forward- Returns:
- the strikes
-
impliedStrikesDerivativeToExpiry
public DoubleArray impliedStrikesDerivativeToExpiry(double forward)
Calculates the derivatives of the implied strikes to expiry.- Parameters:
forward
- the forward- Returns:
- the strikes
-
impliedStrikesDerivativeToSmileVols
public DoubleArray impliedStrikesDerivativeToSmileVols(double forward)
Calculates the derivatives of the implied strikes to volatility.- Parameters:
forward
- the forward- Returns:
- the strikes
-
getExpiryTenor
public Optional<Tenor> getExpiryTenor()
Gets the tenor associated with the time to expiry, optional.- Returns:
- the optional value of the property, not null
-
meta
public static SmileDeltaParameters.Meta meta()
The meta-bean forSmileDeltaParameters
.- Returns:
- the meta-bean, not null
-
metaBean
public SmileDeltaParameters.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getExpiry
public double getExpiry()
Gets the time to expiry associated with the data.- Returns:
- the value of the property
-
getDelta
public DoubleArray getDelta()
Gets the delta of the different data points. Must be positive and sorted in ascending order. The put will have as delta the opposite of the numbers. The array is typically[0.1, 0.25]
. The at-the-money value of 0.5 is not included.- Returns:
- the value of the property
-
getVolatility
public DoubleArray getVolatility()
Gets the volatilities associated with the strikes. This will be of size(delta.size() * 2) + 1
with the put with lower delta (in absolute value) first, at-the-money and call with larger delta first.- Returns:
- the value of the property
-
getParameterMetadata
public ImmutableList<ParameterMetadata> getParameterMetadata()
Gets the associated metadata. This will be of size(delta.size() * 2) + 1
with the put with lower delta (in absolute value) first, at-the-money and call with larger delta first.- Returns:
- the value of the property
-
-