Example #1
0
        private void ReqAuthenticate()
        {
            var req = new ThostFtdcReqAuthenticateField();

            req.BrokerID        = BrokerID;
            req.UserID          = this.textBox1.Text;
            req.AuthCode        = AuthCode;
            req.UserProductInfo = UserProductInfo;
            int iResult = TraderApi.ReqAuthenticate(req, ++iRequestID);
        }
Example #2
0
        private void Auth()
        {
            var field = new ThostFtdcReqAuthenticateField {
                AuthCode = this._config.AuthCode, BrokerID = this._config.BrokerId, UserID = this._config.Account, UserProductInfo = this._config.UserProductInfo
            };
            var ret = this._trade.ReqAuthenticate(field, this._session.NextRequestID());

            if (ret != 0)
            {
                throw new Exception(string.Format("请求认证失败,返回{0}", ret));
            }
        }
Example #3
0
 /// <summary>
 /// """申请验证"""
 /// </summary>
 public void Authenticate()
 {
     if (string.IsNullOrEmpty(UserID) && string.IsNullOrEmpty(BrokerID) && string.IsNullOrEmpty(AuthCode) && string.IsNullOrEmpty(UserProductInfo))
     {
         ThostFtdcReqAuthenticateField req = new ThostFtdcReqAuthenticateField();
         req.AuthCode        = this.BrokerID;
         req.UserID          = this.UserID;
         req.AuthCode        = this.AuthCode;
         req.UserProductInfo = this.UserProductInfo;
         this.ReqAuthenticate(req, ++reqID);
     }
 }
Example #4
0
        void TraderApi_OnFrontEvent(object sender, OnFrontEventArgs e)
        {
            switch (e.EventType)
            {
            case EnumOnFrontType.OnFrontConnected:
            {
                if (chkAuthenticate.Checked)
                {
                    var req = new ThostFtdcReqAuthenticateField();
                    req.BrokerID = txtBrokerID.Text;
                    req.UserID   = txtUserID.Text;
                    req.AppID    = txtAppID.Text;
                    req.AuthCode = txtAuthCode.Text;

                    TraderApi.ReqAuthenticate(req, ++iRequestID);
                }
                else
                {
                    ReqUserLogin();
                }
            }
            break;
            }
        }
Example #5
0
 /// <summary>
 ///客户端认证请求
 /// </summary>
 public int ReqAuthenticate(ThostFtdcReqAuthenticateField pReqAuthenticateField, int nRequestID)
 {
     return(Interop.TdReqAuthenticate(Handle, pReqAuthenticateField, nRequestID));
 }
Example #6
0
 public static extern int TdReqAuthenticate(IntPtr pApi, ThostFtdcReqAuthenticateField pReqAuthenticateField, int nRequestID);