예제 #1
0
        public virtual void combineWithScenarioBoxWithWrongNumberOfScenarios()
        {
            MarketDataBox <int> box      = MarketDataBox.ofScenarioValues(27, 28, 29);
            MarketDataBox <int> otherBox = MarketDataBox.ofScenarioValues(15, 16, 17, 18);

            assertThrows(() => box.combineWith(otherBox, (v1, v2) => v1 + v2), typeof(System.ArgumentException), "Scenario values must have the same number of scenarios.*");
        }
예제 #2
0
        public virtual void relative()
        {
            IList <LabelDateParameterMetadata> nodeMetadata = ImmutableList.of(LabelDateParameterMetadata.of(date(2011, 3, 8), TNR_1M), LabelDateParameterMetadata.of(date(2011, 5, 8), TNR_3M), LabelDateParameterMetadata.of(date(2011, 8, 8), TNR_6M));

            // This should create 4 scenarios. Scenario zero has no shifts and scenario 3 doesn't have shifts on all nodes
            PointShifts shift = PointShifts.builder(ShiftType.RELATIVE).addShift(1, TNR_1W, 0.1).addShift(1, TNR_1M, 0.2).addShift(1, TNR_3M, 0.3).addShift(2, TNR_1M, 0.4).addShift(2, TNR_3M, 0.5).addShift(2, TNR_6M, 0.6).addShift(3, TNR_3M, 0.7).build();

            Curve curve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("curve"), DayCounts.ACT_365F, nodeMetadata), DoubleArray.of(1, 2, 3), DoubleArray.of(5, 6, 7), INTERPOLATOR);

            MarketDataBox <ParameterizedData> shiftedCurveBox = shift.applyTo(MarketDataBox.ofSingleValue(curve), REF_DATA);

            Curve scenario1Curve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("curve"), DayCounts.ACT_365F, nodeMetadata), DoubleArray.of(1, 2, 3), DoubleArray.of(6, 7.8, 7), INTERPOLATOR);

            Curve scenario2Curve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("curve"), DayCounts.ACT_365F, nodeMetadata), DoubleArray.of(1, 2, 3), DoubleArray.of(7, 9, 11.2), INTERPOLATOR);

            Curve scenario3Curve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("curve"), DayCounts.ACT_365F, nodeMetadata), DoubleArray.of(1, 2, 3), DoubleArray.of(5, 10.2, 7), INTERPOLATOR);

            // Scenario zero has no perturbations so the expected curve is the same as the input
            IList <Curve> expectedCurves = ImmutableList.of(curve, scenario1Curve, scenario2Curve, scenario3Curve);

            for (int scenarioIndex = 0; scenarioIndex < 4; scenarioIndex++)
            {
                // Check every point from 0 to 4 in steps of 0.1 is the same on the bumped curve and the expected curve
                for (int xIndex = 0; xIndex <= 40; xIndex++)
                {
                    double xValue        = xIndex * 0.1;
                    Curve  expectedCurve = expectedCurves[scenarioIndex];
                    Curve  shiftedCurve  = (Curve)shiftedCurveBox.getValue(scenarioIndex);
                    double shiftedY      = shiftedCurve.yValue(xValue);
                    double expectedY     = expectedCurve.yValue(xValue);
                    assertThat(shiftedY).overridingErrorMessage("Curve differed in scenario %d at x value %f, expected %f, actual %f", scenarioIndex, xValue, expectedY, shiftedY).isEqualTo(expectedY);
                }
            }
        }
예제 #3
0
        public virtual void test_of_repeated()
        {
            ScenarioMarketData test = ScenarioMarketData.of(1, MarketData.of(VAL_DATE, ImmutableMap.of(ID1, VAL1)));

            assertThat(test.ValuationDate).isEqualTo(MarketDataBox.ofSingleValue(VAL_DATE));
            assertThat(test.getValue(ID1)).isEqualTo(MarketDataBox.ofSingleValue(VAL1));
        }
