## Class ImmutableRatesProvider

• All Implemented Interfaces:
FxRateProvider, BaseProvider, RatesProvider, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

public final class ImmutableRatesProvider
extends Object
implements RatesProvider, org.joda.beans.ImmutableBean, Serializable
The default immutable rates provider, used to calculate analytic measures.

This provides the environmental information against which pricing occurs. This includes FX rates, discount factors and forward curves.

Serialized Form
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  ImmutableRatesProvider.Meta
The meta-bean for ImmutableRatesProvider.
• ### Method Summary

All Methods
Modifier and Type Method Description
static ImmutableRatesProviderBuilder builder​(LocalDate valuationDate)
Creates a builder specifying the valuation date.
static ImmutableRatesProvider combined​(FxRateProvider fx, ImmutableRatesProvider... providers)
Combines a number of rates providers.
ImmutableRatesProvider combinedWith​(ImmutableRatesProvider other, FxRateProvider fxProvider)
Combines this provider with another.
<T> T data​(MarketDataId<T> id)
Gets market data of a specific type.
DiscountFactors discountFactors​(Currency currency)
Gets the discount factors for a currency.
boolean equals​(Object obj)
<T> Optional<T> findData​(MarketDataName<T> name)
Finds the market data with the specified name.
FxForwardRates fxForwardRates​(CurrencyPair currencyPair)
Gets the forward FX rates for a currency pair.
FxIndexRates fxIndexRates​(FxIndex index)
Gets the rates for an FX index.
double fxRate​(Currency baseCurrency, Currency counterCurrency)
Gets the FX rate for the specified currency pair on the valuation date.
Map<CurveName,​Curve> getCurves()
Returns a map containing all the curves, keyed by curve name.
Map<CurveId,​Curve> getCurves​(CurveGroupName groupName)
Returns a map containing all the curves, keyed by curve identifier.
ImmutableSet<Currency> getDiscountCurrencies()
Gets the set of currencies that discount factors are provided for.
ImmutableMap<Currency,​Curve> getDiscountCurves()
Gets the discount curves, defaulted to an empty map.
FxRateProvider getFxRateProvider()
Gets the provider of foreign exchange rates.
ImmutableSet<IborIndex> getIborIndices()
Gets the set of Ibor indices that are available.
ImmutableMap<Index,​Curve> getIndexCurves()
Gets the forward curves, defaulted to an empty map.
ImmutableSet<OvernightIndex> getOvernightIndices()
Gets the set of Overnight indices that are available.
ImmutableSet<PriceIndex> getPriceIndices()
Gets the set of Price indices that are available.
ImmutableMap<Index,​LocalDateDoubleTimeSeries> getTimeSeries()
Gets the time-series, defaulted to an empty map.
ImmutableSet<Index> getTimeSeriesIndices()
Gets the set of indices that have time-series available.
LocalDate getValuationDate()
Gets the valuation date.
int hashCode()
IborIndexRates iborIndexRates​(IborIndex index)
Gets the rates for an Ibor index.
static ImmutableRatesProvider.Meta meta()
The meta-bean for ImmutableRatesProvider.
ImmutableRatesProvider.Meta metaBean()
OvernightIndexRates overnightIndexRates​(OvernightIndex index)
Gets the rates for an Overnight index.
PriceIndexValues priceIndexValues​(PriceIndex index)
Gets the values for an Price index.
LocalDateDoubleTimeSeries timeSeries​(Index index)
Gets the time series.
ImmutableRatesProviderBuilder toBuilder()
Converts this instance to a builder allowing changes to be made.
ImmutableRatesProvider toImmutableRatesProvider()
Converts this provider to an equivalent ImmutableRatesProvider.
String toString()
• ### Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• ### Methods inherited from interface com.opengamma.strata.pricer.BaseProvider

discountFactor, fxRate
• ### Methods inherited from interface org.joda.beans.Bean

property, propertyNames
• ### Methods inherited from interface com.opengamma.strata.basics.currency.FxRateProvider

convert
• ### Methods inherited from interface com.opengamma.strata.pricer.rate.RatesProvider

currencyExposure, parameterSensitivity
• ### Method Detail

• #### combined

public static ImmutableRatesProvider combined​(FxRateProvider fx,
ImmutableRatesProvider... providers)
Combines a number of rates providers.

If the two providers have curves or time series for the same currency or index, an IllegalAccessException is thrown. The FxRateProviders is not populated with the given provider; no attempt is done on merging the embedded FX providers.

Parameters:
fx - the FX provider for the resulting rate provider
providers - the rates providers to be merged
Returns:
the combined rates provider
• #### builder

