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, wait
findParameterIndex
public 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()
FxForwardRates
The raw data in this provider is calibrated for this date.
getValuationDate
in interface MarketDataView
getValuationDate
in interface FxForwardRates
public <T> Optional<T> findData(MarketDataName<T> name)
findData
in interface MarketDataView
public int getParameterCount()
getParameterCount
in interface ParameterizedData
public double getParameter(int parameterIndex)
getParameter
in interface ParameterizedData
public ParameterMetadata getParameterMetadata(int parameterIndex)
getParameterMetadata
in interface ParameterizedData
public DiscountFxForwardRates withParameter(int parameterIndex, double newValue)
withParameter
in interface ParameterizedData
withParameter
in interface FxForwardRates
public DiscountFxForwardRates withPerturbation(ParameterPerturbation perturbation)
withPerturbation
in interface ParameterizedData
withPerturbation
in interface FxForwardRates
public double rate(Currency baseCurrency, LocalDate referenceDate)
FxForwardRates
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.
rate
in interface FxForwardRates
baseCurrency
- 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 FxForwardRates
baseCurrency
- 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 FxForwardRates
baseCurrency
- the base currency that the rate should be expressed againstreferenceDate
- the date to find the sensitivity forpublic CurrencyParameterSensitivities parameterSensitivity(FxForwardSensitivity pointSensitivity)
FxForwardRates
This is used to convert a single point sensitivity to parameter sensitivity.
parameterSensitivity
in interface FxForwardRates
pointSensitivity
- the point sensitivity to convertpublic MultiCurrencyAmount currencyExposure(FxForwardSensitivity pointSensitivity)
FxForwardRates
This is used to convert a single point sensitivity to currency exposure.
currencyExposure
in interface FxForwardRates
pointSensitivity
- 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.Bean
public CurrencyPair getCurrencyPair()
getCurrencyPair
in interface FxForwardRates
public 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.