public void AddOrderBook(Order order) { OrderBook orderBook; // create a new market and its orderbook if (marketBook.TryGetValue(order.Asset, out orderBook)) { return; } orderBook = orderBookFactory.CreateOrderBook(); marketBook.Add(order.Asset, orderBook); //orderBook.AddOrder(order); }
private async Task UpdateOrderBooks() { var response = await _client.GetAsync(_getUniswapDataUri); var dtoString = await response.Content.ReadAsStringAsync(); var pairs = JsonConvert.DeserializeObject <IEnumerable <UniswapPair> >(dtoString); var orderBooks = new Dictionary <string, OrderBook>(); foreach (var pair in pairs) { var tokenSymbol = pair.TokenSymbol(); if (orderBooks.ContainsKey(tokenSymbol)) { continue; } orderBooks.Add(tokenSymbol, _orderBookFactory.CreateOrderBook(pair)); } _orderBooks = orderBooks; _lastUpdated = DateTime.UtcNow; }