public static ImmutableRatesProviderBuilder builder​(LocalDate valuationDate)
Creates a builder specifying the valuation date.
Parameters:
valuationDate - the valuation date
Returns:
the builder
• #### toBuilder

public ImmutableRatesProviderBuilder toBuilder()
Converts this instance to a builder allowing changes to be made.
Returns:
the builder
• #### getDiscountCurrencies

public ImmutableSet<Currency> getDiscountCurrencies()
Description copied from interface: BaseProvider
Gets the set of currencies that discount factors are provided for.
Specified by:
getDiscountCurrencies in interface BaseProvider
Returns:
the set of discount curve currencies
• #### getIborIndices

public ImmutableSet<IborIndex> getIborIndices()
Description copied from interface: RatesProvider
Gets the set of Ibor indices that are available.

If an index is present in the result of this method, then RatesProvider.iborIndexRates(IborIndex) should not throw an exception.

Specified by:
getIborIndices in interface RatesProvider
Returns:
the set of Ibor indices
• #### getOvernightIndices

public ImmutableSet<OvernightIndex> getOvernightIndices()
Description copied from interface: RatesProvider
Gets the set of Overnight indices that are available.

If an index is present in the result of this method, then RatesProvider.overnightIndexRates(OvernightIndex) should not throw an exception.

Specified by:
getOvernightIndices in interface RatesProvider
Returns:
the set of Overnight indices
• #### getPriceIndices

public ImmutableSet<PriceIndex> getPriceIndices()
Description copied from interface: RatesProvider
Gets the set of Price indices that are available.

If an index is present in the result of this method, then RatesProvider.priceIndexValues(PriceIndex) should not throw an exception.

Specified by:
getPriceIndices in interface RatesProvider
Returns:
the set of Price indices
• #### getTimeSeriesIndices

public ImmutableSet<Index> getTimeSeriesIndices()
Description copied from interface: RatesProvider
Gets the set of indices that have time-series available.

Note that the method RatesProvider.timeSeries(Index) returns an empty time-series when the index is not known, thus this method is useful to determine if there actually is a time-series in the underlying data.

Specified by:
getTimeSeriesIndices in interface RatesProvider
Returns:
the set of indices with time-series
• #### findData

public <T> Optional<T> findData​(MarketDataName<T> name)
Description copied from interface: RatesProvider
Finds the market data with the specified name.

This is most commonly used to find a Curve using a CurveName. If the market data cannot be found, empty is returned.

Specified by:
findData in interface RatesProvider
Type Parameters:
T - the type of the market data value
Parameters:
name - the name to find
Returns:
• #### data

public <T> T data​(MarketDataId<T> id)
Description copied from interface: BaseProvider
Gets market data of a specific type.

This is a general purpose mechanism to obtain market data. In general, it is desirable to pass the specific market data needed for pricing into the pricing method. However, in some cases, notably swaps, this is not feasible. It is strongly recommended to clearly state on pricing methods what data is required.

Specified by:
data in interface BaseProvider
Type Parameters:
T - the type of the value
Parameters:
id - the identifier to find
Returns:
the data associated with the key
• #### timeSeries

public LocalDateDoubleTimeSeries timeSeries​(Index index)
Description copied from interface: RatesProvider
Gets the time series.

This returns time series for the index.

Specified by:
timeSeries in interface RatesProvider
Parameters:
index - the index
Returns:
• #### fxRate

public double fxRate​(Currency baseCurrency,
Currency counterCurrency)
Description copied from interface: BaseProvider
Gets the FX rate for the specified currency pair on the valuation date.

The rate returned is the rate from the base currency to the counter currency as defined by this formula: (1 * baseCurrency = fxRate * counterCurrency).

Specified by:
fxRate in interface BaseProvider
Specified by:
fxRate in interface FxRateProvider
Parameters:
baseCurrency - the base currency, to convert from
counterCurrency - the counter currency, to convert to
Returns:
the current FX rate for the currency pair
• #### discountFactors

public DiscountFactors discountFactors​(Currency currency)
Description copied from interface: BaseProvider
Gets the discount factors for a currency.

The discount factor represents the time value of money for the specified currency when comparing the valuation date to the specified date.

If the valuation date is on or after the specified date, the discount factor is 1.

Specified by:
discountFactors in interface BaseProvider
Parameters:
currency - the currency to get the discount factors for
Returns:
the discount factors for the specified currency
• #### fxIndexRates

public FxIndexRates fxIndexRates​(FxIndex index)
Description copied from interface: RatesProvider
Gets the rates for an FX index.

This returns an object that can provide historic and forward rates for the specified index.

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.

Specified by:
fxIndexRates in interface RatesProvider
Parameters:
index - the index to find rates for
Returns:
the rates for the specified index
• #### fxForwardRates

