Example #1
0
        private void RefreshOrder(ProgressChangedEventArgs e)
        {
            AASClient.AASServiceReference.JyDataSet.委托DataTable 委托DataTable1 = e.UserState as AASClient.AASServiceReference.JyDataSet.委托DataTable;


            if (委托DataTable1 == null)
            {
                Program.logger.LogRunning("委托更新错误,委托列表为空,不能执行更新!");
                return;
            }

            //List<string> lstID = new List<string>();
            Dictionary <string, List <string> > dictOrder = new Dictionary <string, List <string> >();
            var newDt = 委托DataTable1.Copy();

            newDt.Clear();
            for (int i = 0; i < 委托DataTable1.Rows.Count; i++)
            {
                var row = 委托DataTable1.Rows[i];

                var orderID = row["委托编号"] as string;
                var groupID = row["组合号"] as string;
                if (dictOrder.ContainsKey(groupID) && dictOrder[groupID].Contains(orderID))
                {
                    continue;
                }
                else
                {
                    if (dictOrder.ContainsKey(groupID))
                    {
                        dictOrder[groupID].Add(orderID);
                    }
                    else
                    {
                        dictOrder.Add(groupID, new List <string>()
                        {
                            orderID
                        });
                    }
                }

                newDt.ImportRow(row);
            }

            Tool.RefreshDrcjDataTable(Program.jyDataSet.委托, newDt, new string[] { "组合号", "委托编号" });

            AASClient.AASServiceReference.JyDataSet.业绩统计DataTable 业绩统计DataTable1 = this.Generate业绩统计();
            Tool.RefreshDrcjDataTable(Program.jyDataSet.业绩统计, 业绩统计DataTable1, new string[] { "证券代码" });
        }
Example #2
0
        private void RefreshOrder(ProgressChangedEventArgs e)
        {
            AASClient.AASServiceReference.JyDataSet.委托DataTable 委托DataTable1 = e.UserState as AASClient.AASServiceReference.JyDataSet.委托DataTable;
            DateTime receiveTime = DateTime.Now;

            if (委托DataTable1 == null)
            {
                Program.logger.LogRunning("委托更新错误,委托列表为空,不能执行更新!");
                return;
            }

            Tool.RefreshDrcjDataTable(Program.jyDataSet.委托, 委托DataTable1, new string[] { "组合号", "委托编号" });


            Refresh业绩();



            foreach (var item in 委托DataTable1)
            {
                if (dictOrderSend.ContainsKey(item.证券代码) && dictOrderSend[item.证券代码].ContainsKey(item.委托编号))
                {
                    if (dictOrderSend[item.证券代码][item.委托编号] != "---")
                    {
                        Program.logger.LogInfo(string.Format("证券代码{0}, 委托编号{1} 首次收到该委托信息。 下单完成时间{2}, 收到委托时间{3}. ", item.证券代码, item.委托编号, dictOrderSend[item.证券代码][item.委托编号], receiveTime.ToString("HH:mm:ss fff")));
                        dictOrderSend[item.证券代码][item.委托编号] = "---";
                    }
                }
                else if (!dictOrderSend.ContainsKey(item.证券代码))
                {
                    dictOrderSend.Add(item.证券代码, new ConcurrentDictionary <string, string>());
                }
                else if (!dictOrderSend[item.证券代码].ContainsKey(item.委托编号))
                {
                    dictOrderSend[item.证券代码][item.委托编号] = "---";
                }

                if (dictOrderCancel.ContainsKey(item.证券代码) && dictOrderCancel[item.证券代码].ContainsKey(item.委托编号))
                {
                    if (dictOrderCancel[item.证券代码][item.委托编号] != "---")
                    {
                        Program.logger.LogInfo(string.Format("证券代码{0}, 委托编号{1} 首次收到该委托撤单数据。 撤单完成时间{2}, 收到委托时间{3}. ", item.证券代码, item.委托编号, dictOrderCancel[item.证券代码][item.委托编号], receiveTime.ToString("HH:mm:ss fff")));
                        dictOrderCancel[item.证券代码][item.委托编号] = "---";
                    }
                }
            }
        }
