Exemple #1
0
 private void UpdateListView(ListView view, ExecutionReport rpt, OrderInfo ord)
 {
     try
     {
         string key = null;
         NewOrderSingle order = ord.Order;
         char exec = rpt.getExecType().getValue();
         if (exec == ExecType.PENDING_CANCEL || exec == ExecType.CANCELED || exec == ExecType.PENDING_REPLACE || exec == ExecType.REPLACE)
         {
             if (rpt.isSetOrigClOrdID())//�Ӵ��̶�ȡ�����ָ��û�б���origclordid
             {
                 key = rpt.getOrigClOrdID().getValue();
             }
             else
             {
                 key = rpt.getClOrdID().getValue();
             }
         }
         else
         {
             key = rpt.getClOrdID().getValue();
         }
         OrderViewItem item = (OrderViewItem)view.Items[key];
         if (item == null)
         {
             if (view.Name == "listView1")
             {
                 OrderViewItem item1 = new OrderViewItem(order);
                 view.Items.Insert(0, item1);
                 item1.UpdateValues(order, rpt);
             }
         }
         else
         {
             if (view.Name == "listView1")
             {
                 item.UpdateValues(order, rpt);
             }
         }
     }
     catch (IncorrectDataFormat e)
     {
         Console.WriteLine(e.TargetSite);
     }
 }
Exemple #2
0
            internal void UpdateValues(NewOrderSingle fixorder, ExecutionReport rpt)
            {
                try
                {
                    double avgpx = rpt.getAvgPx().getValue();
                    double cumqty = rpt.getCumQty().getValue();
                    double price = rpt.getPrice().getValue();
                    double qty = rpt.getOrderQty().getValue();
                    char status = rpt.getOrdStatus().getValue();
                    //string ordtype = rpt.getOrdType().ToString();
                    switch (status)
                    {
                        case QuickFix.OrdStatus.PARTIALLY_FILLED:
                            base.BackColor = Color.SkyBlue;
                            break;

                        case QuickFix.OrdStatus.FILLED:
                            base.BackColor = Color.Aquamarine;
                            break;

                        case QuickFix.OrdStatus.CANCELED:
                            base.BackColor = Color.Pink;
                            break;
                    }
                    string priceDisplay = "F2";
                    string pctDisplay = "P0";
                    string numDisplay = "N0";
                    double pct = cumqty / order.getOrderQty().getValue();
                    if (rpt.getExecType().getValue() == ExecType.REPLACE)
                    {
                        string clordid = fixorder.getClOrdID().getValue();
                        base.SubItems[0].Text = clordid;
                        base.SubItems[1].Text = rpt.getTransactTime().getValue().ToLocalTime().ToString("HH:mm:ss");
                        this.Name = clordid;
                        this.order = fixorder;
                    }
                    else
                    {
                        base.SubItems[0].Text = this.order.getClOrdID().getValue();
                        base.SubItems[1].Text = order.getTransactTime().getValue().ToLocalTime().ToString("HH:mm:ss");
                    }

                    base.SubItems[2].Text = this.order.getSymbol().getValue();
                    base.SubItems[3].Text = FixDataDictionary.getEnumString(FixDataDictionary.FixField.Side, this.order.getSide().ToString());
                    if (stratidtag != FIELDORDTYPE)
                    {
                        if (order.isSetField(stratidtag))
                        {
                            base.SubItems[4].Text = order.getField(stratidtag);
                        }
                    }
                    else
                    {
                        if (rpt.isSetOrdType())
                        {
                            base.SubItems[4].Text = FixDataDictionary.getEnumString(FixDataDictionary.FixField.OrdType, rpt.getOrdType().ToString());
                        }
                        else
                        {
                            base.SubItems[4].Text = FixDataDictionary.getEnumString(FixDataDictionary.FixField.OrdType, this.order.getOrdType().ToString());
                        }
                    }

                    if (rpt.isSetOrderQty())
                    {
                        base.SubItems[5].Text = qty.ToString(numDisplay);
                    }
                    else
                    {
                        base.SubItems[5].Text = this.order.getOrderQty().getValue().ToString();
                    }
                    if (rpt.isSetPrice())
                    {
                        base.SubItems[6].Text = price.ToString(priceDisplay);
                    }
                    else
                    {
                        base.SubItems[6].Text = this.order.getPrice().getValue().ToString(priceDisplay);
                    }
                    base.SubItems[7].Text = avgpx.ToString(priceDisplay);

                    base.SubItems[8].Text = pct.ToString(pctDisplay);

                    base.SubItems[9].Text = FixDataDictionary.getEnumString(FixDataDictionary.FixField.OrderStatus, status.ToString());
                    ordstatus = status;
                }
                catch (QuickFix.FieldNotFound e)
                {
                    Console.WriteLine("Missing field " + e.field);
                }

                //order.
            }
Exemple #3
0
 public void Add(ExecutionReport report)
 {
     char exec = report.getExecType().getValue();
     if (exec == ExecType.REPLACE)
     {
         ordid = report.getOrderID().getValue();
         string clordid = report.getClOrdID().getValue();
         UpdateOrder(clordid);
     }
     else if (exec == ExecType.NEW)
     {
         if (report.isSetOrderID())
         {
             ordid = report.getOrderID().getValue();
         }
     }
     else if (ordid == null)
     {
         if (report.isSetOrderID())
         {
             ordid = report.getOrderID().getValue();
         }
     }
     //ExecutionReportViewItem item = new ExecutionReportViewItem(report);
     //rptlist.Add(item);
 }