public FxForwardRates fxForwardRates​(CurrencyPair currencyPair)
Description copied from interface: RatesProvider
Gets the forward FX rates for a currency pair.

This returns an object that can provide forward rates for the specified currency pair. See RatesProvider.fxIndexRates(FxIndex) for forward rates with daily fixings.

Specified by:
fxForwardRates in interface RatesProvider
Parameters:
currencyPair - the currency pair to find forward rates for
Returns:
the forward rates for the specified currency pair
• #### iborIndexRates

public IborIndexRates iborIndexRates​(IborIndex index)
Description copied from interface: RatesProvider
Gets the rates for an Ibor index.

The rate of the Ibor index, such as 'GBP-LIBOR-3M', varies over time. This returns an object that can provide historic and forward rates for the specified index.

Specified by:
iborIndexRates in interface RatesProvider
Parameters:
index - the index to find rates for
Returns:
the rates for the specified index
• #### overnightIndexRates

public OvernightIndexRates overnightIndexRates​(OvernightIndex index)
Description copied from interface: RatesProvider
Gets the rates for an Overnight index.

The rate of the Overnight index, such as 'EUR-EONIA', varies over time. This returns an object that can provide historic and forward rates for the specified index.

Specified by:
overnightIndexRates in interface RatesProvider
Parameters:
index - the index to find rates for
Returns:
the rates for the specified index
• #### priceIndexValues

public PriceIndexValues priceIndexValues​(PriceIndex index)
Description copied from interface: RatesProvider
Gets the values for an Price index.

The value of the Price index, such as 'US-CPI-U', varies over time. This returns an object that can provide historic and forward values for the specified index.

Specified by:
priceIndexValues in interface RatesProvider
Parameters:
index - the index to find values for
Returns:
the values for the specified index
• #### combinedWith

public ImmutableRatesProvider combinedWith​(ImmutableRatesProvider other,
FxRateProvider fxProvider)
Combines this provider with another.

If the two providers have curves or time series for the same currency or index, an IllegalAccessException is thrown. No attempt is made to combine the FX providers, instead one is supplied.

Parameters:
other - the other rates provider
fxProvider - the FX rate provider to use
Returns:
the combined provider
• #### toImmutableRatesProvider

public ImmutableRatesProvider toImmutableRatesProvider()
Description copied from interface: RatesProvider
Converts this provider to an equivalent ImmutableRatesProvider.
Specified by:
toImmutableRatesProvider in interface RatesProvider
Returns:
the equivalent immutable rates provider
• #### getCurves

public Map<CurveName,​Curve> getCurves()
Returns a map containing all the curves, keyed by curve name.

No checks are performed to see if one curve name is mapped to two different curves.

Returns:
the map of curves
• #### getCurves

public Map<CurveId,​Curve> getCurves​(CurveGroupName groupName)
Returns a map containing all the curves, keyed by curve identifier.

No checks are performed to see if one curve name is mapped to two different curves.

This method is useful when transforming a rates provider to MarketData.

Parameters:
groupName - the curve group name
Returns:
the map of curves, keyed by CurveId.
• #### meta

public static ImmutableRatesProvider.Meta meta()
The meta-bean for ImmutableRatesProvider.
Returns:
the meta-bean, not null
• #### metaBean

public ImmutableRatesProvider.Meta metaBean()
Specified by:
metaBean in interface org.joda.beans.Bean
• #### getValuationDate

public LocalDate getValuationDate()
Gets the valuation date. All curves and other data items in this provider are calibrated for this date.
Specified by:
getValuationDate in interface BaseProvider
Returns:
the value of the property, not null
• #### getFxRateProvider

public FxRateProvider getFxRateProvider()
Gets the provider of foreign exchange rates. Conversions where both currencies are the same always succeed.
Returns:
the value of the property, not null
• #### getDiscountCurves

public ImmutableMap<Currency,​Curve> getDiscountCurves()
Gets the discount curves, defaulted to an empty map. The curve data, predicting the future, associated with each currency.
Returns:
the value of the property, not null
• #### getIndexCurves

public ImmutableMap<Index,​Curve> getIndexCurves()
Gets the forward curves, defaulted to an empty map. The curve data, predicting the future, associated with each index. This is used for Ibor, Overnight and Price indices.
Returns:
the value of the property, not null
• #### getTimeSeries

public ImmutableMap<Index,​LocalDateDoubleTimeSeries> getTimeSeries()
Gets the time-series, defaulted to an empty map. The historic data associated with each index.
Returns:
the value of the property, not null
• #### equals

public boolean equals​(Object obj)
Overrides:
equals in class Object
• #### hashCode

public int hashCode()
Overrides:
hashCode in class Object
• #### toString

public String toString()
Overrides:
toString in class Object