public static CancelOrderRequest ReadFromBuffer(ByteBuffer buf, int offset = 0) { if (buf.length - offset < StructSize) { return(null); } var req = new CancelOrderRequest(); req.RequestId = encoding.GetString(buf.data, offset, 16).Trim((char)0); offset += 16; req.ClearingAccountId = encoding.GetString(buf.data, offset, 16).Trim((char)0); offset += 16; req.TraderAccountId = encoding.GetString(buf.data, offset, 16).Trim((char)0); offset += 16; req.InstrumentId = BitConverter.ToInt32(buf.data, offset); offset += PropInfo.GetSize(req, r => r.InstrumentId); req.ExchangeOrderId = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(req, r => r.ExchangeOrderId); req.OriginRequestId = encoding.GetString(buf.data, offset, 16).Trim((char)0); offset += 16; req.OrderSide = (OrderSide)buf.data[offset++]; req.TrimZeroSymbols(); return(req); }
public static CancelOrderResponse ReadFromBuffer(MessageHeader frame, ByteBuffer buf, int offset = 0) { if (buf.length - offset < StructSize) { return(null); } var resp = new CancelOrderResponse(); resp.OriginRequest = CancelOrderRequest.ReadFromBuffer(buf, offset); if (resp.OriginRequest == null) { return(null); } offset += CancelOrderRequest.StructSize; 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.SystemTime = BitConverter.ToUInt64(buf.data, offset); offset += PropInfo.GetSize(resp, o => o.SystemTime); resp.AmountCancelled = BitConverter.ToInt32(buf.data, offset); offset += PropInfo.GetSize(resp, o => o.AmountCancelled); resp.AmountRest = BitConverter.ToInt32(buf.data, offset); offset += PropInfo.GetSize(resp, o => o.AmountRest); resp.CancelReason = (CancelReason)buf.data[offset++]; return(resp); }
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); }
public static ExecReportBody ReadFromBuffer(ByteBuffer buf, int offset = 0) { var d = new ExecReportBody(); d.SystemTime = BitConverter.ToUInt64(buf.data, offset); offset += PropInfo.GetSize(d, r => r.SystemTime); d.ExchangeOrderId = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(d, r => r.ExchangeOrderId); d.AmountRest = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(d, r => r.AmountRest); d.DealsCount = buf.data[offset++]; if (d.DealsCount > d.Deals.Length) { d.Deals = new Deal[d.DealsCount]; } for (var i = 0; i < d.DealsCount; i++) { var deal = Deal.ReadFromBuffer(buf, offset); if (deal == null) { break; } d.Deals[i] = deal; offset += Deal.StructSize; } return(d); }
static Deal() { Deal d = null; StructSize = PropInfo.GetSize(d, o => o.DealId) + PropInfo.GetSize(d, o => o.Price) + PropInfo.GetSize(d, o => o.Amount); }
static MessageHeader() { MessageHeader f = null; StructSize = PropInfo.GetSize(f, r => r.msgId) + PropInfo.GetSize(f, r => r.msgSize) + PropInfo.GetSize(f, r => r.msgSeq); }
static RejectResponse() { RejectResponse r = null; StructSize = PropInfo.GetSize(r, o => o.InputTime) + PropInfo.GetSize(r, o => o.OutputTime) + PropInfo.GetSize(r, o => o.Time) + 16 + // RequestId PropInfo.GetSize(r, o => o.ErrorCodeInternal); }
static MassCancelRequest() { MassCancelRequest o = null; StructSize = 16 + // RequestId 16 + // ClearingAccountId 16 + // TraderAccountId PropInfo.GetSize(o, r => r.InstrumentId) + 1; // CancelMode }
static CancelOrderResponse() { CancelOrderResponse r = null; StructSize = CancelOrderRequest.StructSize + PropInfo.GetSize(r, o => o.InputTime) + PropInfo.GetSize(r, o => o.OutputTime) + PropInfo.GetSize(r, o => o.SystemTime) + PropInfo.GetSize(r, o => o.AmountCancelled) + PropInfo.GetSize(r, o => o.AmountRest) + 1; // CancelReason }
static OrderResponse() { OrderResponse r = null; StructSize = OrderRequest.StructSize + PropInfo.GetSize(r, o => o.InputTime) + PropInfo.GetSize(r, o => o.OutputTime) + PropInfo.GetSize(r, o => o.SystemTime) + PropInfo.GetSize(r, o => o.ExchangeOrderId) + PropInfo.GetSize(r, o => o.LiquidityPoolId) + PropInfo.GetSize(r, o => o.OrderRoutingRule); }
static CancelOrderRequest() { CancelOrderRequest o = null; StructSize = 16 + // RequestId 16 + // ClearingAccountId 16 + // TraderAccountId PropInfo.GetSize(o, r => r.InstrumentId) + PropInfo.GetSize(o, r => r.ExchangeOrderId) + 16 + // OriginRequestId 1; // OrderSide }
static MassCancelResponse() { MassCancelResponse o = null; StructSize = PropInfo.GetSize(o, r => r.InputTime) + PropInfo.GetSize(o, r => r.OutputTime) + PropInfo.GetSize(o, r => r.Time) + 16 + // OriginRequestId 16 + // ClearingAccountId 16 + // TraderAccountId PropInfo.GetSize(o, r => r.InstrumentId) + 1 + // CancelMode 1 + // CancelStatus PropInfo.GetSize(o, r => r.CancelledOrders); }
public static MessageHeader ReadFromBuffer(ByteBuffer buf, int offset = 0) { if (buf.length - offset < StructSize) { return(null); } MessageHeader f = null; var frame = new MessageHeader { msgId = BitConverter.ToInt16(buf.data, offset), msgSize = BitConverter.ToUInt16(buf.data, offset + PropInfo.GetSize(f, r => r.msgId)), msgSeq = BitConverter.ToInt64(buf.data, offset + PropInfo.GetSize(f, r => r.msgId) + PropInfo.GetSize(f, r => r.msgSize)) }; return(frame); }
static OrderRequest() { OrderRequest r = null; StructSize = 16 // RequestId + 16 // ClearingAccountId + 16 // TraderAccountId + PropInfo.GetSize(r, o => o.InstrumentId) + sizeof(byte) // OrderType + sizeof(byte) // TimeInForce + sizeof(byte) // OrderSide + sizeof(byte) // AutoCancel + PropInfo.GetSize(r, o => o.Amount) + PropInfo.GetSize(r, o => o.Price) + PropInfo.GetSize(r, o => o.Flags) + 16; // comment }
public static Deal ReadFromBuffer(ByteBuffer buf, int offset = 0) { var d = new Deal(); if (buf.length - offset < StructSize) { return(d); } d.DealId = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(d, r => r.DealId); d.Price = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(d, r => r.Price); d.Amount = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(d, r => r.Amount); return(d); }
public static MassCancelResponse ReadFromBuffer(MessageHeader frame, ByteBuffer buf, int offset = 0) { if (buf.length - offset < StructSize) { return(null); } var resp = new MassCancelResponse(); 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.Time = BitConverter.ToUInt64(buf.data, offset); offset += PropInfo.GetSize(resp, o => o.Time); resp.OriginRequestId = encoding.GetString(buf.data, offset, 16).Trim((char)0);; offset += 16; resp.ClearingAccountId = encoding.GetString(buf.data, offset, 16).Trim((char)0);; offset += 16; resp.TraderAccountId = encoding.GetString(buf.data, offset, 16).Trim((char)0);; offset += 16; resp.InstrumentId = BitConverter.ToInt32(buf.data, offset); offset += PropInfo.GetSize(resp, o => o.InstrumentId); resp.CancelMode = (MassCancelMode)buf.data[offset++]; resp.CancelStatus = (MassCancelStatus)buf.data[offset++]; resp.CancelledOrders = BitConverter.ToInt32(buf.data, offset); offset += PropInfo.GetSize(resp, o => o.CancelledOrders); return(resp); }
public static OrderRequest ReadFromBuffer(ByteBuffer buf, int offset = 0) { if (buf.length - offset < StructSize) { return(null); } var req = new OrderRequest(); req.RequestId = encoding.GetString(buf.data, offset, 16).TrimEnd((char)0); offset += 16; req.ClearingAccountId = encoding.GetString(buf.data, offset, 16).TrimEnd((char)0); offset += 16; req.TraderAccountId = encoding.GetString(buf.data, offset, 16).TrimEnd((char)0); offset += 16; req.InstrumentId = BitConverter.ToInt32(buf.data, offset); offset += PropInfo.GetSize(req, r => r.InstrumentId); req.OrderType = (OrderType)buf.data[offset++]; req.TimeInForce = (TimeInForce)buf.data[offset++]; req.OrderSide = (OrderSide)buf.data[offset++]; req.AutoCancel = (AutoCancel)buf.data[offset++]; req.Amount = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(req, r => r.Amount); req.Price = BitConverter.ToInt64(buf.data, offset); offset += PropInfo.GetSize(req, r => r.Price); req.Flags = BitConverter.ToUInt64(buf.data, offset); return(req); }
public static RejectResponse ReadFromBuffer(MessageHeader frame, ByteBuffer buf, int offset = 0) { if (buf.length - offset < StructSize) { return(null); } var resp = new RejectResponse(); 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.Time = BitConverter.ToUInt64(buf.data, offset); offset += PropInfo.GetSize(resp, o => o.Time); resp.RequestId = encoding.GetString(buf.data, offset, 16).Trim((char)0); offset += 16; resp.ErrorCodeInternal = BitConverter.ToInt16(buf.data, offset); return(resp); }