void OrderBookOrderInserted(object sender, Fix.OrderBookEventArgs e) { Fix.Order order = e.Order; if (_orderTable.Rows.Find(order.ClOrdID) is OrderDataRow) { return; } OrderDataRow row = (OrderDataRow)_orderTable.NewRow(); row.Order = order; row[OrderDataTable.ColumnClOrdId] = order.ClOrdID; // // Prime these with 0's so the grid looks pretty. // row[OrderDataTable.ColumnDone] = 0; row[OrderDataTable.ColumnLeaves] = 0; row[OrderDataTable.ColumnAvgPrice] = 0; UpdateRow(row); _orderTable.Rows.Add(row); }
static void UpdateRow(OrderDataRow row) { Fix.Order order = row.Order; row[OrderDataTable.ColumnQuantity] = order.OrderQty; row[OrderDataTable.ColumnSymbol] = order.Symbol; row[OrderDataTable.ColumnExDestination] = order.ExDestination; if (order.TimeInForce != null) { row[OrderDataTable.ColumnTimeInForce] = (Fix.TimeInForce)order.TimeInForce; row[OrderDataTable.ColumnTimeInForceString] = OrderDataGridView.ShortTimeInForceDescription(order.TimeInForce.Value); } if (order.OrdStatus != null) { row[OrderDataTable.ColumnOrdStatus] = (Fix.OrdStatus)order.OrdStatus; row[OrderDataTable.ColumnOrdStatusString] = ((Fix.OrdStatus)order.OrdStatus).ToString(); } else { row[OrderDataTable.ColumnOrdStatusString] = Fix.OrdStatus.PendingNew.ToString(); } if (order.OrigClOrdID != null) { row[OrderDataTable.ColumnOrigClOrdId] = order.OrigClOrdID; } if (order.Side != null) { row[OrderDataTable.ColumnSide] = (Fix.Side)order.Side; row[OrderDataTable.ColumnSideString] = ((Fix.Side)order.Side).ToString(); } long cumQty = order.CumQty ?? 0; long leavesQty = order.LeavesQty ?? 0; if (!order.LeavesQty.HasValue) { if (order.Active) { leavesQty = order.OrderQty - cumQty; } } row[OrderDataTable.ColumnLeaves] = leavesQty; row[OrderDataTable.ColumnDone] = cumQty; if (order.AvgPx != null) { row[OrderDataTable.ColumnAvgPrice] = order.AvgPx.Value; } if (order.Price != null) { row[OrderDataTable.ColumnLimit] = order.Price.Value; } if (order.ListID != null) { row[OrderDataTable.ColumnListId] = order.ListID; } if (order.Text != null) { row[OrderDataTable.ColumnText] = order.Text; } }
static void UpdateRow(OrderDataRow row) { if (row.Order is not Fix.Order order) { return; } row[OrderDataTable.ColumnQuantity] = order.OrderQty; row[OrderDataTable.ColumnPendingQuantity] = order.PendingOrderQty; row[OrderDataTable.ColumnSymbol] = order.Symbol; if (order.TimeInForce != null) { row[OrderDataTable.ColumnTimeInForce] = order.TimeInForce; row[OrderDataTable.ColumnTimeInForceString] = OrderDataGridView.ShortTimeInForceDescription(order.TimeInForce); } if (order.OrdStatus != null) { row[OrderDataTable.ColumnOrdStatus] = order.OrdStatus; row[OrderDataTable.ColumnOrdStatusString] = order.OrdStatus.Name; } else { row[OrderDataTable.ColumnOrdStatusString] = FIX_5_0SP2.OrdStatus.PendingNew.Name; } if (order.OrigClOrdID != null) { row[OrderDataTable.ColumnOrigClOrdId] = order.OrigClOrdID; } if (order.Side != null) { row[OrderDataTable.ColumnSide] = order.Side; row[OrderDataTable.ColumnSideString] = order.Side.Name; } long leavesQty = 0; long cumQty = order.CumQty ?? 0; if (order.LeavesQty.HasValue) { leavesQty = order.LeavesQty.Value; } else if (order.CumQty.HasValue) { if (order.Active) { leavesQty = order.OrderQty - order.CumQty ?? 0; } } row[OrderDataTable.ColumnLeaves] = leavesQty; row[OrderDataTable.ColumnDone] = cumQty; if (order.AvgPx != null) { row[OrderDataTable.ColumnAvgPrice] = order.AvgPx.Value; } if (order.Price != null) { row[OrderDataTable.ColumnLimit] = order.Price.Value; } row[OrderDataTable.ColumnPendingLimit] = order.PendingPrice; if (order.ListID != null) { row[OrderDataTable.ColumnListId] = order.ListID; } if (order.Text != null) { row[OrderDataTable.ColumnText] = order.Text; } }