예제 #1
0
            public void Subscribe(Security security, MarketDataTypes type)
            {
                if (security == null)
                {
                    throw new ArgumentNullException("security");
                }

                if (security is IndexSecurity)
                {
                    ((IndexSecurity)security).InnerSecurities.ForEach(s => _connector.SubscribeMarketData(s, type));
                }
                else if (security is ContinuousSecurity)
                {
                    SubscribeContinuous((ContinuousSecurity)security, type);
                }
                else
                {
                    TrySubscribe(security, type);
                }
            }
예제 #2
0
            public void Subscribe(Security security, MarketDataMessage message)
            {
                if (security == null)
                {
                    throw new ArgumentNullException(nameof(security));
                }

                var indexSecurity = security as IndexSecurity;

                if (indexSecurity != null)
                {
                    indexSecurity.InnerSecurities.ForEach(s => _connector.SubscribeMarketData(s, message));
                }
                //else if (security is ContinuousSecurity)
                //	SubscribeContinuous((ContinuousSecurity)security, message);
                else
                {
                    //TrySubscribe(security, message);
                    _pendingSubscriptions.Add(message.TransactionId, Tuple.Create((MarketDataMessage)message.Clone(), security));
                    _connector.SendInMessage(message);
                }
            }