Interface FxForwardRates
-
- All Superinterfaces:
MarketDataView
,ParameterizedData
- All Known Implementing Classes:
DiscountFxForwardRates
public interface FxForwardRates extends MarketDataView, ParameterizedData
Provides access to rates for a currency pair.This provides forward rates for a single
pair
, such as 'EUR/GBP'. The forward rate is the conversion rate between two currencies on a fixing date in the future.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MultiCurrencyAmount
currencyExposure(FxForwardSensitivity pointSensitivity)
Calculates the currency exposure from the point sensitivity.CurrencyPair
getCurrencyPair()
Gets the currency pair.LocalDate
getValuationDate()
Gets the valuation date.CurrencyParameterSensitivities
parameterSensitivity(FxForwardSensitivity pointSensitivity)
Calculates the parameter sensitivity from the point sensitivity.double
rate(Currency baseCurrency, LocalDate referenceDate)
Gets the forward rate at the specified payment date.double
rateFxSpotSensitivity(Currency baseCurrency, LocalDate referenceDate)
Calculates the sensitivity of the forward rate to the current FX rate.PointSensitivityBuilder
ratePointSensitivity(Currency baseCurrency, LocalDate referenceDate)
Calculates the point sensitivity of the forward rate at the specified payment date.FxForwardRates
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.FxForwardRates
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
-
getCurrencyPair
CurrencyPair getCurrencyPair()
Gets the currency pair.The the currency pair that the forward rates are for.
- Returns:
- the currency pair
-
getValuationDate
LocalDate getValuationDate()
Gets the valuation date.The raw data in this provider is calibrated for this date.
- Specified by:
getValuationDate
in interfaceMarketDataView
- Returns:
- the valuation date
-
withParameter
FxForwardRates 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
FxForwardRates 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(Currency baseCurrency, LocalDate referenceDate)
Gets the forward rate at the specified payment date.The exchange rate of the currency pair varies over time. This method obtains the estimated rate for the payment date.
This method specifies which of the two currencies in the currency pair 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 currency pair, then the rate is simply returned. If the specified base currency equals the counter currency of the currency pair, 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:
baseCurrency
- the base currency that the rate should be expressed againstreferenceDate
- the date to query the rate for- Returns:
- the forward rate of the currency pair
- Throws:
RuntimeException
- if the value cannot be obtained
-
ratePointSensitivity
PointSensitivityBuilder ratePointSensitivity(Currency baseCurrency, LocalDate referenceDate)
Calculates the point sensitivity of the forward rate at the specified payment date.This returns a sensitivity instance referring to the points that were queried in the market data. The sensitivity refers to the result of
rate(Currency, LocalDate)
.- Parameters:
baseCurrency
- the base currency that the rate should be expressed againstreferenceDate
- the date to find the sensitivity for- Returns:
- the point sensitivity of the rate
- Throws:
RuntimeException
- if the value cannot be obtained
-
rateFxSpotSensitivity
double rateFxSpotSensitivity(Currency baseCurrency, LocalDate referenceDate)
Calculates the sensitivity of the forward rate to the current FX rate.This returns the sensitivity to the current FX rate that was used to determine the FX forward rate. The sensitivity refers to the result of
rate(Currency, LocalDate)
.- Parameters:
baseCurrency
- the base currency that the rate should be expressed againstreferenceDate
- the date to find the sensitivity for- Returns:
- the sensitivity of the FX forward rate to the current FX rate
- Throws:
RuntimeException
- if the value cannot be obtained
-
parameterSensitivity
CurrencyParameterSensitivities parameterSensitivity(FxForwardSensitivity 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(FxForwardSensitivity 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
-
-