Пример #1
0
        public static Message GetMessage(byte[] data)
        {
            MessageType type = GetType(data);

            Message mes = null;

            if (type == MessageType.Logon)
            {
                mes = new Logon();
            }
            else if (type == MessageType.Heartbeat)
            {
                mes = new Heartbeat();
            }
            else if (type == MessageType.TestRequest)
            {
                mes = new TestRequest();
            }
            else if (type == MessageType.SequenceReset)
            {
                mes = new SequenceReset();
            }
            else if (type == MessageType.ResendRequest)
            {
                mes = new ResendRequest();
            }
            else if (type == MessageType.SessionLevelReject)
            {
                mes = new SessionLevelReject();
            }
            else if (type == MessageType.BusinessLevelReject)
            {
                mes = new BusinessLevelReject();
            }
            else if (type == MessageType.Logout)
            {
                mes = new Logout();
            }
            else if (type == MessageType.OrderSingle)
            {
                mes = new NewOrder();
            }
            else if (type == MessageType.OrderCancelReplaceRequest)
            {
                mes = new CancelReplaceRequest();
            }
            else if (type == MessageType.OrderCancelRequest)
            {
                mes = new CancelRequest();
            }
            else if (type == MessageType.OrderCancelReject)
            {
                mes = new CancelReject();
            }
            else if (type == MessageType.ExecutionReport)
            {
                var os = GetOrderStatus(data);

                if (os == OrderStatus.New)
                {
                    mes = new NewOrderAck();
                }
                else if (os == OrderStatus.Replaced)
                {
                    mes = new CancelReplaceAck();
                }
                else if (os == OrderStatus.Cancelled)
                {
                    mes = new CancelAck();
                }
                else if (os == OrderStatus.Rejected)
                {
                    mes = new Reject();
                }
                else if (os == OrderStatus.PartiallyFilled)
                {
                    mes = new Fill(true);
                }
                else if (os == OrderStatus.Filled)
                {
                    mes = new Fill(false);
                }
                else if (os == OrderStatus.Expired)
                {
                    mes = new Expire();
                }
            }

            mes.Decode(data);

            return(mes);
        }
Пример #2
0
 private void HandleNewOrderAck(object sender, NewOrderAck e)
 {
     exchangeOrderId[e.CorrelationClientOrderId] = e.OrderId;
 }