protected override void DoRunLoopSubscriptions(string resp) { WebSocketSubscriptionEvent eventSubscr = JsonConvert.DeserializeObject <WebSocketSubscriptionEvent>(resp); if (ResponseRequestSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { if (eventSubscr.table == _ORDER && EventSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { WebSocketExecutionReportEvent execReportEvent = JsonConvert.DeserializeObject <WebSocketExecutionReportEvent>(resp); WebSocketSubscriptionEvent subscrEvent = EventSubscriptions[eventSubscr.GetSubscriptionEvent()]; subscrEvent.RunEvent(execReportEvent); } else if (eventSubscr.table == _EXECUTIONS && EventSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { WebSocketExecutionReportEvent execReportEvent = JsonConvert.DeserializeObject <WebSocketExecutionReportEvent>(resp); WebSocketSubscriptionEvent subscrEvent = EventSubscriptions[eventSubscr.GetSubscriptionEvent()]; subscrEvent.RunEvent(execReportEvent); } else { //Log what we are receiving here because we are getting events that we didn't expect } } }
protected override void DoRunLoopSubscriptions(string resp) { WebSocketSubscriptionEvent eventSubscr = JsonConvert.DeserializeObject <WebSocketSubscriptionEvent>(resp); if (ResponseRequestSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { if (eventSubscr.table == _ORDERBOOK_L2 && EventSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { WebSocketOrderBookL2Event orderBookL2Event = JsonConvert.DeserializeObject <WebSocketOrderBookL2Event>(resp); WebSocketSubscriptionEvent subscrEvent = EventSubscriptions[eventSubscr.GetSubscriptionEvent()]; subscrEvent.RunEvent(orderBookL2Event); } else if (eventSubscr.table == _TRADE && EventSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { WebSocketTradeEvent tradeEvent = JsonConvert.DeserializeObject <WebSocketTradeEvent>(resp); WebSocketSubscriptionEvent subscrEvent = EventSubscriptions[eventSubscr.GetSubscriptionEvent()]; subscrEvent.RunEvent(tradeEvent); } else if (eventSubscr.table == _QUOTE && EventSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { WebSocketQuoteEvent quoteEvent = JsonConvert.DeserializeObject <WebSocketQuoteEvent>(resp); WebSocketSubscriptionEvent subscrEvent = EventSubscriptions[eventSubscr.GetSubscriptionEvent()]; subscrEvent.RunEvent(quoteEvent); } else if (eventSubscr.table == _1_DAY_TRADE_BINS && EventSubscriptions.ContainsKey(eventSubscr.GetSubscriptionEvent())) { //TODO: I have to ask BitMex why aren't they retrieveing high and low for the 1 day bin //and they are for the 1 hour bin } else { //Log what we are receiving here because we are getting events that we didn't expect } } }