Example #1
0
        public void SubscribeManySingleChannel()
        {
            for (int i = 0; i < 10; i++)
            {
                _subscriptionManager.Subscribe(GetSubscriptionDataConfig <TradeBar>(Symbols.AAPL, Resolution.Minute));
                Assert.Contains(Symbols.AAPL, _subscriptionManager.GetSubscribedSymbols().ToList());
                Assert.IsTrue(_subscriptionManager.IsSubscribed(Symbols.AAPL, TickType.Quote));
                Assert.IsTrue(_subscriptionManager.IsSubscribed(Symbols.AAPL, TickType.Trade));
            }

            for (int i = 9; i >= 0; i--)
            {
                _subscriptionManager.Unsubscribe(GetSubscriptionDataConfig <QuoteBar>(Symbols.AAPL, Resolution.Minute));

                Assert.AreEqual(i > 0, _subscriptionManager.GetSubscribedSymbols().Count() == 1);
                Assert.AreEqual(i > 0, _subscriptionManager.GetSubscribedSymbols().Contains(Symbols.AAPL));
                Assert.AreEqual(i > 0, _subscriptionManager.IsSubscribed(Symbols.AAPL, TickType.Quote));
            }
        }
Example #2
0
 /// <summary>
 /// Removes the specified configuration
 /// </summary>
 /// <param name="dataConfig">Subscription config to be removed</param>
 public void Unsubscribe(SubscriptionDataConfig dataConfig)
 {
     _subscriptionManager.Unsubscribe(dataConfig);
     _dataAggregator.Remove(dataConfig);
 }