예제 #4
0
        public virtual void map()
        {
            MarketDataBox <int> box    = MarketDataBox.ofScenarioValues(27, 28, 29);
            MarketDataBox <int> result = box.map(v => v * 2);

            assertThat(result).isEqualTo(MarketDataBox.ofScenarioValues(54, 56, 58));
        }
예제 #5
0
        public virtual void isSingleOrScenarioValue()
        {
            MarketDataBox <int> box = MarketDataBox.ofScenarioValues(27, 28, 29);

            assertThat(box.SingleValue).False;
            assertThat(box.ScenarioValue).True;
        }
예제 #6
0
        /// <summary>
        /// Test that inputs are correctly built from market data.
        /// </summary>
        public virtual void build()
        {
            FraCurveNode node1x4 = fraNode(1, "a");
            FraCurveNode node2x5 = fraNode(2, "b");
            FraCurveNode node3x6 = fraNode(3, "c");

            InterpolatedNodalCurveDefinition curveDefn = InterpolatedNodalCurveDefinition.builder().name(CurveName.of("curve")).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(DayCounts.ACT_ACT_ISDA).interpolator(CurveInterpolators.DOUBLE_QUADRATIC).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).nodes(node1x4, node2x5, node3x6).build();

            RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("curve group")).addDiscountCurve(curveDefn, Currency.USD).build();

            MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupDefn.Name, groupDefn).build();

            QuoteId idA = QuoteId.of(StandardId.of("test", "a"));
            QuoteId idB = QuoteId.of(StandardId.of("test", "b"));
            QuoteId idC = QuoteId.of(StandardId.of("test", "c"));

            ScenarioMarketData marketData = ImmutableScenarioMarketData.builder(VAL_DATE).addValue(idA, 1d).addValue(idB, 2d).addValue(idC, 3d).build();

            RatesCurveInputsMarketDataFunction marketDataFunction = new RatesCurveInputsMarketDataFunction();
            RatesCurveInputsId curveInputsId        = RatesCurveInputsId.of(groupDefn.Name, curveDefn.Name, ObservableSource.NONE);
            MarketDataBox <RatesCurveInputs> result = marketDataFunction.build(curveInputsId, marketDataConfig, marketData, REF_DATA);

            RatesCurveInputs curveInputs = result.SingleValue;

            assertThat(curveInputs.MarketData.get(idA)).isEqualTo(1d);
            assertThat(curveInputs.MarketData.get(idB)).isEqualTo(2d);
            assertThat(curveInputs.MarketData.get(idC)).isEqualTo(3d);

            IList <ParameterMetadata> expectedMetadata = ImmutableList.of(node1x4.metadata(VAL_DATE, REF_DATA), node2x5.metadata(VAL_DATE, REF_DATA), node3x6.metadata(VAL_DATE, REF_DATA));

            assertThat(curveInputs.CurveMetadata.ParameterMetadata).hasValue(expectedMetadata);
        }
예제 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public <T> com.opengamma.strata.data.scenario.MarketDataBox<T> getValue(com.opengamma.strata.data.MarketDataId<T> id)
        public override MarketDataBox <T> getValue <T>(MarketDataId <T> id)
        {
            // this code exists to ensure that the error messages from market data building
            // are exposed to users when the failures are not checked

            // a special case for FX rates containing the same currency twice
            if (id is FxRateId && ((FxRateId)id).Pair.Identity)
            {
                FxRateId fxRateId     = (FxRateId)id;
                FxRate   identityRate = FxRate.of(fxRateId.Pair, 1);
                return(MarketDataBox.ofSingleValue((T)identityRate));
            }

            // find the data and check it against the failures
            Optional <MarketDataBox <T> > opt = underlying.findValue(id);

            if (!opt.Present)
            {
                Failure failure = valueFailures.get(id);
                if (failure != null)
                {
                    throw new FailureException(failure);
                }
                throw new MarketDataNotFoundException(Messages.format("Market data not found for identifier '{}' of type '{}'", id, id.GetType().Name));
            }
            return(opt.get());
        }
