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))); }
public override void onMessage(QuickFix44.NewOrderSingle order, SessionID sessionID) { Symbol symbol = new Symbol(); Side side = new Side(); OrdType ordType = new OrdType(); OrderQty orderQty = new OrderQty(); Price price = new Price(); ClOrdID clOrdID = new ClOrdID(); order.get(ordType); if (ordType.getValue() != OrdType.LIMIT) { throw new IncorrectTagValue(ordType.getField()); } order.get(symbol); order.get(side); order.get(orderQty); order.get(price); order.get(clOrdID); QuickFix44.ExecutionReport executionReport = new QuickFix44.ExecutionReport (genOrderID(), genExecID(), new ExecType(ExecType.FILL), new OrdStatus(OrdStatus.FILLED), side, new LeavesQty(0), new CumQty(orderQty.getValue()), new AvgPx(price.getValue())); executionReport.set(clOrdID); executionReport.set(symbol); executionReport.set(orderQty); executionReport.set(new LastQty(orderQty.getValue())); executionReport.set(new LastPx(price.getValue())); if (order.isSetAccount()) { executionReport.setField(order.getAccount()); } try { Session.sendToTarget(executionReport, sessionID); } catch (SessionNotFound) {} }
/** * 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 ); }
protected void ProcesssNewOrderSingleThread(object param) { QuickFix44.NewOrderSingle order = (QuickFix44.NewOrderSingle)param; while (true) { string clOrdId = order.getString(ClOrdID.FIELD); string account = order.getString(Account.FIELD); string symbol = order.getString(Symbol.FIELD); double lvsQty = order.getDouble(OrderQty.FIELD); char ordType = order.getChar(OrdType.FIELD); char side = order.getChar(Side.FIELD); QuickFix44.ExecutionReport exReport = new QuickFix44.ExecutionReport(); int i = 0; exReport.setField(new ExecID(i.ToString())); exReport.setField(new ExecTransType(ExecTransType.NEW)); exReport.setField(new ClOrdID(clOrdId)); exReport.setField(new OrderID(Guid.NewGuid().ToString())); exReport.setField(new ExecType(ExecType.NEW)); exReport.setField(new OrdStatus(OrdStatus.NEW)); exReport.setField(new TransactTime(DateTime.Now)); exReport.setField(new LeavesQty(lvsQty)); exReport.setField(new CumQty(0)); exReport.setField(new AvgPx(0)); exReport.setField(new MultiLegReportingType(MultiLegReportingType.SINGLE)); exReport.setField(new Symbol(symbol)); exReport.setField(new Account(account)); //exReport.setField(new OrderCapacity(OrderCapacity.PRINCIPAL)); //exReport.setField(new CustOrderCapacity(CustOrderCapacity.MEMBER_TRADING_FOR_THEIR_OWN_ACCOUNT)); exReport.setField(new Side(side)); exReport.setField(new OrdType(ordType)); exReport.setField(new OpenClose(OpenClose.OPEN)); exReport.setField(new TimeInForce(TimeInForce.GOOD_TILL_CANCEL)); Session.sendToTarget(exReport, SessionID); Thread.Sleep(1000); } }
/** * 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; }
public override void onMessage( QuickFix44.NewOrderSingle order, SessionID sessionID ) { Symbol symbol = new Symbol(); Side side = new Side(); OrdType ordType = new OrdType(); OrderQty orderQty = new OrderQty(); Price price = new Price(); ClOrdID clOrdID = new ClOrdID(); order.get( ordType ); if ( ordType.getValue() != OrdType.LIMIT ) throw new IncorrectTagValue( ordType.getField() ); order.get( symbol ); order.get( side ); order.get( orderQty ); order.get( price ); order.get( clOrdID ); QuickFix44.ExecutionReport executionReport = new QuickFix44.ExecutionReport ( genOrderID(), genExecID(), new ExecType ( ExecType.FILL ), new OrdStatus ( OrdStatus.FILLED ), side, new LeavesQty ( 0 ), new CumQty ( orderQty.getValue() ), new AvgPx ( price.getValue() ) ); executionReport.set( clOrdID ); executionReport.set( symbol ); executionReport.set( orderQty ); executionReport.set( new LastQty( orderQty.getValue() ) ); executionReport.set( new LastPx( price.getValue() ) ); if( order.isSetAccount() ) executionReport.setField( order.getAccount() ); try { Session.sendToTarget( executionReport, sessionID ); } catch ( SessionNotFound ) {} }
public override void onMessage(QuickFix44.ExecutionReport message, SessionID sessionID) { Logger.InfoFormat("Execution report (Sender = {0}, Target = {1})", sessionID.getSenderCompID(), sessionID.getTargetCompID()); }