Пример #1
0
        /// <summary>
        /// Call is non confirmative;
        /// Forwarded to requestMessage looped thread.
        /// </summary>
        /// <param name="baseCurrency"></param>
        public bool SubscribeSymbolSession(Symbol symbol)
        {
            if (IsInitialized == false)
            {
                return(false);
            }

            lock (this)
            {
                if (_sessions.ContainsKey(symbol.Name))
                {// BaseCurrency already subscribed.
                    return(true);
                }

                _sessions.Add(symbol.Name, new SessionQuoteInformation()
                {
                    Symbol = symbol
                });
            }

            MbtQuotes client = _quotesClient;

            if (client != null)
            {
                _messageLoopOperator.BeginInvoke(delegate()
                {
                    client.AdviseSymbol(this, symbol.Name, (int)enumQuoteServiceFlags.qsfLevelOne);
                });
                return(true);
            }

            return(false);
        }
Пример #2
0
        void TimerUpdate(object state)
        {
            if (_messageLoopOperator == null)
            {
                return;
            }

            _messageLoopOperator.BeginInvoke(delegate()
            {
                MbtOrderClient orderClient = _orderClient;
                if (orderClient == null || orderClient.Accounts == null)
                {
                    return;
                }

                foreach (MbtAccount account in orderClient.Accounts)
                {
                    PerformUpdate(account, true, true, true);
                }
            });
        }