Exemple #1
0
        public void SubscribeSingleSingleChannel()
        {
            _subscriptionManager.Subscribe(GetSubscriptionDataConfig <TradeBar>(Symbols.AAPL, Resolution.Minute));

            Assert.NotZero(_subscriptionManager.GetSubscribedSymbols().Count());
            Assert.Contains(Symbols.AAPL, _subscriptionManager.GetSubscribedSymbols().ToArray());
        }
Exemple #2
0
        /// <summary>
        /// Subscribe to the specified configuration
        /// </summary>
        /// <param name="dataConfig">defines the parameters to subscribe to a data feed</param>
        /// <param name="newDataAvailableHandler">handler to be fired on new data available</param>
        /// <returns>The new enumerator for this subscription request</returns>
        public IEnumerator <BaseData> Subscribe(SubscriptionDataConfig dataConfig, EventHandler newDataAvailableHandler)
        {
            if (!CanSubscribe(dataConfig.Symbol))
            {
                return(Enumerable.Empty <BaseData>().GetEnumerator());
            }

            var enumerator = _dataAggregator.Add(dataConfig, newDataAvailableHandler);

            _subscriptionManager.Subscribe(dataConfig);

            return(enumerator);
        }