コード例 #1
0
        private void DepthMain()
        {
            PartialDepthMessage msg;

            while (true)
            {
                try
                {
                    if (DepthQueue.Count > 0 && DepthQueue.TryDequeue(out msg) && msg.Stream != null)
                    {
                        var stockID = msg.Stream.Substring(0, msg.Stream.IndexOf('@')).ToUpper();
                        if (MCallBack != null)
                        {
                            PriceDict[stockID] = msg.Asks.First().Price;
                            MCallBack.Invoke(stockID, msg);
                        }
                        Thread.Sleep(1);
                    }
                    else
                    {
                        Thread.Sleep(100);
                    }
                }
                catch { }
            }
        }
コード例 #2
0
 private void PartialDepthHandler(PartialDepthMessage message)
 {
     try
     {
         DepthQueue.Enqueue(message);
     }
     catch (Exception ex)
     {
         Program.logger.LogRunning("PartialDepthHandler Exception: {0}", ex.Message);
     }
 }