예제 #1
0
 public void TestNotionalWeightedBasket()
 {
     var basketAggregator = new BasketDataAggregator(new RolloverLogic());
     var basket = basketAggregator.AggregateBasketCollections(new[] {basketTur, basketZar});
 }
예제 #2
0
        public void BasketShouldAggregate()
        {
            // Test sum of the basket
            Mock<IRolloverLogic> rollOverMock = new Mock<IRolloverLogic>();
            rollOverMock.SetupGet(t => t.Carry1d).Returns(0.08);
            rollOverMock.Setup(t => t.RollOverDataSeriesWithCarry(basketA.Item2, It.IsAny<double>())).Returns(new DatedDataCollectionGen<double>(dates, new []
                                                                                        {
                                                                                            0.21,
                                                                                            0.33,
                                                                                            0.11,
                                                                                            0.14,
                                                                                            0.23,
                                                                                            0,
                                                                                            -0.29,
                                                                                            -0.12,
                                                                                            0.2,
                                                                                            0.38,
                                                                                        }));
            rollOverMock.Setup(t => t.RollOverDataSeriesWithCarry(basketB.Item2, It.IsAny<double>())).Returns(new DatedDataCollectionGen<double>(dates, new[]
                                                                                        {
                                                                                             -0.13,
                                                                                            -0.2,
                                                                                            -0.78,
                                                                                            0.22,
                                                                                            0.17,
                                                                                            -0.2,
                                                                                            -0.48,
                                                                                            -0.09,
                                                                                            -0.21,
                                                                                            0.02,
                                                                                        }));
            rollOverMock.Setup(t => t.RollOverDataSeriesWithCarry(basketC.Item2, It.IsAny<double>())).Returns(new DatedDataCollectionGen<double>(dates, new[]
                                                                                        {
                                                                                            0.13,
                                                                                            0.2,
                                                                                            0.11,
                                                                                            0.16,
                                                                                            0.04,
                                                                                            -0.04,
                                                                                            0.05,
                                                                                            -0.1,
                                                                                            0.074,
                                                                                            0.073,
                                                                                        }));

            rollOverMock.Setup(t => t.ComputeCarry(It.IsAny<string>()));
            
            var basketAggregator = new BasketDataAggregator(rollOverMock.Object);
            var aggregatedValues = basketAggregator.AggregateBasketCollections(new Tuple<CustomBasket, DatedDataCollectionGen<double>>[]
                                                                                            {
                                                                                                basketA,
                                                                                                basketB,
                                                                                                basketC,
                                                                                            });

            CompareTwoSeries(aggregatedValues, new DatedDataCollectionGen<double>(dates, new[]
                                                                                        {
                                                                                            0.188,
                                                                                            0.292,
                                                                                            0.467,
                                                                                            -0.006,
                                                                                            0.019,
                                                                                            0.088,
                                                                                            0.139,
                                                                                            -0.033,
                                                                                            0.2072,
                                                                                            0.1639,
                                                                                        }));


        }