예제 #8
0
        public virtual void map()
        {
            MarketDataBox <int> box    = MarketDataBox.ofSingleValue(27);
            MarketDataBox <int> result = box.map(v => v * 2);

            assertThat(result).isEqualTo(MarketDataBox.ofSingleValue(54));
        }
예제 #9
0
        public virtual void stream()
        {
            MarketDataBox <int> box  = MarketDataBox.ofSingleValue(27);
            IList <int>         list = box.ToList();

            assertThat(list).isEqualTo(ImmutableList.of(27));
        }
        /// <summary>
        /// Tests the combinedWith method when the other set of market data is not an instance of ImmutableScenarioMarketData
        /// </summary>
        public virtual void test_combinedWithDifferentImpl()
        {
            LocalDateDoubleTimeSeries timeSeries1 = LocalDateDoubleTimeSeries.builder().put(date(2011, 3, 8), 1).put(date(2011, 3, 9), 2).put(date(2011, 3, 10), 3).build();

            LocalDateDoubleTimeSeries timeSeries2 = LocalDateDoubleTimeSeries.builder().put(date(2011, 3, 8), 10).put(date(2011, 3, 9), 20).put(date(2011, 3, 10), 30).build();

            LocalDateDoubleTimeSeries timeSeries2a = LocalDateDoubleTimeSeries.builder().put(date(2011, 3, 8), 1000).put(date(2011, 3, 9), 2000).put(date(2011, 3, 10), 3000).build();

            LocalDateDoubleTimeSeries timeSeries3 = LocalDateDoubleTimeSeries.builder().put(date(2011, 3, 8), 100).put(date(2011, 3, 9), 200).put(date(2011, 3, 10), 300).build();

            MarketData marketData = ImmutableMarketData.builder(LocalDate.of(2011, 3, 8)).addTimeSeries(TEST_ID1, timeSeries1).addTimeSeries(TEST_ID2, timeSeries2).addValue(TEST_ID1, 1.1).addValue(TEST_ID2, 1.2).build();

            RepeatedScenarioMarketData repeatedScenarioMarketData = RepeatedScenarioMarketData.of(3, marketData);

            ImmutableScenarioMarketData immutableScenarioMarketData = ImmutableScenarioMarketData.builder(LocalDate.of(2011, 3, 8)).addTimeSeries(TEST_ID2, timeSeries2a).addTimeSeries(TEST_ID3, timeSeries3).addBox(TEST_ID2, MarketDataBox.ofScenarioValues(2.0, 2.1, 2.2)).addBox(TEST_ID3, MarketDataBox.ofScenarioValues(3.0, 3.1, 3.2)).build();

            ScenarioMarketData combinedData = immutableScenarioMarketData.combinedWith(repeatedScenarioMarketData);

            assertThat(combinedData.ScenarioCount).isEqualTo(3);
            assertThat(combinedData.getValue(TEST_ID1).getValue(0)).isEqualTo(1.1);
            assertThat(combinedData.getValue(TEST_ID1).getValue(2)).isEqualTo(1.1);
            assertThat(combinedData.getValue(TEST_ID1).getValue(3)).isEqualTo(1.1);
            assertThat(combinedData.getValue(TEST_ID2)).isEqualTo(MarketDataBox.ofScenarioValues(2.0, 2.1, 2.2));
            assertThat(combinedData.getValue(TEST_ID3)).isEqualTo(MarketDataBox.ofScenarioValues(3.0, 3.1, 3.2));
            assertThat(combinedData.getTimeSeries(TEST_ID1)).isEqualTo(timeSeries1);
            assertThat(combinedData.getTimeSeries(TEST_ID2)).isEqualTo(timeSeries2a);
            assertThat(combinedData.getTimeSeries(TEST_ID3)).isEqualTo(timeSeries3);
        }
