public ReportArgs QueryPositions()
        {
            ReportArgs reportArgs = new ReportArgs();

            if (this.clientID != -1)
            {
                StringBuilder errInfo = new StringBuilder(256);
                StringBuilder result  = new StringBuilder(1024 * 1024);
                TDXWrapper.QueryData(this.clientID, 1, result, errInfo);
                if (errInfo.ToString() != string.Empty)//查询失败
                {
                    reportArgs.Succeeded = false;
                    reportArgs.ErrorInfo = errInfo.ToString();
                }
                else//查询成功
                {
                    List <string[]> data = this.pickUp(result);
                    reportArgs.Succeeded = true;
                    List <PositionRecord> positions = new List <PositionRecord>();
                    for (int i = 1; i < data.Count; i++)
                    {
                        PositionRecord positionRecord = new PositionRecord();
                        positionRecord.SecurityID = data[i][0];
                        positionRecord.Quantity   = double.Parse(data[i][2]);
                        positionRecord.Available  = double.Parse(data[i][3]);
                        positionRecord.CostPrice  = double.Parse(data[i][4]);
                        switch (int.Parse(data[i][11]))
                        {
                        case 1:
                            positionRecord.SecurityExchange = "SHSE";
                            break;

                        case 0:
                            positionRecord.SecurityExchange = "SZSE";
                            break;
                        }
                        positions.Add(positionRecord);
                    }
                    reportArgs.Result = positions;
                }
            }
            else
            {
                reportArgs.Succeeded = false;
                reportArgs.ErrorInfo = "交易账号未登录.";
            }
            return(reportArgs);
        }
        public ReportArgs QueryFund()
        {
            ReportArgs reportArgs = new ReportArgs();

            if (this.clientID != -1)
            {
                StringBuilder errInfo = new StringBuilder(256);
                StringBuilder result  = new StringBuilder(1024 * 1024);
                TDXWrapper.QueryData(this.clientID, 0, result, errInfo);
                if (errInfo.ToString() != string.Empty)//查询失败
                {
                    reportArgs.Succeeded = false;
                    reportArgs.ErrorInfo = errInfo.ToString();
                }
                else//查询成功
                {
                    List <string[]> data = this.pickUp(result);
                    reportArgs.Succeeded = true;
                    if (data.Count > 1)
                    {
                        FundRecord fundRecord = new FundRecord();
                        fundRecord.Balance      = double.Parse(data[1][1]);
                        fundRecord.Available    = double.Parse(data[1][2]);
                        fundRecord.Frozen       = double.Parse(data[1][3]);
                        fundRecord.Desirable    = double.Parse(data[1][4]);
                        fundRecord.TotalAsserts = double.Parse(data[1][5]);
                        fundRecord.MarketValue  = double.Parse(data[1][6]);
                        reportArgs.Result       = fundRecord;
                    }
                }
            }
            else
            {
                reportArgs.Succeeded = false;
                reportArgs.ErrorInfo = "交易账号未登录.";
            }
            return(reportArgs);
        }
        public ReportArgs QueryOrders()
        {
            ReportArgs reportArgs = new ReportArgs();

            if (this.clientID != -1)
            {
                StringBuilder errInfo = new StringBuilder(256);
                StringBuilder result  = new StringBuilder(1024 * 1024);
                TDXWrapper.QueryData(this.clientID, 2, result, errInfo);
                if (errInfo.ToString() != string.Empty)//查询失败
                {
                    reportArgs.Succeeded = false;
                    reportArgs.ErrorInfo = errInfo.ToString();
                }
                else//查询成功
                {
                    List <string[]> data = this.pickUp(result);
                    reportArgs.Succeeded = true;
                    List <OrderRecord> resultList = new List <OrderRecord>();
                    string             dateString = DateTime.Today.ToString("yyyy-MM-dd");
                    for (int i = 1; i < data.Count; i++)
                    {
                        OrderRecord orderRecord = new OrderRecord();
                        orderRecord.TransactTime = DateTime.Parse(dateString + " " + data[i][0]);
                        orderRecord.SecurityID   = data[i][1];
                        orderRecord.OrderSide    = (OrderSide)int.Parse(data[i][3]);
                        switch (data[i][6])
                        {
                        case "待报":
                            orderRecord.OrderStatus = OrderStatus.PendingNew;
                            break;

                        case "已报":
                            orderRecord.OrderStatus = OrderStatus.New;
                            break;

                        case "部分成交":
                            orderRecord.OrderStatus = OrderStatus.PartiallyFilled;
                            break;

                        case "已成":
                            orderRecord.OrderStatus = OrderStatus.Filled;
                            break;

                        case "已报待撤":
                            orderRecord.OrderStatus = OrderStatus.PendingCancel;
                            break;

                        case "已撤":
                            orderRecord.OrderStatus = OrderStatus.Cancelled;
                            break;

                        default:
                            orderRecord.OrderStatus = OrderStatus.Rejected;
                            break;
                        }
                        orderRecord.OrderPrice   = double.Parse(data[i][7]);
                        orderRecord.OrderQty     = double.Parse(data[i][8]);
                        orderRecord.InnerOrderID = data[i][9];
                        orderRecord.AvgPx        = double.Parse(data[i][10]);
                        orderRecord.CumQty       = double.Parse(data[i][11]);
                        orderRecord.OrderType    = (OrderType)int.Parse(data[i][12]);
                        resultList.Add(orderRecord);
                    }
                    reportArgs.Result = resultList;
                }
            }
            else
            {
                reportArgs.Succeeded = false;
                reportArgs.ErrorInfo = "交易账号未登录.";
            }
            return(reportArgs);
        }