Class HistoricOvernightIndexRates
- java.lang.Object
-
- com.opengamma.strata.pricer.rate.HistoricOvernightIndexRates
-
- All Implemented Interfaces:
MarketDataView
,ParameterizedData
,OvernightIndexRates
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class HistoricOvernightIndexRates extends Object implements OvernightIndexRates, org.joda.beans.ImmutableBean, Serializable
Historic Overnight index rates, used for indices that are no longer active.This allows the time-series to be queried but not the curve.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HistoricOvernightIndexRates.Meta
The meta-bean forHistoricOvernightIndexRates
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CurrencyParameterSensitivities
createParameterSensitivity(Currency currency, DoubleArray sensitivities)
Creates the parameter sensitivity when the sensitivity values are known.boolean
equals(Object obj)
<T> Optional<T>
findData(MarketDataName<T> name)
Finds the market data with the specified name.LocalDateDoubleTimeSeries
getFixings()
Gets the time-series of fixings, defaulted to an empty time-series.OvernightIndex
getIndex()
Gets the index that the rates are for.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.LocalDate
getValuationDate()
Gets the valuation date.int
hashCode()
static HistoricOvernightIndexRates.Meta
meta()
The meta-bean forHistoricOvernightIndexRates
.HistoricOvernightIndexRates.Meta
metaBean()
static HistoricOvernightIndexRates
of(OvernightIndex index, LocalDate valuationDate, LocalDateDoubleTimeSeries fixings)
Obtains an instance from a time-series of fixings.CurrencyParameterSensitivities
parameterSensitivity(OvernightRateSensitivity pointSensitivity)
Calculates the parameter sensitivity from the point sensitivity.double
periodRate(OvernightIndexObservation startDateObservation, LocalDate endDate)
Gets the historic or forward rate at the specified fixing period.PointSensitivityBuilder
periodRatePointSensitivity(OvernightIndexObservation startDateObservation, LocalDate endDate)
Calculates the point sensitivity of the historic or forward rate at the specified fixing period.double
rate(OvernightIndexObservation observation)
Gets the historic or forward rate at the specified fixing date.double
rateIgnoringFixings(OvernightIndexObservation observation)
Ignores the time-series of fixings to get the forward rate at the specified fixing date, used in rare and special cases.PointSensitivityBuilder
rateIgnoringFixingsPointSensitivity(OvernightIndexObservation observation)
Ignores the time-series of fixings to get the forward rate point sensitivity at the specified fixing date, used in rare and special cases.PointSensitivityBuilder
ratePointSensitivity(OvernightIndexObservation observation)
Calculates the point sensitivity of the historic or forward rate at the specified fixing date.String
toString()
HistoricOvernightIndexRates
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.HistoricOvernightIndexRates
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 HistoricOvernightIndexRates of(OvernightIndex index, LocalDate valuationDate, LocalDateDoubleTimeSeries fixings)
Obtains an instance from a time-series of fixings.- Parameters:
index
- the indexvaluationDate
- the valuation date for which the curve is validfixings
- the time-series of fixings- Returns:
- the rates view
-
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 HistoricOvernightIndexRates 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 interfaceOvernightIndexRates
- 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 HistoricOvernightIndexRates 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 interfaceOvernightIndexRates
- Specified by:
withPerturbation
in interfaceParameterizedData
- Parameters:
perturbation
- the perturbation to apply- Returns:
- a parameterized data instance based on this with the specified perturbation applied
-
rate
public double rate(OvernightIndexObservation observation)
Description copied from interface:OvernightIndexRates
Gets the historic or forward rate at the specified fixing date.The rate of the Overnight index, such as 'EUR-EONIA', varies over time. This method obtains the actual or estimated rate for the fixing date.
This retrieves the actual rate if the fixing date is before the valuation date, or the estimated rate if the fixing date is after the valuation date. If the fixing date equals the valuation date, then the best available rate is returned. The reference period for the underlying deposit is computed from the index conventions.
- Specified by:
rate
in interfaceOvernightIndexRates
- Parameters:
observation
- the rate observation, including the fixing date- Returns:
- the rate of the index, either historic or forward
-
rateIgnoringFixings
public double rateIgnoringFixings(OvernightIndexObservation observation)
Description copied from interface:OvernightIndexRates
Ignores the time-series of fixings to get the forward rate at the specified fixing date, used in rare and special cases. In most cases callers should userate(OvernightIndexObservation)
.An instance of
OvernightIndexRates
is typically based on a forward curve and a historic time-series. Therate(LocalDate)
method uses either the curve or time-series, depending on whether the fixing date is before or after the valuation date. This method only queries the forward curve, totally ignoring the time-series, which is needed for rare and special cases only.- Specified by:
rateIgnoringFixings
in interfaceOvernightIndexRates
- Parameters:
observation
- the rate observation, including the fixing date- Returns:
- the rate of the index ignoring the time-series of fixings
-
ratePointSensitivity
public PointSensitivityBuilder ratePointSensitivity(OvernightIndexObservation observation)
Description copied from interface:OvernightIndexRates
Calculates the point sensitivity of the historic or forward rate at the specified fixing date.This returns a sensitivity instance referring to the points that were queried in the market data. If a time-series was used, then there is no sensitivity. Otherwise, the sensitivity has the value 1. The sensitivity refers to the result of
OvernightIndexRates.rate(OvernightIndexObservation)
.- Specified by:
ratePointSensitivity
in interfaceOvernightIndexRates
- Parameters:
observation
- the rate observation, including the fixing date- Returns:
- the point sensitivity of the rate
-
rateIgnoringFixingsPointSensitivity
public PointSensitivityBuilder rateIgnoringFixingsPointSensitivity(OvernightIndexObservation observation)
Description copied from interface:OvernightIndexRates
Ignores the time-series of fixings to get the forward rate point sensitivity at the specified fixing date, used in rare and special cases. In most cases callers should useratePointSensitivity(OvernightIndexObservation)
.An instance of
OvernightIndexRates
is typically based on a forward curve and a historic time-series. TheratePointSensitivity(LocalDate)
method uses either the curve or time-series, depending on whether the fixing date is before or after the valuation date. This method only queries the forward curve, totally ignoring the time-series, which is needed for rare and special cases only.- Specified by:
rateIgnoringFixingsPointSensitivity
in interfaceOvernightIndexRates
- Parameters:
observation
- the rate observation, including the fixing date- Returns:
- the point sensitivity of the rate ignoring the time-series of fixings
-
periodRate
public double periodRate(OvernightIndexObservation startDateObservation, LocalDate endDate)
Description copied from interface:OvernightIndexRates
Gets the historic or forward rate at the specified fixing period.The start date should be on or after the valuation date. The end date should be after the start date.
This computes the forward rate in the simple simply compounded convention of the index between two given date. This is used mainly to speed-up computation by computing the rate on a longer period instead of each individual overnight rate. When data related to the overnight index rate are stored based on the fixing date and not the start and end date of the period, the call may return an
IllegalArgumentException
.- Specified by:
periodRate
in interfaceOvernightIndexRates
- Parameters:
startDateObservation
- the rate observation for the start of the periodendDate
- the end or maturity date of the period on which the rate is computed- Returns:
- the simply compounded rate associated to the period for the index
-
periodRatePointSensitivity
public PointSensitivityBuilder periodRatePointSensitivity(OvernightIndexObservation startDateObservation, LocalDate endDate)
Description copied from interface:OvernightIndexRates
Calculates the point sensitivity of the historic or forward rate at the specified fixing period.This returns a sensitivity instance referring to the points that were queried in the market data. The sensitivity refers to the result of
OvernightIndexRates.periodRate(OvernightIndexObservation, LocalDate)
.- Specified by:
periodRatePointSensitivity
in interfaceOvernightIndexRates
- Parameters:
startDateObservation
- the rate observation for the start of the periodendDate
- the end or maturity date of the period on which the rate is computed- Returns:
- the point sensitivity of the rate
-
parameterSensitivity
public CurrencyParameterSensitivities parameterSensitivity(OvernightRateSensitivity pointSensitivity)
Description copied from interface:OvernightIndexRates
Calculates the parameter sensitivity from the point sensitivity.This is used to convert a single point sensitivity to parameter sensitivity. The calculation typically involves multiplying the point and unit sensitivities.
- Specified by:
parameterSensitivity
in interfaceOvernightIndexRates
- Parameters:
pointSensitivity
- the point sensitivity to convert- Returns:
- the parameter sensitivity
-
createParameterSensitivity
public CurrencyParameterSensitivities createParameterSensitivity(Currency currency, DoubleArray sensitivities)
Description copied from interface:OvernightIndexRates
Creates the parameter sensitivity when the sensitivity values are known.In most cases,
OvernightIndexRates.parameterSensitivity(OvernightRateSensitivity)
should be used and manipulated. However, it can be useful to create parameter sensitivity from pre-computed sensitivity values.There will typically be one
CurrencyParameterSensitivity
for each underlying data structure, such as a curve. For example, if the rates are based on a single forward curve, then there will be oneCurrencyParameterSensitivity
in the result.- Specified by:
createParameterSensitivity
in interfaceOvernightIndexRates
- Parameters:
currency
- the currencysensitivities
- the sensitivity values, which must match the parameter count- Returns:
- the parameter sensitivity
-
meta
public static HistoricOvernightIndexRates.Meta meta()
The meta-bean forHistoricOvernightIndexRates
.- Returns:
- the meta-bean, not null
-
metaBean
public HistoricOvernightIndexRates.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getIndex
public OvernightIndex getIndex()
Gets the index that the rates are for.- Specified by:
getIndex
in interfaceOvernightIndexRates
- Returns:
- the value of the property, not null
-
getValuationDate
public LocalDate getValuationDate()
Gets the valuation date.- Specified by:
getValuationDate
in interfaceMarketDataView
- Returns:
- the value of the property, not null
-
getFixings
public LocalDateDoubleTimeSeries getFixings()
Gets the time-series of fixings, defaulted to an empty time-series. This includes the known historical fixings and may be empty.- Specified by:
getFixings
in interfaceOvernightIndexRates
- Returns:
- the value of the property, not null
-
-