예제 #11
0
        private static int scenarioCount(MarketDataBox <LocalDate> valuationDate, IList <MarketDataBox <RatesCurveInputs> > curveInputBoxes)
        {
            int scenarioCount = 0;

            if (valuationDate.ScenarioValue)
            {
                scenarioCount = valuationDate.ScenarioCount;
            }
            foreach (MarketDataBox <RatesCurveInputs> box in curveInputBoxes)
            {
                if (box.ScenarioValue)
                {
                    int boxScenarioCount = box.ScenarioCount;

                    if (scenarioCount == 0)
                    {
                        scenarioCount = boxScenarioCount;
                    }
                    else
                    {
                        if (scenarioCount != boxScenarioCount)
                        {
                            throw new System.ArgumentException(Messages.format("All boxes must have the same number of scenarios, current count = {}, box {} has {}", scenarioCount, box, box.ScenarioCount));
                        }
                    }
                }
            }
            if (scenarioCount != 0)
            {
                return(scenarioCount);
            }
            // This shouldn't happen, this method is only called after checking at least one of the values contains data
            // for multiple scenarios.
            throw new System.ArgumentException("Cannot count the scenarios, all data contained single values");
        }
예제 #12
0
        public virtual void stream()
        {
            MarketDataBox <int> box  = MarketDataBox.ofScenarioValues(27, 28, 29);
            IList <int>         list = box.ToList();

            assertThat(list).isEqualTo(ImmutableList.of(27, 28, 29));
        }
예제 #13
0
        /// <summary>
        /// Test that the box always returns the same value for any non-negative scenario index.
        /// </summary>
        public virtual void getValue()
        {
            MarketDataBox <int> box = MarketDataBox.ofSingleValue(27);

            assertThat(box.getValue(0)).isEqualTo(27);
            assertThat(box.getValue(int.MaxValue)).isEqualTo(27);
            assertThrows(() => box.getValue(-1), typeof(System.ArgumentException));
        }
예제 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public <T> java.util.Optional<MarketDataBox<T>> findValue(com.opengamma.strata.data.MarketDataId<T> id)
        public Optional <MarketDataBox <T> > findValue <T>(MarketDataId <T> id)
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") MarketDataBox<T> value = (MarketDataBox<T>) values.get(id);
            MarketDataBox <T> value = (MarketDataBox <T>)values.get(id);

            return(Optional.ofNullable(value));
        }
예제 #15
0
        public virtual void combineWithSingleBox()
        {
            MarketDataBox <int> box       = MarketDataBox.ofSingleValue(27);
            MarketDataBox <int> otherBox  = MarketDataBox.ofSingleValue(15);
            MarketDataBox <int> resultBox = box.combineWith(otherBox, (v1, v2) => v1 + v2);

            assertThat(resultBox.SingleValue).True;
            assertThat(resultBox.getValue(0)).isEqualTo(42);
        }
        private MarketDataBox <R> combineWithMultiple <U, R>(MarketDataBox <U> other, System.Func <T, U, R> fn)
        {
            ScenarioArray <U> otherValue = other.ScenarioValue;
            int scenarioCount            = otherValue.ScenarioCount;

            IList <R> values = IntStream.range(0, scenarioCount).mapToObj(i => fn(value, other.getValue(i))).collect(toImmutableList());

            return(MarketDataBox.ofScenarioValues(values));
        }
