public override void onMessage(QuickFix44.ExecutionReport message, SessionID session) { OrderID orderID = message.getOrderID(); ClOrdID clOrdID = message.getClOrdID(); OrdStatus ordStatus = message.getOrdStatus(); Symbol symbol = message.getSymbol(); // firing event Console.WriteLine("QuickFix44.ExecutionReport: {0}, {1}, {2}, {3}", orderID, clOrdID, ordStatus, symbol); this.fixServices.NotifyExecutionInfo(Counterpart.Dukascopy, DataAdaptors.AdaptExecutionReport(new DukascopyExecutionReportToAdapt(message))); }
/** * Process the Execution reports, adding them to the internal orders map */ public override void onMessage(QuickFix44.ExecutionReport report, QuickFix.SessionID session) { // fire an event that a new message arrived if (this.messageRecieved != null) { this.messageRecieved(report); } // add a note regarding the order to the log window Console.WriteLine( "An order for {0:N0} {1} on {2} placed on {3} with ID {4} updated as {5}", report.getOrderQty().getValue(), ((report.getSide().getValue() == 2) ? "Sell" : "Buy"), report.getSymbol().getValue(), report.getAccount().getValue(), report.getOrderID().getValue(), report.getString(9051) // FXCMOrdStatus ); }
/** * Update the DataGridView based on the given ExecutionReport, thread-safe */ public void update(QuickFix44.ExecutionReport report) { if (grdOrders.InvokeRequired) { updateCallback1 d = new updateCallback1(update); this.Invoke(d, new object[] { report }); } else { String reportID = report.getOrderID().getValue(); // if the order is already in the DataGridView if (orderMap.ContainsKey(reportID)) { // update the cells with the values that changed DataGridViewRow row = grdOrders.Rows[orderMap[reportID]]; row.Cells["Status"].Value = report.getString(9051); // FXCMOrdStatus row.Cells["Open"].Value = report.getPrice().getValue(); // scroll to the updated row grdOrders.CurrentCell = grdOrders[0, orderMap[reportID]]; } else // otherwise add it to the DataGridView { orderMap.Add(reportID, orderMap.Count); grdOrders.Rows.Add( report.getAccount().getValue(), report.getString(9051), // FXCMOrdStatus reportID, report.getSymbol().getValue(), report.getOrderID().getValue(), report.getPrice().getValue() ); // scroll to the added row grdOrders.CurrentCell = grdOrders[0, orderMap.Count - 1]; } // force the interface to refresh Application.DoEvents(); } }
public DukascopyExecutionReportToAdapt(QuickFix44.ExecutionReport message) { this.OrderID = message.isSetOrderID() ? message.getOrderID() : null; this.ClOrdID = message.isSetClOrdID() ? message.getClOrdID() : null; this.ExecID = message.isSetExecID() ? message.getExecID() : null; this.OrdStatus = message.isSetOrdStatus() ? message.getOrdStatus() : null; this.ExecType = message.isSetExecType() ? message.getExecType() : null; this.Symbol = message.isSetSymbol() ? message.getSymbol() : null; this.TimeInForce = message.isSetTimeInForce() ? message.getTimeInForce() : null; this.CumQty = message.isSetCumQty() ? message.getCumQty() : null; this.LeavesQty = message.isSetLeavesQty() ? message.getLeavesQty() : null; this.OrderQty = message.isSetOrderQty() ? message.getOrderQty() : null; this.Side = message.isSetSide() ? message.getSide() : null; this.OrdType = message.isSetOrdType() ? message.getOrdType() : null; this.AvgPx = message.isSetAvgPx() ? message.getAvgPx() : null; this.ExpireTime = message.isSetExpireTime() ? message.getExpireTime() : null; this.TransactTime = message.isSetTransactTime() ? message.getTransactTime() : null; this.LastRptRequested = message.isSetLastRptRequested() ? message.getLastRptRequested() : null; this.Account = message.isSetAccount() ? message.getAccount() : null; this.Slippage = message.isSetField(Slippage.FIELD) ? new Slippage(message.getDouble(Slippage.FIELD)) : null; this.OrdRejReason = message.isSetOrdRejReason() ? message.getOrdRejReason() : null; this.CashMargin = message.isSetCashMargin() ? message.getCashMargin() : null; }