コード例 #1
0
        public void ReplaceSymbolOrderBook(string symbol, OrderBookSymbolModel orderBook)
        {
            // order for sure
            orderBook.SortBidsAndAsks();

            _store.TryAdd(symbol.ToLowerInvariant(), orderBook);
        }
コード例 #2
0
        public void ImportFromJson(string json)
        {
            var nextStore = JsonConvert.DeserializeObject <ConcurrentDictionary <string, OrderBookSymbolModel> >(json);

            this._store.Clear();
            foreach (var pair in nextStore)
            {
                // order for sure
                var orderBook = new OrderBookSymbolModel()
                {
                    Bids = pair.Value.Bids,
                    Asks = pair.Value.Asks,
                };
                orderBook.SortBidsAndAsks();

                this._store.TryAdd(pair.Key.ToLowerInvariant(), orderBook);
            }
        }