Class BlackFxOptionSmileVolatilities
- java.lang.Object
-
- com.opengamma.strata.pricer.fxopt.BlackFxOptionSmileVolatilities
-
- All Implemented Interfaces:
MarketDataView,ParameterizedData,BlackFxOptionVolatilities,FxOptionVolatilities,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class BlackFxOptionSmileVolatilities extends Object implements BlackFxOptionVolatilities, org.joda.beans.ImmutableBean, Serializable
Data provider of volatility for FX options in the log-normal or Black-Scholes model.The volatility is represented by a term structure of interpolated smile,
SmileDeltaTermStructure, which represents expiry dependent smile formed of ATM, risk reversal and strangle as used in FX market.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBlackFxOptionSmileVolatilities.BuilderThe bean-builder forBlackFxOptionSmileVolatilities.static classBlackFxOptionSmileVolatilities.MetaThe meta-bean forBlackFxOptionSmileVolatilities.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BlackFxOptionSmileVolatilities.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.ValueDerivativesfirstPartialDerivatives(CurrencyPair currencyPair, double expiry, double strike, double forward)Computes the partial derivatives of the volatilities.CurrencyPairgetCurrencyPair()Gets the currency pair that the volatilities are for.FxOptionVolatilitiesNamegetName()Gets the name of the volatilities.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.SmileDeltaTermStructuregetSmile()Gets the volatility model.ZonedDateTimegetValuationDateTime()Gets the valuation date-time.inthashCode()static BlackFxOptionSmileVolatilities.Metameta()The meta-bean forBlackFxOptionSmileVolatilities.BlackFxOptionSmileVolatilities.MetametaBean()static BlackFxOptionSmileVolatilitiesof(FxOptionVolatilitiesName name, CurrencyPair currencyPair, ZonedDateTime valuationTime, SmileDeltaTermStructure smile)Obtains an instance based on a smile.CurrencyParameterSensitivitiesparameterSensitivity(PointSensitivities pointSensitivities)Calculates the parameter sensitivity.doubleprice(double expiry, PutCall putCall, double strike, double forward, double volatility)Calculates the price.doublerelativeTime(ZonedDateTime dateTime)Converts a time and date to a relative year fraction.BlackFxOptionSmileVolatilities.BuildertoBuilder()Returns a builder that allows this bean to be mutated.StringtoString()doublevolatility(CurrencyPair currencyPair, double expiryTime, double strike, double forward)Calculates the volatility at the specified expiry.BlackFxOptionSmileVolatilitieswithParameter(int parameterIndex, double newValue)Returns a copy of the data with the value at the specified index altered.BlackFxOptionSmileVolatilitieswithPerturbation(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.fxopt.BlackFxOptionVolatilities
getVolatilityType
-
Methods inherited from interface com.opengamma.strata.pricer.fxopt.FxOptionVolatilities
getValuationDate, parameterSensitivity, volatility
-
Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData
findParameterIndex
-
-
-
-
Method Detail
-
of
public static BlackFxOptionSmileVolatilities of(FxOptionVolatilitiesName name, CurrencyPair currencyPair, ZonedDateTime valuationTime, SmileDeltaTermStructure smile)
Obtains an instance based on a smile.- Parameters:
name- the name of the volatilitiescurrencyPair- the currency pairvaluationTime- the valuation date-timesmile- the term structure of smile- Returns:
- the provider
-
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 BlackFxOptionSmileVolatilities 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 interfaceBlackFxOptionVolatilities- Specified by:
withParameterin interfaceFxOptionVolatilities- 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 BlackFxOptionSmileVolatilities 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 interfaceBlackFxOptionVolatilities- Specified by:
withPerturbationin interfaceFxOptionVolatilities- Specified by:
withPerturbationin interfaceParameterizedData- Parameters:
perturbation- the perturbation to apply- Returns:
- a parameterized data instance based on this with the specified perturbation applied
-
volatility
public double volatility(CurrencyPair currencyPair, double expiryTime, double strike, double forward)
Description copied from interface:FxOptionVolatilitiesCalculates the volatility at the specified expiry.This relies on expiry supplied by
FxOptionVolatilities.relativeTime(ZonedDateTime).- Specified by:
volatilityin interfaceFxOptionVolatilities- Parameters:
currencyPair- the currency pairexpiryTime- the time to expiry as a year fractionstrike- the option strike rateforward- the forward rate- Returns:
- the volatility
-
parameterSensitivity
public CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
Description copied from interface:FxOptionVolatilitiesCalculates 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 interfaceFxOptionVolatilities- Parameters:
pointSensitivities- the point sensitivities- Returns:
- the sensitivity to the underlying parameters
-
firstPartialDerivatives
public ValueDerivatives firstPartialDerivatives(CurrencyPair currencyPair, double expiry, double strike, double forward)
Description copied from interface:FxOptionVolatilitiesComputes the partial derivatives of the volatilities.The first derivatives are
dVol/dExpiry and dVol/dStrike. The derivatives are in the following order:- [0] derivative with respect to expiry
- [1] derivative with respect to strike
- Specified by:
firstPartialDerivativesin interfaceFxOptionVolatilities- Parameters:
currencyPair- the currency pairexpiry- the expiry at which the partial derivative is takenstrike- the strike at which the partial derivative is takenforward- the forward rate- Returns:
- the z-value and it's partial first derivatives
-
price
public double price(double expiry, PutCall putCall, double strike, double forward, double volatility)Description copied from interface:FxOptionVolatilitiesCalculates the price.This relies on expiry supplied by
FxOptionVolatilities.relativeTime(ZonedDateTime). This relies on volatility supplied byFxOptionVolatilities.volatility(CurrencyPair, double, double, double).- Specified by:
pricein interfaceFxOptionVolatilities- 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
-
relativeTime
public double relativeTime(ZonedDateTime dateTime)
Description copied from interface:FxOptionVolatilitiesConverts 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 interfaceFxOptionVolatilities- Parameters:
dateTime- the date-time to find the relative year fraction of- Returns:
- the relative year fraction
-
meta
public static BlackFxOptionSmileVolatilities.Meta meta()
The meta-bean forBlackFxOptionSmileVolatilities.- Returns:
- the meta-bean, not null
-
builder
public static BlackFxOptionSmileVolatilities.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public BlackFxOptionSmileVolatilities.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getName
public FxOptionVolatilitiesName getName()
Gets the name of the volatilities.- Specified by:
getNamein interfaceFxOptionVolatilities- Returns:
- the value of the property, not null
-
getCurrencyPair
public CurrencyPair getCurrencyPair()
Gets the currency pair that the volatilities are for.- Specified by:
getCurrencyPairin interfaceFxOptionVolatilities- Returns:
- the value of the property, not null
-
getValuationDateTime
public ZonedDateTime getValuationDateTime()
Gets the valuation date-time. All data items in this provider is calibrated for this date-time.- Specified by:
getValuationDateTimein interfaceFxOptionVolatilities- Returns:
- the value of the property, not null
-
getSmile
public SmileDeltaTermStructure getSmile()
Gets the volatility model.This represents expiry dependent smile which consists of ATM, risk reversal and strangle as used in FX market.
- Returns:
- the value of the property, not null
-
toBuilder
public BlackFxOptionSmileVolatilities.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-