Beispiel #1
0
        /// <summary>
        /// Overrides required data events for backtesting strategy
        /// </summary>
        private void OverrideStrategyDataEvents()
        {
            //NOTE: LOCAL Data

            _tradeHubStrategy.OverrideTickSubscriptionRequest(_marketRequestListener.SubscribeTickData);
            _tradeHubStrategy.OverrideTickUnsubscriptionRequest(_marketRequestListener.UnsubscribeTickData);

            _tradeHubStrategy.OverrideBarSubscriptionRequest(_marketRequestListener.SubscribeLiveBars);
            _tradeHubStrategy.OverrideBarSubscriptionRequest(_marketRequestListener.SubscribeMultipleLiveBars);
            _tradeHubStrategy.OverriderBarUnsubscriptionRequest(_marketRequestListener.UnsubcribeLiveBars);
        }
        /// <summary>
        /// Overrides required data events for backtesting strategy
        /// </summary>
        private void OverrideStrategyDataEvents()
        {
            //NOTE: LOCAL Data

            _tradeHubStrategy.OverrideTickSubscriptionRequest(_marketRequestListener.SubscribeTickData);
            _tradeHubStrategy.OverrideTickUnsubscriptionRequest(_marketRequestListener.UnsubscribeTickData);

            _tradeHubStrategy.OverrideBarSubscriptionRequest(_marketRequestListener.SubscribeLiveBars);
            _tradeHubStrategy.OverrideBarSubscriptionRequest(_marketRequestListener.SubscribeMultipleLiveBars);
            _tradeHubStrategy.OverriderBarUnsubscriptionRequest(_marketRequestListener.UnsubcribeLiveBars);

            ////NOTE: SX Data
            //_tradeHubStrategy.InitializeMarketDataServiceDisruptor(new IEventHandler<RabbitMqMessage>[] { _marketDataListener });
        }
        public void OverRideTickRequestTestCase()
        {
            //_tradeHubStrategy.InitializeMarketDataServiceDisruptor(new IEventHandler<RabbitMqMessage>[] { this });
            Subscribe subscribe = SubscriptionMessage.TickSubscription("1", new Security()
            {
                Symbol = "AAPL"
            },
                                                                       "SimulatedExchange");

            _tradeHubStrategy.OverrideTickSubscriptionRequest(TickSubscribedRequestReceived);

            _tickRequestArrived = false;

            _manualTickRequestEvent = new ManualResetEvent(false);

            Thread.Sleep(5000);
            _tradeHubStrategy.Run();

            _manualTickRequestEvent.WaitOne(30000, false);

            Assert.AreEqual(true, _tickRequestArrived, "Tick Request Arrived");
        }