public void TestInitialize()
        {
            symbol1 = "INFY";
            symbol2 = "WIPRO";
            tick1   = new Tick(1, symbol1, 0.1, DateTime.Now);
            tick2   = new Tick(2, symbol2, 2.1, DateTime.Now);

            strategy1 = new Mock <IStrategy>();
            strategy1.Setup(s => s.Name).Returns("strategy1");
            strategy1.Setup(s => s.Symbol).Returns(symbol1);
            strategy1.Setup(s => s.OnTick(It.IsNotNull <Tick>())).Verifiable();

            strategy2 = new Mock <IStrategy>();
            strategy2.Setup(s => s.Name).Returns("strategy2");
            strategy2.Setup(s => s.Symbol).Returns(symbol2);
            strategy2.Setup(s => s.OnTick(It.IsNotNull <Tick>())).Verifiable();


            IUnityContainer container = new UnityContainer();

            container.RegisterType <IFeedProvider, CsvFeedProvider>();
            List <IFeedProvider> feedProviders = new List <IFeedProvider>();
            var symbol1FeedProvider            = container.Resolve <IFeedProvider>(new ResolverOverride[] { new ParameterOverride("symbol", symbol1) });
            var symbol2FeedProvider            = container.Resolve <IFeedProvider>(new ResolverOverride[] { new ParameterOverride("symbol", symbol2) });

            feedProviders.Add(symbol1FeedProvider);
            feedProviders.Add(symbol2FeedProvider);
            FeedAggregator feedAggregator = new FeedAggregator(feedProviders);

            dataFeed = new DataFeed(feedAggregator);
        }
Beispiel #2
0
        private int previousTickId = 0;//potential risk in multithreaded environment???? need to check


        //constructor
        public DataFeed(FeedAggregator feedAggregator)
        {
            this.FeedAggregator          = feedAggregator;
            FeedAggregator.NewTickEvent += OnNewTick;
            Start();
        }