Exemplo n.º 1
0
        public string Test(string IP, short Port, string Version, short YybID, string AccountNo, string TradeAccount, string JyPassword, string TxPassword)
        {
            try
            {
                StringBuilder Result  = new StringBuilder(1024 * 1024);
                StringBuilder ErrInfo = new StringBuilder(256);

                int ClientID = TdxApi.Logon(IP, Port, Version, YybID, AccountNo, TradeAccount, JyPassword, TxPassword, ErrInfo);

                if (ClientID == -1)
                {
                    return(string.Format("{0}|{1}", ClientID, ErrInfo));
                }


                TdxApi.QueryData(ClientID, 5, Result, ErrInfo);
                TdxApi.Logoff(ClientID);


                return(string.Format("{0}|{1}", Result, ErrInfo));
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Exemplo n.º 2
0
        public bool Test(string IP, short Port, string Version, short YybID, string AccountNo, string TradeAccount, string JyPassword, string TxPassword)
        {
            try
            {
                StringBuilder Result  = new StringBuilder(1024 * 1024);
                StringBuilder ErrInfo = new StringBuilder(256);

                int ClientID = TdxApi.Logon(IP, Port, Version, YybID, AccountNo, TradeAccount, JyPassword, TxPassword, ErrInfo);

                if (ClientID == -1)
                {
                    MessageBox.Show("登录测试失败:" + ErrInfo.ToString());
                    return(false);
                }


                TdxApi.QueryData(ClientID, 5, Result, ErrInfo);
                TdxApi.Logoff(ClientID);


                return(true);
            }
            catch (Exception ex)
            {
                CommonUtils.Log("组合号添加异常:" + ex.Message);
                return(false);
            }
        }
Exemplo n.º 3
0
        public void Logoff()
        {
            try
            {
                if (this.IsIMSAccount)
                {
                    ImsApi.ImsPbClient_Disconnect();
                }
                else
                {
                    TdxApi.Logoff(this.ClientID);
                }
            }
            catch { }

            this.ClientID = -1;
        }