public virtual void merge_content_2()
        {
            ImmutableRatesProvider test1  = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(GBP, DISCOUNT_CURVE_GBP).timeSeries(GBP_USD_WM, TS).build();
            ImmutableRatesProvider test2  = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(USD, DISCOUNT_CURVE_USD).iborIndexCurve(USD_LIBOR_3M, USD_LIBOR_CURVE).overnightIndexCurve(USD_FED_FUND, FED_FUND_CURVE).priceIndexCurve(GB_RPI, GBPRI_CURVE).timeSeries(GB_RPI, TS).build();
            ImmutableRatesProvider merged = ImmutableRatesProvider.combined(FX_MATRIX, test1, test2);

            assertEquals(merged.ValuationDate, VAL_DATE);
            assertEquals(merged.discountFactors(USD), DiscountFactors.of(USD, VAL_DATE, DISCOUNT_CURVE_USD));
            assertEquals(merged.discountFactors(GBP), DiscountFactors.of(GBP, VAL_DATE, DISCOUNT_CURVE_GBP));
            assertEquals(merged.iborIndexRates(USD_LIBOR_3M), IborIndexRates.of(USD_LIBOR_3M, VAL_DATE, USD_LIBOR_CURVE));
            assertEquals(merged.overnightIndexRates(USD_FED_FUND), OvernightIndexRates.of(USD_FED_FUND, VAL_DATE, FED_FUND_CURVE));
            assertEquals(merged.priceIndexValues(GB_RPI), PriceIndexValues.of(GB_RPI, VAL_DATE, GBPRI_CURVE, TS));
            assertEquals(merged.timeSeries(GBP_USD_WM), TS);
            assertEquals(merged.FxRateProvider, FX_MATRIX);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void test_of_noSeasonality()
        {
            SimplePriceIndexValues test = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);

            assertEquals(test.Index, US_CPI_U);
            assertEquals(test.ValuationDate, VAL_DATE);
            assertEquals(test.Curve, CURVE_NOFIX);
            assertEquals(test.ParameterCount, CURVE_NOFIX.ParameterCount);
            assertEquals(test.getParameter(0), CURVE_NOFIX.getParameter(0));
            assertEquals(test.getParameterMetadata(0), CURVE_NOFIX.getParameterMetadata(0));
            assertEquals(test.withParameter(0, 1d).Curve, CURVE_NOFIX.withParameter(0, 1d));
            assertEquals(test.withPerturbation((i, v, m) => v + 1d).Curve, CURVE_NOFIX.withPerturbation((i, v, m) => v + 1d));
            assertEquals(test.findData(CURVE_NOFIX.Name), CURVE_NOFIX);
            assertEquals(test.findData(CurveName.of("Rubbish")), null);
            // check PriceIndexValues
            PriceIndexValues test2 = PriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);

            assertEquals(test, test2);
        }