public virtual void test_getCurves_withGroup()
        {
            ImmutableRatesProvider test  = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(GBP, DISCOUNT_CURVE_GBP).discountCurve(USD, DISCOUNT_CURVE_USD).build();
            CurveGroupName         group = CurveGroupName.of("GRP");

            assertEquals(test.getCurves(group).Count, 2);
            assertEquals(test.getCurves(group)[CurveId.of(group, DISCOUNT_CURVE_GBP.Name)], DISCOUNT_CURVE_GBP);
            assertEquals(test.getCurves(group)[CurveId.of(group, DISCOUNT_CURVE_USD.Name)], DISCOUNT_CURVE_USD);
        }
示例#2
0
        public virtual void absoluteScenarios()
        {
            CurveName      curveName                  = CurveName.of("curveName");
            CurveGroupName curveGroupName             = CurveGroupName.of("curveGroupName");
            Curve          curve                      = ConstantCurve.of(curveName, 2);
            PerturbationMapping <Curve> mapping       = PerturbationMapping.of(MarketDataFilter.ofName(curveName), CurveParallelShifts.absolute(0.1, 0.2, 0.3));
            CurveId                curveId            = CurveId.of(curveGroupName, curveName);
            ScenarioMarketData     marketData         = ImmutableScenarioMarketData.builder(TestHelper.date(2011, 3, 8)).addValue(curveId, curve).build();
            ScenarioDefinition     scenarioDefinition = ScenarioDefinition.ofMappings(mapping);
            MarketDataFactory      marketDataFactory  = MarketDataFactory.of(mock(typeof(ObservableDataProvider)), mock(typeof(TimeSeriesProvider)));
            MarketDataRequirements requirements       = MarketDataRequirements.builder().addValues(curveId).build();
            ScenarioMarketData     scenarioData       = marketDataFactory.createMultiScenario(requirements, MarketDataConfig.empty(), marketData, REF_DATA, scenarioDefinition);
            MarketDataBox <Curve>  curves             = scenarioData.getValue(curveId);

            assertThat(curves.ScenarioCount).isEqualTo(3);
            checkCurveValues(curves.getValue(0), 2.1);
            checkCurveValues(curves.getValue(1), 2.2);
            checkCurveValues(curves.getValue(2), 2.3);
        }