public final class DiscountFxForwardRates extends Object implements FxForwardRates, org.joda.beans.ImmutableBean, Serializable
This provides discount factors for a single currency pair.
This implementation is based on two underlying DiscountFactors objects,
one for each currency, and an FxRateProvider.
| Modifier and Type | Class and Description |
|---|---|
static class |
DiscountFxForwardRates.Meta
The meta-bean for
DiscountFxForwardRates. |
| Modifier and Type | Method and Description |
|---|---|
MultiCurrencyAmount |
currencyExposure(FxForwardSensitivity pointSensitivity)
Calculates the currency exposure from the point sensitivity.
|
boolean |
equals(Object obj) |
<T> Optional<T> |
findData(MarketDataName<T> name) |
DiscountFactors |
getBaseCurrencyDiscountFactors()
Gets the discount factors for the base currency of the currency pair.
|
DiscountFactors |
getCounterCurrencyDiscountFactors()
Gets the discount factors for the counter currency of the currency pair.
|
CurrencyPair |
getCurrencyPair()
Gets the currency pair that the rates are for.
|
FxRateProvider |
getFxRateProvider()
Gets the provider of FX rates.
|
double |
getParameter(int parameterIndex) |
int |
getParameterCount() |
ParameterMetadata |
getParameterMetadata(int parameterIndex) |
LocalDate |
getValuationDate()
Gets the valuation date.
|
int |
hashCode() |
static DiscountFxForwardRates.Meta |
meta()
The meta-bean for
DiscountFxForwardRates. |
DiscountFxForwardRates.Meta |
metaBean() |
static DiscountFxForwardRates |
of(CurrencyPair currencyPair,
FxRateProvider fxRateProvider,
DiscountFactors baseCurrencyFactors,
DiscountFactors counterCurrencyFactors)
Obtains an instance based on two discount factors, one for each currency.
|
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.
|
String |
toString() |
DiscountFxForwardRates |
withDiscountFactors(DiscountFactors baseCurrencyFactors,
DiscountFactors counterCurrencyFactors)
Returns a new instance with different discount factors.
|
DiscountFxForwardRates |
withParameter(int parameterIndex,
double newValue) |
DiscountFxForwardRates |
withPerturbation(ParameterPerturbation perturbation) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitfindParameterIndexpublic static DiscountFxForwardRates of(CurrencyPair currencyPair, FxRateProvider fxRateProvider, DiscountFactors baseCurrencyFactors, DiscountFactors counterCurrencyFactors)
The instance is based on the discount factors for each currency.
currencyPair - the currency pairfxRateProvider - the provider of FX ratesbaseCurrencyFactors - the discount factors in the base currency of the indexcounterCurrencyFactors - the discount factors in the counter currency of the indexpublic LocalDate getValuationDate()
FxForwardRatesThe raw data in this provider is calibrated for this date.
getValuationDate in interface MarketDataViewgetValuationDate in interface FxForwardRatespublic <T> Optional<T> findData(MarketDataName<T> name)
findData in interface MarketDataViewpublic int getParameterCount()
getParameterCount in interface ParameterizedDatapublic double getParameter(int parameterIndex)
getParameter in interface ParameterizedDatapublic ParameterMetadata getParameterMetadata(int parameterIndex)
getParameterMetadata in interface ParameterizedDatapublic DiscountFxForwardRates withParameter(int parameterIndex, double newValue)
withParameter in interface ParameterizedDatawithParameter in interface FxForwardRatespublic DiscountFxForwardRates withPerturbation(ParameterPerturbation perturbation)
withPerturbation in interface ParameterizedDatawithPerturbation in interface FxForwardRatespublic double rate(Currency baseCurrency, LocalDate referenceDate)
FxForwardRatesThe 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.
rate in interface FxForwardRatesbaseCurrency - the base currency that the rate should be expressed againstreferenceDate - the date to query the rate forpublic PointSensitivityBuilder ratePointSensitivity(Currency baseCurrency, LocalDate referenceDate)
FxForwardRates
This returns a sensitivity instance referring to the points that were queried in the market data.
The sensitivity refers to the result of FxForwardRates.rate(Currency, LocalDate).
ratePointSensitivity in interface FxForwardRatesbaseCurrency - the base currency that the rate should be expressed againstreferenceDate - the date to find the sensitivity forpublic double rateFxSpotSensitivity(Currency baseCurrency, LocalDate referenceDate)
FxForwardRates
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 FxForwardRates.rate(Currency, LocalDate).
rateFxSpotSensitivity in interface FxForwardRatesbaseCurrency - the base currency that the rate should be expressed againstreferenceDate - the date to find the sensitivity forpublic CurrencyParameterSensitivities parameterSensitivity(FxForwardSensitivity pointSensitivity)
FxForwardRatesThis is used to convert a single point sensitivity to parameter sensitivity.
parameterSensitivity in interface FxForwardRatespointSensitivity - the point sensitivity to convertpublic MultiCurrencyAmount currencyExposure(FxForwardSensitivity pointSensitivity)
FxForwardRatesThis is used to convert a single point sensitivity to currency exposure.
currencyExposure in interface FxForwardRatespointSensitivity - the point sensitivity to convertpublic DiscountFxForwardRates withDiscountFactors(DiscountFactors baseCurrencyFactors, DiscountFactors counterCurrencyFactors)
baseCurrencyFactors - the new base currency discount factorscounterCurrencyFactors - the new counter currency discount factorspublic static DiscountFxForwardRates.Meta meta()
DiscountFxForwardRates.public DiscountFxForwardRates.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic CurrencyPair getCurrencyPair()
getCurrencyPair in interface FxForwardRatespublic FxRateProvider getFxRateProvider()
public DiscountFactors getBaseCurrencyDiscountFactors()
public DiscountFactors getCounterCurrencyDiscountFactors()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.