コード例 #1
0
        private void QueryCJMain()
        {
            StringBuilder resultCJ  = new StringBuilder(1024 * 1024);
            StringBuilder errInfoCJ = new StringBuilder(256);

            while (true)
            {
                DateTime dt = DateTime.Now;
                if ((DateTime.Parse(CommonUtils.GetConfig("开始查询时间", "8:15")) <= DateTime.Now &&
                     DateTime.Now <= DateTime.Parse(CommonUtils.GetConfig("结束查询时间", "15:30"))))
                {
                    try
                    {
                        TdxApi.QueryData(ClientID, 3, resultCJ, errInfoCJ);
                        queueCj.Enqueue(resultCJ.ToString());
                        QueryInfo.SearchTradeErrInfo = errInfoCJ.ToString();
                    }
                    catch (Exception ex)
                    {
                        CommonUtils.Log("成交查询异常", ex);
                    }
                    Thread.Sleep(查询间隔时间);
                }
                else
                {
                    Thread.Sleep(10000);
                }
            }
        }
コード例 #2
0
        private void QueryData()
        {
            StringBuilder result  = new StringBuilder(1024 * 1024);
            StringBuilder errInfo = new StringBuilder(256);

            if (QueryInfo == null)
            {
                QueryInfo = new GroupService.QueryDataObj();
            }
            if (this.Multithreading == true)
            {
                QueryFilterData();
            }
            else
            {
                TdxApi.QueryData(this.ClientID, 3, result, errInfo);
                QueryInfo.SearchTradeResult  = result.ToString();
                QueryInfo.SearchTradeErrInfo = errInfo.ToString();

                Thread.Sleep(查询间隔时间 / 2);

                TdxApi.QueryData(this.ClientID, 2, result, errInfo);
                QueryInfo.SearchOperatorResult = result.ToString();
                QueryInfo.SearchOperatorError  = errInfo.ToString();
                Thread.Sleep(查询间隔时间 / 2);
            }
        }
コード例 #3
0
        public Queryinfo QueryData(string GroupName, int Category)
        {
            StringBuilder result  = new StringBuilder(1024 * 1024);
            StringBuilder errInfo = new StringBuilder(256);

            if (Adapter.GroupsDict.ContainsKey(GroupName))
            {
                var group = Adapter.GroupsDict[GroupName];
                if (group.ClientID > -1)
                {
                    var dtStart = DateTime.Now;
                    TdxApi.QueryData(group.ClientID, Category, result, errInfo);

                    var logonInfoItem = Adapter.GroupLogonList.First(_ => _.Name == GroupName);
                    logonInfoItem.Times = (DateTime.Now - dtStart).TotalSeconds.ToString();
                }
                else
                {
                    errInfo.Append("查询失败,组合号" + GroupName + " ClientID为-1");
                }
            }
            else
            {
                errInfo.Append("查询失败:未找到该组合号对应的配置信息!");
            }

            return(new Queryinfo()
            {
                Result = result.ToString(), Error = errInfo.ToString()
            });
        }
コード例 #4
0
        private void QueryFilterData()
        {
            StringBuilder resultWt  = new StringBuilder(1024 * 1024);
            StringBuilder errInfoWt = new StringBuilder(256);

            DateTime dt1 = DateTime.Now;

            TdxApi.QueryData(this.ClientID, 2, resultWt, errInfoWt);

            queueWt.Enqueue(resultWt.ToString());
            QueryInfo.SearchOperatorError = errInfoWt.ToString();
            Thread.Sleep(查询间隔时间 / 2);

            #region 其他线程
            if (QeuryCJThread == null)
            {
                QeuryCJThread = new Thread(new ThreadStart(QueryCJMain))
                {
                    IsBackground = true
                };
                QeuryCJThread.Start();
            }

            if (FilteWtDataThread == null)
            {
                FilteWtDataThread = new Thread(new ThreadStart(FilterWtDataMain))
                {
                    IsBackground = true
                };
                FilteWtDataThread.Start();
            }

            if (FilteCjDataThread == null)
            {
                FilteCjDataThread = new Thread(new ThreadStart(FilterCjDataMain))
                {
                    IsBackground = true
                };
                FilteCjDataThread.Start();
            }
            #endregion
        }