Interface FxIndexRates
-
- All Superinterfaces:
MarketDataView
,ParameterizedData
- All Known Implementing Classes:
ForwardFxIndexRates
public interface FxIndexRates extends MarketDataView, ParameterizedData
Provides access to rates for an FX index.This provides historic and forward rates for a single
FxIndex
, such as 'EUR/GBP-ECB'. An FX rate is the conversion rate between two currencies. An FX index is the rate as published by a specific organization, typically at a well-known time-of-day.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MultiCurrencyAmount
currencyExposure(FxIndexSensitivity pointSensitivity)
Calculates the currency exposure from the point sensitivity.LocalDateDoubleTimeSeries
getFixings()
Gets the time-series of fixings for the index.FxForwardRates
getFxForwardRates()
Gets the underlying FX forward rates.FxIndex
getIndex()
Gets the FX index.CurrencyParameterSensitivities
parameterSensitivity(FxIndexSensitivity pointSensitivity)
Calculates the parameter sensitivity from the point sensitivity.double
rate(FxIndexObservation observation, Currency baseCurrency)
Gets the historic or forward rate at the specified fixing date.PointSensitivityBuilder
ratePointSensitivity(FxIndexObservation observation, Currency baseCurrency)
Calculates the point sensitivity of the historic or forward rate at the specified fixing date.FxIndexRates
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.FxIndexRates
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.-
Methods inherited from interface com.opengamma.strata.market.MarketDataView
findData, getValuationDate
-
Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData
findParameterIndex, getParameter, getParameterCount, getParameterMetadata
-
-
-
-
Method Detail
-
getIndex
FxIndex getIndex()
Gets the FX index.The index that the rates are for.
- Returns:
- the FX index
-
getFixings
LocalDateDoubleTimeSeries getFixings()
Gets the time-series of fixings for the index.The time-series contains historic fixings of the index. It may be empty if the data is not available.
- Returns:
- the time-series fixings
-
getFxForwardRates
FxForwardRates getFxForwardRates()
Gets the underlying FX forward rates.- Returns:
- the FX forward rates
-
withParameter
FxIndexRates 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
FxIndexRates 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
-
rate
double rate(FxIndexObservation observation, Currency baseCurrency)
Gets the historic or forward rate at the specified fixing date.The rate of the FX index 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 index defines the conversion rate for a specific currency pair. This method specifies which of the two currencies in the index is to be treated as the base currency for the purposes of the returned rate. If the specified base currency equals the base currency of the index, then the rate is simply returned. If the specified base currency equals the counter currency of the index, then the inverse rate is returned. As such, an amount in the specified base currency can be directly multiplied by the returned FX rate to perform FX conversion.
To convert an amount in the specified base currency to the other currency, multiply it by the returned FX rate.
- Parameters:
observation
- the rate observation, including the fixing datebaseCurrency
- the base currency that the rate should be expressed against- Returns:
- the rate of the index, either historic or forward
- Throws:
RuntimeException
- if the value cannot be obtained
-
ratePointSensitivity
PointSensitivityBuilder ratePointSensitivity(FxIndexObservation observation, Currency baseCurrency)
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. The sensitivity refers to the result of
rate(FxIndexObservation, Currency)
.- Parameters:
observation
- the rate observation, including the fixing datebaseCurrency
- the base currency that the rate should be expressed against- Returns:
- the point sensitivity of the rate
- Throws:
RuntimeException
- if the value cannot be obtained
-
parameterSensitivity
CurrencyParameterSensitivities parameterSensitivity(FxIndexSensitivity pointSensitivity)
Calculates the parameter sensitivity from the point sensitivity.This is used to convert a single point sensitivity to parameter sensitivity.
- Parameters:
pointSensitivity
- the point sensitivity to convert- Returns:
- the parameter sensitivity
- Throws:
RuntimeException
- if the result cannot be calculated
-
currencyExposure
MultiCurrencyAmount currencyExposure(FxIndexSensitivity pointSensitivity)
Calculates the currency exposure from the point sensitivity.This is used to convert a single point sensitivity to currency exposure.
- Parameters:
pointSensitivity
- the point sensitivity to convert- Returns:
- the currency exposure
- Throws:
RuntimeException
- if the result cannot be calculated
-
-