Interface FxOptionVolatilities
-
- All Superinterfaces:
MarketDataView
,ParameterizedData
- All Known Subinterfaces:
BlackFxOptionVolatilities
- All Known Implementing Classes:
BlackFxOptionFlatVolatilities
,BlackFxOptionSmileVolatilities
,BlackFxOptionSurfaceVolatilities
public interface FxOptionVolatilities extends MarketDataView, ParameterizedData
Volatilities for pricing FX options.This provides access to the volatilities for pricing models, such as Black.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ValueDerivatives
firstPartialDerivatives(CurrencyPair currencyPair, double expiry, double strike, double forward)
Computes the partial derivatives of the volatilities.CurrencyPair
getCurrencyPair()
Gets the currency pair for which the data is valid.FxOptionVolatilitiesName
getName()
Gets the name of these volatilities.default LocalDate
getValuationDate()
Gets the valuation date.ZonedDateTime
getValuationDateTime()
Gets the valuation date-time.ValueType
getVolatilityType()
Gets the type of volatility returned by thevolatility(com.opengamma.strata.basics.currency.CurrencyPair, java.time.ZonedDateTime, double, double)
method.CurrencyParameterSensitivities
parameterSensitivity(PointSensitivities pointSensitivities)
Calculates the parameter sensitivity.default CurrencyParameterSensitivities
parameterSensitivity(PointSensitivity... pointSensitivities)
Calculates the parameter sensitivity.double
price(double expiry, PutCall putCall, double strike, double forward, double volatility)
Calculates the price.double
relativeTime(ZonedDateTime dateTime)
Converts a time and date to a relative year fraction.double
volatility(CurrencyPair currencyPair, double expiry, double strike, double forward)
Calculates the volatility at the specified expiry.default double
volatility(CurrencyPair currencyPair, ZonedDateTime expiryDateTime, double strike, double forward)
Calculates the volatility at the specified expiry.FxOptionVolatilities
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.FxOptionVolatilities
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.-
Methods inherited from interface com.opengamma.strata.market.MarketDataView
findData
-
Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData
findParameterIndex, getParameter, getParameterCount, getParameterMetadata
-
-
-
-
Method Detail
-
getName
FxOptionVolatilitiesName getName()
Gets the name of these volatilities.- Returns:
- the name
-
getCurrencyPair
CurrencyPair getCurrencyPair()
Gets the currency pair for which the data is valid.- Returns:
- the currency pai
-
getVolatilityType
ValueType getVolatilityType()
Gets the type of volatility returned by thevolatility(com.opengamma.strata.basics.currency.CurrencyPair, java.time.ZonedDateTime, double, double)
method.- Returns:
- the type
-
getValuationDate
default LocalDate getValuationDate()
Gets the valuation date.The volatilities are calibrated for this date.
- Specified by:
getValuationDate
in interfaceMarketDataView
- Returns:
- the valuation date
-
getValuationDateTime
ZonedDateTime getValuationDateTime()
Gets the valuation date-time.The volatilities are calibrated for this date-time.
- Returns:
- the valuation date-time
-
withParameter
FxOptionVolatilities 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
FxOptionVolatilities 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
-
volatility
default double volatility(CurrencyPair currencyPair, ZonedDateTime expiryDateTime, double strike, double forward)
Calculates the volatility at the specified expiry.- Parameters:
currencyPair
- the currency pairexpiryDateTime
- the option expirystrike
- the option strike rateforward
- the forward rate- Returns:
- the volatility
-
volatility
double volatility(CurrencyPair currencyPair, double expiry, double strike, double forward)
Calculates the volatility at the specified expiry.This relies on expiry supplied by
relativeTime(ZonedDateTime)
.- Parameters:
currencyPair
- the currency pairexpiry
- the time to expiry as a year fractionstrike
- the option strike rateforward
- the forward rate- Returns:
- the volatility
-
parameterSensitivity
default CurrencyParameterSensitivities parameterSensitivity(PointSensitivity... pointSensitivities)
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.- Parameters:
pointSensitivities
- the point sensitivities- Returns:
- the sensitivity to the underlying parameters
-
parameterSensitivity
CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
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.- Parameters:
pointSensitivities
- the point sensitivities- Returns:
- the sensitivity to the underlying parameters
-
firstPartialDerivatives
ValueDerivatives firstPartialDerivatives(CurrencyPair currencyPair, double expiry, double strike, double forward)
Computes 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
- 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
- Throws:
RuntimeException
- if the derivative cannot be calculated
-
price
double price(double expiry, PutCall putCall, double strike, double forward, double volatility)
Calculates the price.This relies on expiry supplied by
relativeTime(ZonedDateTime)
. This relies on volatility supplied byvolatility(CurrencyPair, double, double, double)
.- 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
- Throws:
RuntimeException
- if the value cannot be obtained
-
relativeTime
double relativeTime(ZonedDateTime dateTime)
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.
- Parameters:
dateTime
- the date-time to find the relative year fraction of- Returns:
- the relative year fraction
-
-