Class ImmutableRatesProvider

    • 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​(java.time.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 com.google.common.collect.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
      • getTimeSeriesIndices

        public com.google.common.collect.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> java.util.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:
        the market data value, empty if not found
      • 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
      • 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
      • getCurves

        public java.util.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 java.util.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.
      • getValuationDate

        public java.time.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 com.google.common.collect.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 com.google.common.collect.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 com.google.common.collect.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​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object