Class NormalBondYieldExpiryDurationVolatilities
- java.lang.Object
-
- com.opengamma.strata.pricer.bond.NormalBondYieldExpiryDurationVolatilities
-
- All Implemented Interfaces:
MarketDataView
,ParameterizedData
,BondYieldVolatilities
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class NormalBondYieldExpiryDurationVolatilities extends Object implements BondYieldVolatilities, org.joda.beans.ImmutableBean, Serializable
Volatility for swaptions in the normal or Bachelier model based on a surface.The volatility is represented by a surface on the expiry and bond duration dimensions.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NormalBondYieldExpiryDurationVolatilities.Meta
The meta-bean forNormalBondYieldExpiryDurationVolatilities
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
<T> Optional<T>
findData(MarketDataName<T> name)
Finds the market data with the specified name.OptionalInt
findParameterIndex(ParameterMetadata metadata)
Finds the parameter index of the specified metadata.Currency
getCurrency()
Gets the currency.BondVolatilitiesName
getName()
Gets the name of these volatilities.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.Surface
getSurface()
Gets the normal volatility surface.ZonedDateTime
getValuationDateTime()
Gets the valuation date-time.ValueType
getVolatilityType()
Gets the type of volatility returned by theBondYieldVolatilities.volatility(double, double, double, double)
method.int
hashCode()
static NormalBondYieldExpiryDurationVolatilities.Meta
meta()
The meta-bean forNormalBondYieldExpiryDurationVolatilities
.NormalBondYieldExpiryDurationVolatilities.Meta
metaBean()
static NormalBondYieldExpiryDurationVolatilities
of(Currency currency, ZonedDateTime valuationDateTime, Surface surface)
Obtains an instance from the implied volatility surface and the date-time for which it is valid.CurrencyParameterSensitivities
parameterSensitivity(PointSensitivities pointSensitivities)
Calculates the parameter sensitivity.double
relativeTime(ZonedDateTime dateTime)
Converts a time and date to a relative year fraction.String
toString()
double
volatility(double expiry, double duration, double strike, double forwardRate)
Calculates the volatility at the specified expiry.NormalBondYieldExpiryDurationVolatilities
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.NormalBondYieldExpiryDurationVolatilities
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.bond.BondYieldVolatilities
getValuationDate, parameterSensitivity, priceVolatilityEquivalent, priceVolatilityEquivalent, priceVolatilityEquivalent, priceVolatilityEquivalentAd, priceVolatilityEquivalentAd, priceVolatilityEquivalentAd, volatility
-
-
-
-
Method Detail
-
of
public static NormalBondYieldExpiryDurationVolatilities of(Currency currency, ZonedDateTime valuationDateTime, Surface surface)
Obtains an instance from the implied volatility surface and the date-time for which it is valid.The surface is specified by an instance of
Surface
, such asInterpolatedNodalSurface
. The surface must contain the correct metadata:- The x-value type must be
ValueType.YEAR_FRACTION
- The y-value type must be
ValueType.YEAR_FRACTION
- The z-value type must be
ValueType.NORMAL_VOLATILITY
- The day count must be set in the additional information using
SurfaceInfoType.DAY_COUNT
Surfaces.normalVolatilityByExpiryTenor(String, DayCount)
.- Parameters:
currency
- the currencyvaluationDateTime
- the valuation date-timesurface
- the implied volatility surface- Returns:
- the volatilities
- The x-value type must be
-
getVolatilityType
public ValueType getVolatilityType()
Description copied from interface:BondYieldVolatilities
Gets the type of volatility returned by theBondYieldVolatilities.volatility(double, double, double, double)
method.- Specified by:
getVolatilityType
in interfaceBondYieldVolatilities
- Returns:
- the type
-
getName
public BondVolatilitiesName getName()
Description copied from interface:BondYieldVolatilities
Gets the name of these volatilities.- Specified by:
getName
in interfaceBondYieldVolatilities
- Returns:
- the name
-
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
-
findParameterIndex
public OptionalInt findParameterIndex(ParameterMetadata metadata)
Description copied from interface:ParameterizedData
Finds the parameter index of the specified metadata.If the parameter metadata is not matched, an empty optional will be returned.
- Specified by:
findParameterIndex
in interfaceParameterizedData
- Parameters:
metadata
- the parameter metadata to find the index of- Returns:
- the index of the parameter
-
withParameter
public NormalBondYieldExpiryDurationVolatilities 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 interfaceBondYieldVolatilities
- 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 NormalBondYieldExpiryDurationVolatilities 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 interfaceBondYieldVolatilities
- 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
public double volatility(double expiry, double duration, double strike, double forwardRate)
Description copied from interface:BondYieldVolatilities
Calculates the volatility at the specified expiry.This relies on expiry supplied by
BondYieldVolatilities.relativeTime(ZonedDateTime)
.- Specified by:
volatility
in interfaceBondYieldVolatilities
- Parameters:
expiry
- the time to expiry as a year fractionduration
- the modified duration of the instrument as a year fractionstrike
- the strike yieldforwardRate
- the forward yield of the underlying bond- Returns:
- the volatility
-
parameterSensitivity
public CurrencyParameterSensitivities parameterSensitivity(PointSensitivities pointSensitivities)
Description copied from interface:BondYieldVolatilities
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 interfaceBondYieldVolatilities
- Parameters:
pointSensitivities
- the point sensitivities- Returns:
- the sensitivity to the underlying parameters
-
relativeTime
public double relativeTime(ZonedDateTime dateTime)
Description copied from interface:BondYieldVolatilities
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 interfaceBondYieldVolatilities
- Parameters:
dateTime
- the date-time to find the relative year fraction of- Returns:
- the relative year fraction
-
meta
public static NormalBondYieldExpiryDurationVolatilities.Meta meta()
The meta-bean forNormalBondYieldExpiryDurationVolatilities
.- Returns:
- the meta-bean, not null
-
metaBean
public NormalBondYieldExpiryDurationVolatilities.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getCurrency
public Currency getCurrency()
Gets the currency.- Specified by:
getCurrency
in interfaceBondYieldVolatilities
- 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 interfaceBondYieldVolatilities
- Returns:
- the value of the property, not null
-
getSurface
public Surface getSurface()
Gets the normal volatility surface.The x-value of the surface is the expiry, as a year fraction. The y-value of the surface is the duration, as a year fraction.
- Returns:
- the value of the property, not null
-
-