Esempio n. 1
0
        protected void ProcessPriceTicker(IEnumerable <PriceTicker> priceTicker)
        {
            var sw = Stopwatch.StartNew();

            if (Tickers.IsEmpty)
            {
                var idCache = new HashSet <string>(marketsMapping.Values.Where(IsValidMarket).Select(si => si.Symbol));
                Tickers.AddRange(priceTicker.Where(t => idCache.Contains(t.Symbol)));
                for (int idx = 0; idx < Tickers.Count; idx += 1)
                {
                    var ticker = Tickers[idx];
                    Debug.Assert(tickersMapping.TryAdd(ticker.Symbol, idx));
                }
            }
            else
            {
                var iter = Tickers.GetEnumerator();
                foreach (var ticker in priceTicker)
                {
                    OnRefreshMarketSummary2(ticker);
                }
            }
            Debug.Print($"ProcessPriceTicker took {sw.ElapsedMilliseconds}ms.");
        }