Ejemplo n.º 1
0
        // calibrates when there is a single group
        private MarketDataBox <RatesCurveGroup> buildSingleCurveGroup(RatesCurveGroupDefinition configuredGroup, RatesCurveCalibrator calibrator, LocalDate valuationDate, IList <MarketDataBox <RatesCurveInputs> > inputBoxes, IDictionary <ObservableId, LocalDateDoubleTimeSeries> fixings, ReferenceData refData)
        {
            RatesCurveGroupDefinition filteredGroup = configuredGroup.filtered(valuationDate, refData);
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            IList <RatesCurveInputs> inputs = inputBoxes.Select(MarketDataBox::getSingleValue).collect(toImmutableList());
            MarketData      inputValues     = inputsByKey(valuationDate, inputs, fixings);
            RatesCurveGroup curveGroup      = buildGroup(filteredGroup, calibrator, inputValues, refData);

            return(MarketDataBox.ofSingleValue(curveGroup));
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void test_filtered()
        {
            DummyFraCurveNode node1 = DummyFraCurveNode.of(Period.ofDays(5), GBP_LIBOR_1M, GBP_LIBOR_1M_ID);
            DummyFraCurveNode node2 = DummyFraCurveNode.of(Period.ofDays(10), GBP_LIBOR_1M, GBP_LIBOR_1M_ID);
            DummyFraCurveNode node3 = DummyFraCurveNode.of(Period.ofDays(11), GBP_LIBOR_1M, GBP_LIBOR_1M_ID, DROP_THIS_2D);
            ImmutableList <DummyFraCurveNode> nodes = ImmutableList.of(node1, node2, node3);
            LocalDate valuationDate = date(2015, 6, 30);

            InterpolatedNodalCurveDefinition curveDefn = InterpolatedNodalCurveDefinition.builder().name(CURVE_NAME1).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).nodes(nodes).interpolator(CurveInterpolators.LINEAR).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build();
            RatesCurveGroupDefinition        test      = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addCurve(curveDefn, GBP, GBP_LIBOR_1M, GBP_LIBOR_3M).build();
            RatesCurveGroupDefinition        expected  = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addCurve(curveDefn.filtered(valuationDate, REF_DATA), GBP, GBP_LIBOR_1M, GBP_LIBOR_3M).build();

            assertEquals(test.filtered(valuationDate, REF_DATA), expected);
        }
Ejemplo n.º 3
0
        // calibrates when there are multiple groups
        private MarketDataBox <RatesCurveGroup> buildMultipleCurveGroups(RatesCurveGroupDefinition configuredGroup, RatesCurveCalibrator calibrator, MarketDataBox <LocalDate> valuationDateBox, IList <MarketDataBox <RatesCurveInputs> > inputBoxes, IDictionary <ObservableId, LocalDateDoubleTimeSeries> fixings, ReferenceData refData)
        {
            int scenarioCount = RatesCurveGroupMarketDataFunction.scenarioCount(valuationDateBox, inputBoxes);

            ImmutableList.Builder <RatesCurveGroup> builder = ImmutableList.builder();

            for (int i = 0; i < scenarioCount; i++)
            {
                LocalDate valuationDate = valuationDateBox.getValue(i);
                RatesCurveGroupDefinition filteredGroup   = configuredGroup.filtered(valuationDate, refData);
                IList <RatesCurveInputs>  curveInputsList = inputsForScenario(inputBoxes, i);
                MarketData inputs = inputsByKey(valuationDate, curveInputsList, fixings);
                builder.add(buildGroup(filteredGroup, calibrator, inputs, refData));
            }
            ImmutableList <RatesCurveGroup> curveGroups = builder.build();

            return(MarketDataBox.ofScenarioValues(curveGroups));
        }