<commit_before>/*
 * Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.strata.pricer.rate;

import java.util.Optional;
import java.util.Set;

import com.google.common.collect.ImmutableSet;
import com.opengamma.strata.basics.currency.CurrencyPair;
import com.opengamma.strata.basics.currency.MultiCurrencyAmount;
import com.opengamma.strata.basics.index.FxIndex;
import com.opengamma.strata.basics.index.IborIndex;
import com.opengamma.strata.basics.index.Index;
import com.opengamma.strata.basics.index.OvernightIndex;
import com.opengamma.strata.basics.index.PriceIndex;
import com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeries;
import com.opengamma.strata.data.MarketDataName;
import com.opengamma.strata.market.curve.Curve;
import com.opengamma.strata.market.curve.CurveName;
import com.opengamma.strata.market.param.CurrencyParameterSensitivities;
import com.opengamma.strata.market.sensitivity.PointSensitivities;
import com.opengamma.strata.market.sensitivity.PointSensitivity;
import com.opengamma.strata.pricer.BaseProvider;
import com.opengamma.strata.pricer.DiscountFactors;
import com.opengamma.strata.pricer.ZeroRateSensitivity;
import com.opengamma.strata.pricer.fx.FxForwardRates;
import com.opengamma.strata.pricer.fx.FxForwardSensitivity;
import com.opengamma.strata.pricer.fx.FxIndexRates;
import com.opengamma.strata.pricer.fx.FxIndexSensitivity;

/**
 * A provider of rates, such as Ibor and Overnight, used for pricing financial instruments.
 * <p>
 * This provides the environmental information against which pricing occurs.
 * The valuation date, FX rates, discount factors, time-series and forward curves are included.
 * <p>
 * The standard independent implementation is {@link ImmutableRatesProvider}.
 * <p>
 * All implementations of this interface must be immutable and thread-safe.
 */
public interface RatesProvider
    extends BaseProvider {

  /**
   * Gets the set of Ibor indices that are available.
   * <p>
   * If an index is present in the result of this method, then
   * {@link #iborIndexRates(IborIndex)} should not throw an exception.
   *
   * @return the set of Ibor indices
   */
  public abstract Set<IborIndex> getIborIndices();

  /**
   * Gets the set of Overnight indices that are available.
   * <p>
   * If an index is present in the result of this method, then
   * {@link #overnightIndexRates(OvernightIndex)} should not throw an exception.
   *
   * @return the set of Overnight indices
   */
  public abstract Set<OvernightIndex> getOvernightIndices();

  /**
   * Gets the set of Price indices that are available.
   * <p>
   * If an index is present in the result of this method, then
   * {@link #priceIndexValues(PriceIndex)} should not throw an exception.
   *
   * @return the set of Price indices
   */
  public abstract Set<PriceIndex> getPriceIndices();

  /**
   * Gets the set of indices that have time-series available.
   * <p>
   * Note that the method {@link #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.
   *
   * @return the set of indices with time-series
   */
  public default Set<Index> getTimeSeriesIndices() {
    // imperfect implementation for compatibility
    return ImmutableSet.<Index>builder()
        .addAll(getIborIndices())
        .addAll(getOvernightIndices())
        .addAll(getPriceIndices())
        .build();
  }

  //-------------------------------------------------------------------------
  /**
   * Gets the rates for an FX index.
   * <p><commit_msg>Change interface method to be abstract (#1718)<commit_after>/*
 * Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.strata.pricer.rate;

import java.util.Optional;
import java.util.Set;

import com.opengamma.strata.basics.currency.CurrencyPair;
import com.opengamma.strata.basics.currency.MultiCurrencyAmount;
import com.opengamma.strata.basics.index.FxIndex;
import com.opengamma.strata.basics.index.IborIndex;
import com.opengamma.strata.basics.index.Index;
import com.opengamma.strata.basics.index.OvernightIndex;
import com.opengamma.strata.basics.index.PriceIndex;
import com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeries;
import com.opengamma.strata.data.MarketDataName;
import com.opengamma.strata.market.curve.Curve;
import com.opengamma.strata.market.curve.CurveName;
import com.opengamma.strata.market.param.CurrencyParameterSensitivities;
import com.opengamma.strata.market.sensitivity.PointSensitivities;
import com.opengamma.strata.market.sensitivity.PointSensitivity;
import com.opengamma.strata.pricer.BaseProvider;
import com.opengamma.strata.pricer.DiscountFactors;
import com.opengamma.strata.pricer.ZeroRateSensitivity;
import com.opengamma.strata.pricer.fx.FxForwardRates;
import com.opengamma.strata.pricer.fx.FxForwardSensitivity;
import com.opengamma.strata.pricer.fx.FxIndexRates;
import com.opengamma.strata.pricer.fx.FxIndexSensitivity;

/**
 * A provider of rates, such as Ibor and Overnight, used for pricing financial instruments.
 * <p>
 * This provides the environmental information against which pricing occurs.
 * The valuation date, FX rates, discount factors, time-series and forward curves are included.
 * <p>
 * The standard independent implementation is {@link ImmutableRatesProvider}.
 * <p>
 * All implementations of this interface must be immutable and thread-safe.
 */
public interface RatesProvider
    extends BaseProvider {

  /**
   * Gets the set of Ibor indices that are available.
   * <p>
   * If an index is present in the result of this method, then
   * {@link #iborIndexRates(IborIndex)} should not throw an exception.
   *
   * @return the set of Ibor indices
   */
  public abstract Set<IborIndex> getIborIndices();

  /**
   * Gets the set of Overnight indices that are available.
   * <p>
   * If an index is present in the result of this method, then
   * {@link #overnightIndexRates(OvernightIndex)} should not throw an exception.
   *
   * @return the set of Overnight indices
   */
  public abstract Set<OvernightIndex> getOvernightIndices();

  /**
   * Gets the set of Price indices that are available.
   * <p>
   * If an index is present in the result of this method, then
   * {@link #priceIndexValues(PriceIndex)} should not throw an exception.
   *
   * @return the set of Price indices
   */
  public abstract Set<PriceIndex> getPriceIndices();

  /**
   * Gets the set of indices that have time-series available.
   * <p>
   * Note that the method {@link #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.
   *
   * @return the set of indices with time-series
   */
  public abstract Set<Index> getTimeSeriesIndices();

  //-------------------------------------------------------------------------
  /**
   * Gets the rates for an FX index.
   * <p>
{'fraction_non_alphanumeric': 0.11145123139000974, 'fraction_numerical': 0.0016696813691387227, 'mean_word_length': 3.7634194831013916, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6205950', 'n_tokens_mistral': 2166, 'n_tokens_neox': 2129, 'n_words': 631}