跳转至

ReqUserLogin

用户登录请求,对应响应OnRspUserLogin

1.函数原型

virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;

2.参数

pReqUserLoginField:用户登录请求

字段类型字段名称含义
TThostFtdcBrokerIDType BrokerID 经纪公司代码 必填
TThostFtdcUserIDType UserID 用户代码 必填
TThostFtdcPasswordType Password 密码 必填
TThostFtdcDateType TradingDay 交易日
TThostFtdcProductInfoType UserProductInfo 用户端产品信息
TThostFtdcProductInfoType InterfaceProductInfo 接口端产品信息
TThostFtdcProtocolInfoType ProtocolInfo 协议信息
TThostFtdcMacAddressType MacAddress Mac地址
TThostFtdcPasswordType OneTimePassword 动态密码
TThostFtdcIPAddressType ClientIPAddress 终端IP地址
TThostFtdcLoginRemarkType LoginRemark 登录备注
TThostFtdcIPPortType ClientIPPort 终端IP端口
TThostFtdcOldIPAddressType reserve1 保留的无效字段

UserProductInfo:客户端的产品信息,如软件开发商、版本号等。

用户事件中的UserProductInfo取决于认证填写的值,而非登录。

nRequestID:请求ID,对应响应里的nRequestID,无递增规则,由用户自行维护。

3.返回

0,代表成功。

-1,表示网络连接失败;

-2,表示未处理请求超过许可数;

-3,表示每秒发送请求数超过许可数。

4.调用示例

ReqUserLogin()
{
    CThostFtdcReqUserLoginField reqUserLogin;
    memset(&reqUserLogin, 0, sizeof(reqUserLogin));
    strcpy_s(reqUserLogin.BrokerID, "8888");
    strcpy(reqUserLogin.UserID, "880002");
    strcpy(reqUserLogin.Password, "123");
    m_pUserApi->ReqUserLogin(&reqUserLogin, nRequestID++);
}

5.FAQ