public void CallbackReadMessage(int conId, byte[] message) { byte byteTradingEvent = 0; byte[] arrMsgBody = _messenger.GetBinaryMessageHeaderAndBody(message, ref byteTradingEvent); enmTradingEvent tradingEvent = (enmTradingEvent)byteTradingEvent; Log("Read message from client"); if (enmTradingEvent.AuthRequest == tradingEvent) { ProcessAuthRequest(conId, arrMsgBody); } else if (enmTradingEvent.EnableBot == tradingEvent) { ProcessEnableBot(conId, arrMsgBody); } else if (enmTradingEvent.DisableBot == tradingEvent) { ProcessDisableBot(conId, arrMsgBody); } else if (enmTradingEvent.CloseBotPosTrdMgr == tradingEvent) { ProcessClosePos(conId, arrMsgBody); } else if (enmTradingEvent.SendReconnect == tradingEvent) { ProcessSendReconnect(conId, arrMsgBody); } }
public void CallbackReadMessage(byte[] message) { try { byte byteTradingEvent = 0; byte[] arrMsgBody = _messenger.GetBinaryMessageHeaderAndBody(message, ref byteTradingEvent); enmTradingEvent tradingEvent = (enmTradingEvent)byteTradingEvent; if (enmTradingEvent.AuthResponse == tradingEvent) { ProcessAuthResponse(arrMsgBody); } else if (enmTradingEvent.PositionInstrTotal == tradingEvent) { ProcessPositionInstrTotal(arrMsgBody); } else if (enmTradingEvent.BotStatus == tradingEvent) { ProcessBotStatus(arrMsgBody); } else if (enmTradingEvent.BotPosTrdMgr == tradingEvent) { ProcessBotPosTrdMgr(arrMsgBody); } else if (enmTradingEvent.ClientInfo == tradingEvent) { ProcessClientInfo(arrMsgBody); } else { Error("Unknown message"); } } catch (Exception e) { Error("CDataRecieverTrdMgr.CallbackReadMessage", e); } }
public void CallbackReadMessage(int conId, byte[] message) { byte byteTradingEvent = 0; byte[] arrMsgBody = _messenger.GetBinaryMessageHeaderAndBody(message, ref byteTradingEvent); enmTradingEvent tradingEvent = (enmTradingEvent)byteTradingEvent; Log("Read message from client"); if (enmTradingEvent.AuthRequest == tradingEvent) { ProcessAuthRequest(conId, arrMsgBody); } //TODO command as bot not directly else if (enmTradingEvent.AddOrder == tradingEvent) { ProcessAddOrder(conId, arrMsgBody); } else if (enmTradingEvent.CancellOrderById == tradingEvent) { ProcessCancellOrderById(conId, arrMsgBody); } else if (enmTradingEvent.CancellAllOrders == tradingEvent) { ProcessCancellAllOrders(conId, arrMsgBody); } else if (enmTradingEvent.CancellOrdersByIsin == tradingEvent) { ProcessCancellOrdersByIsin(conId, arrMsgBody); } else if (enmTradingEvent.CloseAllPositions == tradingEvent) { ProcessCloseAllPositions(conId, arrMsgBody); } else if (enmTradingEvent.CloseAllPositionsByIsin == tradingEvent) { ProcessCloseAllPositionsByIsin(conId, arrMsgBody); } else if (enmTradingEvent.UserSubscribeTicker == tradingEvent) { ProcessUserSubscribeTicker(conId, arrMsgBody); } else if (enmTradingEvent.SetStoplossTakeProfit == tradingEvent) { ProcessTypeOrder(conId, arrMsgBody); } else if (enmTradingEvent.SendOrderThrow == tradingEvent) { ProcessSendOrderThrow(conId, arrMsgBody); } else if (enmTradingEvent.InvertPosition == tradingEvent) { ProcessInvertPosition(conId, arrMsgBody); } else if (enmTradingEvent.SendOrderRest == tradingEvent) { PorcessOrderRest(conId, arrMsgBody); } else if (enmTradingEvent.ClientInfo == tradingEvent) { ProcessClientInfo(conId, arrMsgBody); } else { throw new ApplicationException("Unknown message from client"); } }