예제 #17
0
        public virtual void getScenarioValueFromOtherScenarioValue()
        {
            MarketDataBox <double> box        = MarketDataBox.ofScenarioValues(9d, 9d, 9d);
            TestMarketData         marketData = new TestMarketData(box);
            TestArrayKey           key        = new TestArrayKey();
            TestDoubleArray        array      = marketData.getScenarioValue(key);

            assertThat(array.values).isEqualTo(DoubleArray.of(9, 9, 9));
        }
 private ExtendedScenarioMarketData(MarketDataId <T> id, MarketDataBox <T> value, ScenarioMarketData underlying)
 {
     JodaBeanUtils.notNull(id, "id");
     JodaBeanUtils.notNull(value, "value");
     JodaBeanUtils.notNull(underlying, "underlying");
     this.id         = id;
     this.value      = value;
     this.underlying = underlying;
     validate();
 }
예제 #19
0
        public virtual void buildInverse()
        {
            FxRateMarketDataFunction function   = new FxRateMarketDataFunction();
            MarketDataBox <double>   quoteBox   = MarketDataBox.ofSingleValue(1.1d);
            ScenarioMarketData       marketData = ImmutableScenarioMarketData.builder(LocalDate.of(2011, 3, 8)).addBox(QUOTE_ID, quoteBox).build();
            MarketDataBox <FxRate>   rateBox    = function.build(FxRateId.of(CURRENCY_PAIR.inverse()), config(), marketData, REF_DATA);

            assertThat(rateBox.SingleValue).True;
            assertThat(rateBox.SingleValue).isEqualTo(FxRate.of(CURRENCY_PAIR, 1.1d));
        }
        public MarketDataBox <R> mapWithIndex <R>(int scenarioCount, ObjIntFunction <T, R> fn)
        {
            if (scenarioCount != ScenarioCount)
            {
                throw new System.ArgumentException(Messages.format("Scenario count {} does not equal the scenario count of the value {}", scenarioCount, ScenarioCount));
            }
            IList <R> perturbedValues = IntStream.range(0, scenarioCount).mapToObj(idx => fn.apply(getValue(idx), idx)).collect(toImmutableList());

            return(MarketDataBox.ofScenarioValues(perturbedValues));
        }
예제 #21
0
        public virtual void getScenarioValue()
        {
            MarketDataBox <int> box           = MarketDataBox.ofScenarioValues(27, 28, 29);
            ScenarioArray <int> scenarioValue = box.ScenarioValue;

            assertThat(scenarioValue.ScenarioCount).isEqualTo(3);
            assertThat(scenarioValue.get(0)).isEqualTo(27);
            assertThat(scenarioValue.get(1)).isEqualTo(28);
            assertThat(scenarioValue.get(2)).isEqualTo(29);
        }
예제 #22
0
        public virtual void getValue()
        {
            MarketDataBox <int> box = MarketDataBox.ofScenarioValues(27, 28, 29);

            assertThat(box.getValue(0)).isEqualTo(27);
            assertThat(box.getValue(1)).isEqualTo(28);
            assertThat(box.getValue(2)).isEqualTo(29);
            assertThrows(() => box.getValue(-1), typeof(System.ArgumentException), "Expected 0 <= 'scenarioIndex' < 3, but found -1");
            assertThrows(() => box.getValue(3), typeof(System.ArgumentException), "Expected 0 <= 'scenarioIndex' < 3, but found 3");
        }
예제 #23
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));
        }
예제 #24
0
        /// <summary>
        /// Creates a builder pre-populated with the valuation date.
        /// </summary>
        /// <param name="valuationDate">  the valuation date associated with the market data </param>
        internal BuiltScenarioMarketDataBuilder(MarketDataBox <LocalDate> valuationDate)
        {
            ArgChecker.notNull(valuationDate, "valuationDate");

            if (valuationDate.ScenarioCount == 0)
            {
                throw new System.ArgumentException("Valuation date must not be empty");
            }
            updateScenarioCount(valuationDate);
            this.valuationDate = valuationDate;
        }
        private MarketDataBox <R> combineWithMultiple <R, U>(MarketDataBox <U> other, System.Func <T, U, R> fn)
        {
            ScenarioArray <U> otherValue = other.ScenarioValue;

            if (otherValue.ScenarioCount != value.ScenarioCount)
            {
                string message = Messages.format("Scenario values must have the same number of scenarios. {} has {} scenarios, {} has {}", value, value.ScenarioCount, otherValue, otherValue.ScenarioCount);
                throw new System.ArgumentException(message);
            }
            return(applyToScenarios(i => fn(value.get(i), otherValue.get(i))));
        }
