예제 #1
0
        public static OrderResponse ReadFromBuffer(MessageHeader frame, ByteBuffer buf, int offset = 0)
        {
            if (buf.length - offset < StructSize)
            {
                return(null);
            }
            var resp = new OrderResponse();

            resp.InputTime = BitConverter.ToUInt64(buf.data, offset);
            offset        += PropInfo.GetSize(resp, o => o.InputTime);

            resp.OutputTime = BitConverter.ToUInt64(buf.data, offset);
            offset         += PropInfo.GetSize(resp, o => o.OutputTime);

            resp.OriginRequest = OrderRequest.ReadFromBuffer(buf, offset);
            if (resp.OriginRequest == null)
            {
                return(null);
            }
            offset += OrderRequest.StructSize;

            resp.SystemTime = BitConverter.ToUInt64(buf.data, offset);
            offset         += PropInfo.GetSize(resp, o => o.SystemTime);

            resp.ExchangeOrderId = BitConverter.ToInt64(buf.data, offset);
            offset += PropInfo.GetSize(resp, o => o.ExchangeOrderId);

            resp.LiquidityPoolId = BitConverter.ToInt16(buf.data, offset);
            offset += PropInfo.GetSize(resp, o => o.LiquidityPoolId);

            resp.OrderRoutingRule = BitConverter.ToInt16(buf.data, offset);

            return(resp);
        }
예제 #2
0
        public static ExecutionReport ReadFromBuffer(MessageHeader frame, ByteBuffer buf, int offset = 0)
        {
            if (buf.length - offset < OrderRequest.StructSize)
            {
                return(null);
            }
            var orig = OrderRequest.ReadFromBuffer(buf, offset);

            if (orig == null)
            {
                return(null);
            }
            offset += OrderRequest.StructSize;

            var rep = ExecReportBody.ReadFromBuffer(buf, offset);

            return(rep == null
                ? null
                : new ExecutionReport
            {
                OriginRequest = orig,
                ExecReport = rep
            });
        }