Exemplo n.º 1
0
 /**
  * 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();
     }
 }
Exemplo n.º 2
0
 /**
  * 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
         );
 }