예제 #26
0
        /// <summary>
        /// Tests that applying a function multiple times to the value creates a box of scenario values.
        /// </summary>
        public virtual void mapWithIndex()
        {
            MarketDataBox <int> box         = MarketDataBox.ofScenarioValues(27, 28, 29);
            MarketDataBox <int> scenarioBox = box.mapWithIndex(3, (v, idx) => v + idx);

            assertThat(scenarioBox.ScenarioValue).True;
            assertThat(scenarioBox.ScenarioCount).isEqualTo(3);
            assertThat(scenarioBox.getValue(0)).isEqualTo(27);
            assertThat(scenarioBox.getValue(1)).isEqualTo(29);
            assertThat(scenarioBox.getValue(2)).isEqualTo(31);
        }
예제 #27
0
        // one valuation date, one set of market data
        private MarketDataBox <RatesCurveInputs> buildSingleCurveInputs <T1>(CurveDefinition filteredDefn, IDictionary <T1> marketData, LocalDate valuationDate, ReferenceData refData) where T1 : com.opengamma.strata.data.MarketDataId <T1>
        {
            // There is only a single map of values and single valuation date - create a single CurveInputs instance
            CurveMetadata curveMetadata = filteredDefn.metadata(valuationDate, refData);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<? extends com.opengamma.strata.data.MarketDataId<?>, ?> singleMarketDataValues = com.opengamma.strata.collect.MapStream.of(marketData).mapValues(box -> box.getSingleValue()).toMap();
            IDictionary <MarketDataId <object>, ?> singleMarketDataValues = MapStream.of(marketData).mapValues(box => box.SingleValue).toMap();

            RatesCurveInputs curveInputs = RatesCurveInputs.of(singleMarketDataValues, curveMetadata);

            return(MarketDataBox.ofSingleValue(curveInputs));
        }
예제 #28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public <T> MarketDataBox<T> getValue(com.opengamma.strata.data.MarketDataId<T> id)
        public override MarketDataBox <T> getValue <T>(MarketDataId <T> id)
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") MarketDataBox<T> value = (MarketDataBox<T>) values.get(id);
            MarketDataBox <T> value = (MarketDataBox <T>)values.get(id);

            if (value == null)
            {
                throw new MarketDataNotFoundException(msgValueNotFound(id));
            }
            return(value);
        }
예제 #29
0
        public virtual void test_none()
        {
            ScenarioPerturbation <double> test = ScenarioPerturbation.none();

            assertEquals(test.ScenarioCount, 1);
            MarketDataBox <double> box1 = MarketDataBox.ofScenarioValues(1d, 2d, 3d);

            assertEquals(test.applyTo(box1, REF_DATA), box1);
            MarketDataBox <double> box2 = MarketDataBox.ofSingleValue(1d);

            assertEquals(test.applyTo(box2, REF_DATA), box2);
        }
예제 #30
0
        public virtual void combineWithScenarioBox()
        {
            MarketDataBox <int> box       = MarketDataBox.ofScenarioValues(27, 28, 29);
            MarketDataBox <int> otherBox  = MarketDataBox.ofScenarioValues(15, 16, 17);
            MarketDataBox <int> resultBox = box.combineWith(otherBox, (v1, v2) => v1 + v2);

            assertThat(resultBox.ScenarioValue).True;
            assertThat(resultBox.ScenarioCount).isEqualTo(3);
            assertThat(resultBox.getValue(0)).isEqualTo(42);
            assertThat(resultBox.getValue(1)).isEqualTo(44);
            assertThat(resultBox.getValue(2)).isEqualTo(46);
        }