private void HandlePartialMessage(JToken response) { var channel = response.SelectToken("channel").ToString(); switch (channel) { case "orderbook": OnMarketDepthEvent(_marketDepthCreator.Create(response)); break; case "trades": OnTradeEvent(_tradesCreator.Create(response)); break; case "ticker": break; case "fills": break; case "orders": 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; } }