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); } }
//private void CreateOrder(QuickFix.Side side) //{ // if (textBox1.Text != string.Empty && textBox2.Text != string.Empty && textBox3.Text != string.Empty) // { // ClOrdID clordid =new ClOrdID ( DateTime.Now.ToString("yyMMddHHmmss"));//Ψһ��Ͷ����ָ���� // QuickFix.HandlInst inst = new QuickFix.HandlInst('1'); //1 = Automated execution order, private, no Broker intervention // //2 = Automated execution order, public, Broker intervention OK // //3 = Manual order, best execution // QuickFix.Account account =new Account ("0103137186"); //2009 11 25 add �˺� // QuickFix.Symbol symbol = new QuickFix.Symbol(textBox1.Text); // QuickFix.TransactTime time = new QuickFix.TransactTime(); // QuickFix.OrdType ordtype = new QuickFix.OrdType('2');//2 = Limit // QuickFix42.NewOrderSingle message = new QuickFix42.NewOrderSingle(clordid, inst, symbol, side, time, ordtype); // message.setString(44, textBox3.Text); // message.setString(38,textBox2.Text); // message.setString(207, "SSE"); //207 sh �Ϻ� // message.setString(1, "0002077141");//1 Account �˺� // _quickFixWrapper.Send(message); // } // else // { // MessageBox.Show("ָ���������"); // } //} private void CreateOrder() { if (textBox1.Text != string.Empty && textBox2.Text != string.Empty && comboBox2.SelectedIndex != -1) { string id = GetNextID(); ClOrdID clordid = new ClOrdID(id);//Ψһ��Ͷ����ָ���� //1 = Automated execution order, private, no Broker intervention //2 = Automated execution order, public, Broker intervention OK //3 = Manual order, best execution QuickFix.HandlInst inst = new QuickFix.HandlInst(); if (comboBox6.SelectedIndex == -1) { inst.setValue('1'); } else { switch (comboBox6.SelectedItem.ToString()) { case "ֱͨ˽��": inst.setValue('1'); break; case "ֱͨ����": inst.setValue('2'); break; case "����̨": inst.setValue('3'); break; } } QuickFix.Side side = new QuickFix.Side(); switch (comboBox2.SelectedItem.ToString()) { case "����": side.setValue('1'); break; case "���": side.setValue('2'); break; case "���": side.setValue('5'); break; case "�깺": side.setValue('D'); break; case "���": side.setValue('E'); break; } //QuickFix.Account account = new Account("0103137186"); //2009 11 25 add �˺� QuickFix.OrdType ordtype = new QuickFix.OrdType(); if (comboBox3.SelectedIndex == -1) { ordtype.setValue('1'); } else { switch (comboBox3.SelectedItem.ToString()) { case "�м�": ordtype.setValue('1'); break; case "��": ordtype.setValue('2'); break; } } QuickFix.Symbol symbol = new QuickFix.Symbol(textBox1.Text); QuickFix.TransactTime time = new QuickFix.TransactTime(); QuickFix42.NewOrderSingle message = new QuickFix42.NewOrderSingle(clordid, inst, symbol, side, time, ordtype); if (ordtype.getValue () == QuickFix.OrdType.LIMIT) { message.setString(44, textBox3.Text);//Limit Price } message.setString(38, textBox2.Text);//Quantity if (textBox1.Text.StartsWith("60")) { message.setString(207, "SSE"); //207 sh �Ϻ� } else if (textBox1.Text.StartsWith("00")) { message.setString(207, "SZSE"); //207 sz ���� } //message.setString(1, "0002077141");//1 Account �˺� if (!ordersAll.ContainsKey(id)) { OrderInfo info = new OrderInfo(message); ordersAll.Add(id, info); } _quickFixWrapper.Send(message); } else { MessageBox.Show("ָ���������"); } }