Example #3
0
        private void backgroundWorker报价_DoWork(object sender, DoWorkEventArgs e)
        {
            while (!this.backgroundWorker报价.CancellationPending)
            {
                this.backgroundWorker报价.ReportProgress(0);


                try
                {
                    if (DateTime.Now >= this.LastFetchDay.AddDays(1).AddHours(1))
                    {
                        Program.AASServiceClient.FectchAllTable(Program.Current平台用户.用户名);
                        this.LastFetchDay = DateTime.Today;
                    }



                    成交DataTableChanged 成交DataTableChanged1;
                    if (Program.成交表通知.TryDequeue(out 成交DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.成交DataTable 成交DataTable1 = 成交DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.成交DataTable;
                        this.backgroundWorker报价.ReportProgress(4, 成交DataTable1);
                    }


                    委托DataTableChanged 委托DataTableChanged1;
                    if (Program.委托表通知.TryDequeue(out 委托DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.委托DataTable 委托DataTable1 = 委托DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.委托DataTable;
                        this.backgroundWorker报价.ReportProgress(5, 委托DataTable1);
                    }

                    平台用户DataTableChanged 平台用户DataTableChanged1;
                    if (Program.平台用户表通知.TryDequeue(out 平台用户DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.平台用户DataTable 平台用户DataTable1 = 平台用户DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.平台用户DataTable;
                        this.backgroundWorker报价.ReportProgress(1, 平台用户DataTable1);
                    }

                    额度分配DataTableChanged 额度分配DataTableChanged1;
                    if (Program.额度分配表通知.TryDequeue(out 额度分配DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.额度分配DataTable 额度分配DataTable1 = 额度分配DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.额度分配DataTable;
                        this.backgroundWorker报价.ReportProgress(2, 额度分配DataTable1);
                    }

                    订单DataTableChanged 订单DataTableChanged1;
                    if (Program.订单表通知.TryDequeue(out 订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.订单DataTable 订单DataTable1 = 订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.订单DataTable;

                        foreach (AASClient.AASServiceReference.DbDataSet.订单Row 订单Row1 in 订单DataTable1)
                        {
                            if (Program.HqDataTable.ContainsKey(订单Row1.证券代码))
                            {
                                DataTable DataTable1 = Program.HqDataTable[订单Row1.证券代码];
                                DataRow   DataRow1   = DataTable1.Rows[0];
                                decimal   XJ         = decimal.Parse((DataRow1["现价"] as string));
                                decimal   ZS         = decimal.Parse((DataRow1["昨收"] as string));
                                订单Row1.当前价位 = Math.Round((XJ == 0 ? ZS : XJ), L2Api.Get精度(订单Row1.证券代码), MidpointRounding.AwayFromZero);


                                //订单Row1.刷新浮动盈亏(Program.Current平台用户.手续费率);
                                订单Row1.刷新浮动盈亏();
                            }
                        }

                        this.backgroundWorker报价.ReportProgress(6, 订单DataTable1);
                    }

                    已平仓订单DataTableChanged 已平仓订单DataTableChanged1;
                    if (Program.已平仓订单表通知.TryDequeue(out 已平仓订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable 已平仓订单DataTable1 = 已平仓订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable;
                        this.backgroundWorker报价.ReportProgress(7, 已平仓订单DataTable1);
                    }



                    Notify Notify1;
                    if (Program.交易通知.TryDequeue(out Notify1))
                    {
                        Program.logger.LogJy(Notify1.操作员, Notify1.证券代码, Notify1.证券名称, Notify1.委托编号, Notify1.买卖方向, Notify1.委托数量, Notify1.委托价格, Notify1.信息);
                    }



                    Thread.Sleep(100);
                }
                catch (Exception ex)
                {
                    Program.logger.LogRunning("报价线程异常:{0} {1}", ex.Message, ex.StackTrace);

                    Thread.Sleep(1000);
                }
            }
        }
Example #4
0
        private void backgroundWorker报价_DoWork(object sender, DoWorkEventArgs e)
        {
            while (!this.backgroundWorker报价.CancellationPending)
            {
                this.backgroundWorker报价.ReportProgress(0);

                try
                {
                    if (DateTime.Now >= this.LastFetchDay.AddDays(1).AddHours(1))
                    {
                        Program.AASServiceClient.FectchAllTable(Program.Current平台用户.用户名);
                        this.LastFetchDay = DateTime.Today;
                    }

                    成交DataTableChanged 成交DataTableChanged1;
                    if (Program.成交表通知.TryDequeue(out 成交DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.成交DataTable 成交DataTable1 = 成交DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.成交DataTable;
                        this.backgroundWorker报价.ReportProgress(4, 成交DataTable1);
                    }


                    委托DataTableChanged 委托DataTableChanged1;
                    if (Program.委托表通知.TryDequeue(out 委托DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.委托DataTable 委托DataTable1 = 委托DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.委托DataTable;
                        this.backgroundWorker报价.ReportProgress(5, 委托DataTable1);
                    }

                    平台用户DataTableChanged 平台用户DataTableChanged1;
                    if (Program.平台用户表通知.TryDequeue(out 平台用户DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.平台用户DataTable 平台用户DataTable1 = 平台用户DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.平台用户DataTable;
                        this.backgroundWorker报价.ReportProgress(1, 平台用户DataTable1);
                    }

                    额度分配DataTableChanged 额度分配DataTableChanged1;
                    if (Program.额度分配表通知.TryDequeue(out 额度分配DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.额度分配DataTable 额度分配DataTable1 = 额度分配DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.额度分配DataTable;
                        this.backgroundWorker报价.ReportProgress(2, 额度分配DataTable1);
                    }

                    订单DataTableChanged 订单DataTableChanged1;
                    if (Program.订单表通知.TryDequeue(out 订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.订单DataTable 订单DataTable1 = 订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.订单DataTable;
                        this.backgroundWorker报价.ReportProgress(6, 订单DataTable1);
                    }

                    已平仓订单DataTableChanged 已平仓订单DataTableChanged1;
                    if (Program.已平仓订单表通知.TryDequeue(out 已平仓订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable 已平仓订单DataTable1 = 已平仓订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable;
                        this.backgroundWorker报价.ReportProgress(7, 已平仓订单DataTable1);
                    }



                    Notify Notify1;
                    if (Program.交易通知.TryDequeue(out Notify1))
                    {
                        Program.logger.LogJy(Notify1.操作员, Notify1.证券代码, Notify1.证券名称, Notify1.委托编号, Notify1.买卖方向, Notify1.委托数量, Notify1.委托价格, Notify1.信息);
                    }



                    Thread.Sleep(100);
                }
                catch (Exception ex)
                {
                    Program.logger.LogRunning("报价线程异常:{0} {1}", ex.Message, ex.StackTrace);

                    Thread.Sleep(1000);
                }
            }
        }