//------------------------------------------------------------------------- /// <summary> /// Combines a number of rates providers. /// <para> /// If the two providers have curves or time series for the same currency or index, /// an <seealso cref="IllegalAccessException"/> is thrown. /// The FxRateProviders is not populated with the given provider; no attempt is done on merging the embedded FX providers. /// /// </para> /// </summary> /// <param name="fx"> the FX provider for the resulting rate provider </param> /// <param name="providers"> the rates providers to be merged </param> /// <returns> the combined rates provider </returns> public static ImmutableRatesProvider combined(FxRateProvider fx, params ImmutableRatesProvider[] providers) { ArgChecker.isTrue(providers.Length > 0, "at least one provider requested"); ImmutableRatesProvider merged = ImmutableRatesProvider.builder(providers[0].ValuationDate).build(); foreach (ImmutableRatesProvider provider in providers) { merged = merged.combinedWith(provider, fx); } return(merged); }