Ejemplo n.º 1
0
        public void putTimeEvents(DateTime time)
        {
            ConcurrentDictionary <String, String> stgNamesMap = stgManager.getActiveStgNamesMap();
            AppTimeEvent timeEvent = new AppTimeEvent();

            timeEvent.eventTime = time;
            stgNamesMap.Keys.ToArray();
            foreach (String name in stgNamesMap.Keys)
            {
                storeEventQueue[name].Add(timeEvent);
            }

            IAppMainteanceManager maintenanceManager = stgManager.getAppMainteanceManager();

            if (maintenanceManager != null)
            {
                maintenanceManager.storeEventQueue.Add(timeEvent);
            }
        }
        public void test_putTimeEvents()
        {
            IAppStrategyManager stgManager    = getAppStrategyManager_for_putEvents();
            AppEventManager     eventManager  = new AppEventManager(stgManager);
            DateTime            afterSetTime  = new DateTime(2015, 11, 21, 9, 15, 55, DateTimeKind.Local);
            DateTime            afterSetTime2 = new DateTime(2015, 11, 21, 9, 16, 0, DateTimeKind.Local);

            eventManager.putTimeEvents(afterSetTime);
            eventManager.putTimeEvents(afterSetTime2);
            Assert.AreEqual(2, eventManager.storeEventQueue["S1_RND1"].Count);
            Assert.AreEqual(0, eventManager.storeEventQueue["S2_RBREAK_REVERSE1"].Count);
            Assert.AreEqual(2, eventManager.storeEventQueue["S3_RBREAK_TREND1"].Count);
            Assert.AreEqual(2, stgManager.getAppMainteanceManager().storeEventQueue.Count);
        }
        public void test_putTickPriceEvents()
        {
            IAppStrategyManager stgManager   = getAppStrategyManager_for_putEvents();
            AppEventManager     eventManager = new AppEventManager(stgManager);

            TickPriceMessage tickMessage1 = new TickPriceMessage(200001, 4, 22000, 0);
            TickPriceMessage tickMessage2 = new TickPriceMessage(200002, 1, 22100, 0);

            MarketDataMessage dataMessage = (MarketDataMessage)tickMessage1;

            eventManager.putTickPriceEvents(tickMessage1, dataMessage);
            dataMessage = (MarketDataMessage)tickMessage2;
            eventManager.putTickPriceEvents(tickMessage2, dataMessage);
            Assert.AreEqual(2, eventManager.storeEventQueue["S1_RND1"].Count);
            Assert.AreEqual(0, eventManager.storeEventQueue["S2_RBREAK_REVERSE1"].Count);
            Assert.AreEqual(2, eventManager.storeEventQueue["S3_RBREAK_TREND1"].Count);
            Assert.AreEqual(0, stgManager.getAppMainteanceManager().storeEventQueue.Count);
        }