跳转至

ReqAuthenticate

客户端认证请求,对应响应OnRspAuthenticate。如果交易系统开启了强制终端认证,则必须认证通过后才能发起登陆;如果未开启,则不需要认证即可登陆,此时如果主动去认证,不管成功或失败,也不影响后续登陆。

1.函数原型

virtual int ReqAuthenticate(CThostFtdcReqAuthenticateField *pReqAuthenticateField, int nRequestID) = 0;

2.参数

pReqAuthenticateField:客户端认证请求

字段类型字段名称含义
TThostFtdcBrokerIDType BrokerID 经纪公司代码 必填
TThostFtdcUserIDType UserID 用户代码
TThostFtdcProductInfoType UserProductInfo 用户端产品信息 必填
TThostFtdcAuthCodeType AuthCode 认证码 必填
TThostFtdcAppIDType AppID App代码 必填

UserProductInfo:需要向期货公司申请。

CTP后台用户事件中的用户登录事件所显示的用户端产品信息取自ReqAuthentication接口里的UserProductInfo,而非ReqUserLogin里的。

AuthCode:认证码需要向期货公司申请。

AppID:如果没有则要向期货公司申请,申请的AppID必须遵循监控中心规范格式。

UserID:用户代码。

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

3.返回

0,代表成功。

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

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

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

4.调用示例

ReqAuthenticate()
{
    memset(&field, 0, sizeof(field));
    strcpy(field.BrokerID, "8888");
    strcpy(field.UserID, "880002");
    strcpy(field.UserProductInfo, "aaa"); 
    strcpy(field.AppID, "bbb");
    strcpy(field.AuthCode, "GDNJCGPKS6V6FUEB");
    m_pUserApi->ReqAuthenticate(&field, nRequestID++);
}

5.FAQ