private void HandleUpdateMessage(JToken response) { var channel = response.SelectToken("channel").ToString(); switch (channel) { case "orderbook": OnMarketDepthEvent(_marketDepthCreator.Update(response)); break; case "trades": OnTradeEvent(_tradesCreator.Create(response)); break; case "ticker": break; case "fills": OnMyTradeEvent(_tradesCreator.CreateMyTrade(response)); break; case "orders": var order = _orderCreator.Create(response); if (order.State == OrderStateType.Done) { _orderCreator.RemoveMyOrder(order); } OnOrderEvent(order); break; default: SendLogMessage("Unhandeled channel :" + channel, LogMessageType.System); break; } }
private void HandleUpdateMessage(JToken response) { var channel = response.SelectToken("channel").ToString(); var data = response.SelectToken("data"); var securityName = response.SelectToken("market")?.ToString(); switch (channel) { case "orderbook": HandleUpdateMarketDepthMessage(data, securityName); break; case "trades": var trades = _tradesCreator.Create(data, securityName); foreach (var trade in trades) { OnTradeEvent(trade); } break; case "ticker": break; case "fills": OnMyTradeEvent(_tradesCreator.CreateMyTrade(data)); break; case "orders": HandleUpdateOrderMessage(data); break; default: SendLogMessage("Unhandeled channel :" + channel, LogMessageType.System); break; } }