看穿式监管交易终端信息采集CTP主席客户测试流程.docx
- 文档编号:3896966
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:11
- 大小:182.76KB
看穿式监管交易终端信息采集CTP主席客户测试流程.docx
《看穿式监管交易终端信息采集CTP主席客户测试流程.docx》由会员分享,可在线阅读,更多相关《看穿式监管交易终端信息采集CTP主席客户测试流程.docx(11页珍藏版)》请在冰豆网上搜索。
看穿式监管交易终端信息采集CTP主席客户测试流程
看穿式监管交易终端信息采集(CTP主席)客户测试流程
1.尊敬的客户,请首先填写测试申请表。
(表见附录一)。
注意事项:
如果您的终端是其他软件商,请详细填写软件商的名称和联系方式(我司提供的交易软件除外),我司将协同您一起和软件商完成此项工作。
2.请将填写好的申请表发送给与您对应的我司业务经理;
3.我司根据申请单内容准备测试环境,发送客户终端测试授权码给您。
(客户APPID的命名见附录二)
4.请您根据测试授权码和测试环境信息进行连接和交易测试。
(具体的CTPAPI连接函数见附录三)
5.我司在收到测试信息后,完成测试反馈报告,业务经理将及时把测试反馈报告通知您。
6.注意:
上述测试环境中使用的测试授权码仅在测试环境中有效!
对于测试通过的交易终端,我司将统一发放正式生产环境授权码,用于您的交易终端接入生产环境,请及时关注我司的官网通知。
附录一:
测试申请表
客户填写
交易终端名称
客户账号
终端类型
□自开发
□其他软件商(软件商名字、联系方式)
客户使用终端ID(AppID/RelayAppID)
终端连接方式
□直连类型终端□多对多类型中继□多对一类型中继
业务部门填写
业务部门确认
信息技术部填写
终端授权码
测试的账号信息
测试的IP地址和端口
测试反馈
授权码测试结果
看穿式信息收集测试结果
备注:
1.多对多类型中继指的是为每个客户终端,建立CTPAPI实例,每个用户独占一个交易API实例的中继服务器。
客户需要使用自己的账户名密码登录。
2.多对一类型中继指为多个客户终端,建立一个CTPAPI实例,使用操作员为多个客户进行交易的中继服务器。
一般为境外中介采用方式。
附录二:
AppID/RelayAppID的生成规范
范例:
个人开发终端:
client_abcdf_1.0.0
第三方终端:
pobo_iee_1.4.0.0
中继厂商:
poboAPP_isssle_2.0.0.0
附录三:
CTP-API实例说明
穿透式监管数据采集说明
■6.3.15_API接口说明
└◆穿透式监管数据采集说明
◇1.定义
术语
术语说明
采集API链接库
负责采集终端信息的动态链接库,只有连接中继服务器的终端需要调用,直连模式或中继服务器无需调用
直连类型终端
直接连接到CTP交易系统的客户交易终端
中继类型终端
先连接到中继服务器,中继服务器再调用TraderAPI连接到CTP交易系统的客户交易终端
多对多类型中继服务器
为每个客户终端,建立CTPAPI实例,每个用户独占一个交易API实例的中继服务器
多对一类型中继服务器
为多个客户终端,建立一个CTPAPI实例,使用操作员为多个客户进行交易的中继服务器
AppID
每个期货终端软件需要向期货公司申请自己的AppID
RelayAppID
中继服务器软件需要向期货公司申请自己的RelayAppID
AppID和RelayAppID必须符合监控中心的格式要求。
见监控中心官网技术规范。
◇2.说明
期货公司确认终端软件集成了正确的数据采集模块后,为该AppID的终端软件分配授权码。
终端软件需要保护好自己的AppID和授权码,防止被其他软件盗用。
CTP对终端的认证流程如下:
∙直连终端认证流程
对于直接连接期货公司交易柜台的终端,期货公司确认终端软件集成了正确的数据采集模块后。
给该终端软件(根据AppID)分配一个授权码。
这个授权码和AppID是绑定的,当终端试图登录期货公司交易软件的时候,交易后台会验证该终端是否持有合法的AppID和授权码。
∙中继和中继下属终端的认证流程
对于使用中继服务器连接期货公司交易柜台的终端,期货公司确认终端软件集成了正确的数据采集模块和确认中继可以正常报送终端信息后。
期货公司给该终端软件(根据AppID)分配一个授权码,给中继服务器(根据RelayAppID)分配一个授权码。
当终端登录中继服务器时,中继服务器负责验证终端的合法性;当中继服务器登录期货公司交易软件的时候,交易后台会验证该中继服务器是否持有合法的RelayAppID和授权码。
◇3.相关接口
///客户端认证请求
virtualintReqAuthenticate(CThostFtdcReqAuthenticateField*pReqAuthenticateField,intnRequestID)=0;
///客户端认证响应
virtualvoidOnRspAuthenticate(CThostFtdcRspAuthenticateField*pRspAuthenticateField,CThostFtdcRspInfoField*pRspInfo,intnRequestID,boolbIsLast){};
///上报用户终端信息,用于中继服务器操作员登录模式
///操作员登录后,可以多次调用该接口上报客户信息
virtualintSubmitUserSystemInfo(CThostFtdcUserSystemInfoField*pUserSystemInfo)=0;
///注册用户终端信息,用于中继服务器多连接模式
///需要在终端认证成功后,用户登录前调用该接口
virtualintRegisterUserSystemInfo(CThostFtdcUserSystemInfoField*pUserSystemInfo)=0;
◇4.示例代码
每个类型的终端调用流程不同,请注意区分!
◇4.1.直连终端的采集使用流程示例代码:
Step1在API连接后发起认证
voidCUser:
:
OnFrontConnected()
{
cout<<"OnFrontConnected."< staticconstchar*version=m_pUserApi->GetApiVersion(); cout<<"------当前版本号: "< ReqAuthenticate(); } intCUser: : ReqAuthenticate() { CThostFtdcReqAuthenticateFieldfield; memset(&field,0,sizeof(field)); strcpy(rID,"8000"); strcpy(D,"001888"); strcpy(,"XY_Q7_V1.0.0"); strcpy(ode,"5A5P4V7AZ5LCFEAK"); returnm_pUserApi->ReqAuthenticate(&field,5); } Step2认证成功后发起登录 voidCUser: : OnRspAuthenticate(CThostFtdcRspAuthenticateField*pRspAuthenticateField,CThostFtdcRspInfoField*pRspInfo,intnRequestID,boolbIsLast) { printf("OnRspAuthenticate\n"); if(pRspInfo! =NULL&&pRspInfo->ErrorID==0) { printf("认证成功,ErrorID=0x%04x,ErrMsg=%s\n\n",pRspInfo->ErrorID,pRspInfo->ErrorMsg); ReqUserLogin(); } else cout<<"认证失败,"<<"ErrorID="< } intCUser: : ReqUserLogin() { printf("====ReqUserLogin====,用户登录中...\n\n"); CThostFtdcReqUserLoginFieldreqUserLogin; memset(&reqUserLogin,0,sizeof(reqUserLogin)); strcpy_s(rID,"8000"); strcpy(D,"001888"); strcpy(ord,"1"); strcpy(ngDay,""); returnm_pUserApi->ReqUserLogin(&reqUserLogin,++RequestID); } ◇4.2.多对多中继终端使用流程示例代码: Step1终端侧采集信息,向中继发起登录,并将终端信息发送给中继 charpSystemInfo[344]; intlen; CTP_GetSystemInfo(pSystemInfo,len); cout<<"CTP_GetSystemInfoonce"< Step2中继收到终端的登录请求,新建一个API实例,并发起连接 voidCUser: : OnFrontConnected() { cout<<"OnFrontConnected."< staticconstchar*version=m_pUserApi->GetApiVersion(); cout<<"------当前版本号: "< ReqAuthenticate(); } Step3中继连上前置后,发起认证请求 intCUser: : ReqAuthenticate() { CThostFtdcReqAuthenticateFieldfield; memset(&field,0,sizeof(field)); strcpy(rID,"8000"); strcpy(D,"001888"); strcpy(,"XY_RELAY_V1.0.0"); strcpy(ode,"5A5P4V7AZ5LCFEAK"); returnm_pUserApi->ReqAuthenticate(&field,5); } Step4中继认证成功后,注册终端的采集信息 voidCUser: : OnRspAuthenticate(CThostFtdcRspAuthenticateField*pRspAuthenticateField,CThostFtdcRspInfoField*pRspInfo,intnRequestID,boolbIsLast) { printf("OnRspAuthenticate\n"); if(pRspInfo! =NULL&&pRspInfo->ErrorID==0) { printf("认证成功,ErrorID=0x%04x,ErrMsg=%s\n\n",pRspInfo->ErrorID,pRspInfo->ErrorMsg); RegSystemInfo(); ReqUserLogin(); } else cout<<"认证失败,"<<"ErrorID="< } voidCUser: : RegSystemInfo() { //charpSystemInfo[344]; //intlen; ////将前面从终端得到的信息赋值给下面结构体 CThostFtdcUserSystemInfoFieldfield; memset(&field,0,sizeof(field)); strcpy(rID,"8000"); strcpy(D,"001888"); //strcpy(tSystemInfo,pSystemInfo);不能用因为不是字符串 memcpy(tSystemInfo,pSystemInfo,len); tSystemInfoLen=len; strcpy(tPublicIP,"198.4.4.124"); tIPPort=65535; strcpy(tLoginTime,"11: 28: 28"); strcpy(tAppID,"Q7"); intret=m_pUserApi->RegisterUserSystemInfo(&field); cout<<"retd="< } Step5中继注册好终端的信息后,发起登录 intCUser: : ReqUserLogin() { printf("====ReqUserLogin====,用户登录中...\n\n"); CThostFtdcReqUserLoginFieldreqUserLogin; memset(&reqUserLogin,0,sizeof(reqUserLogin)); strcpy_s(rID,"8000"); strcpy(D,"001888"); strcpy(ord,"1"); strcpy(ngDay,""); returnm_pUserApi->ReqUserLogin(&reqUserLogin,++RequestID); } ◇4.3.多对一中继终端使用流程示例代码: Step1中继在启动后,在API连接后发起认证 voidCUser: : OnFrontConnected() { cout<<"OnFrontConnected."< staticconstchar*version=m_pUserApi->GetApiVersion(); cout<<"------当前版本号: "< ReqAuthenticate(); } intCUser: : ReqAuthenticate() { CThostFtdcReqAuthenticateFieldfield; memset(&field,0,sizeof(field)); strcpy(rID,"8000"); strcpy(D,"8000_admin"); strcpy(,"XY_RELAYB_V1.0.0"); strcpy(ode,"BLFLTYGD16FZZ91T"); returnm_pUserApi->ReqAuthenticate(&field,5); } Step2中继认证成功后,使用操作员发起登录 voidCUser: : OnRspAuthenticate(CThostFtdcRspAuthenticateField*pRspAuthenticateField,CThostFtdcRspInfoField*pRspInfo,intnRequestID,boolbIsLast) { printf("OnRspAuthenticate\n"); if(pRspInfo! =NULL&&pRspInfo->ErrorID==0) { printf("认证成功,ErrorID=0x%04x,ErrMsg=%s\n\n",pRspInfo->ErrorID,pRspInfo->ErrorMsg); ReqUserLogin(); } else cout<<"认证失败,"<<"ErrorID="< } intCUser: : ReqUserLogin() { printf("====ReqUserLogin====,用户登录中...\n\n"); CThostFtdcReqUserLoginFieldreqUserLogin; memset(&reqUserLogin,0,sizeof(reqUserLogin)); strcpy_s(rID,"8000"); strcpy(D,"8000_admin"); strcpy(ord,"1"); strcpy(ngDay,""); strcpy(tIPAddress,"1.1.1.1"); tIPPort=11; returnm_pUserApi->ReqUserLogin(&reqUserLogin,++RequestID); } Step3此时有终端登录中继,并将采集信息发送给中继 charpSystemInfo[344]; intlen; CTP_GetSystemInfo(pSystemInfo,len); cout<<"CTP_GetSystemInfoonce"< Step4中继接收到采集信息后,发起终端信息的上报 voidCUser: : SubSystemInfo() { //charpSystemInfo[344]; //intlen; ///CTP_GetSystemInfo(pSystemInfo,len); /////终端信息由终端发送到中继,并提交信息 cout<<"SubSystemInfo1"< CThostFtdcUserSystemInfoFieldfield; memset(&field,0,sizeof(field)); strcpy(rID,"8000"); strcpy(D,""); //strcpy(tSystemInfo,pSystemInfo);不能用因为不是字符串 memcpy(tSystemInfo,pSystemInfo,len); tSystemInfoLen=len; strcpy(tPublicIP,"198.114.114.124"); tIPPort=65535; strcpy(tLoginTime,"11: 28: 28"); strcpy(tAppID,"Q7"); intretx=m_pUserApi->SubmitUserSystemInfo(&field); cout<<"ret="< //为另一个用户提交采集信息 CThostFtdcUserSystemInfoFieldfield1; memset(&field1,0,sizeof(field1)); strcpy(rID,"8000"); strcpy(D,""); memcpy(tSystemInfo,pSystemInfo,len); tSystemInfoLen=len; strcpy(tPublicIP,"198.4.4.120"); tIPPort=65532; strcpy(tLoginTime,"11: 28: 29"); strcpy(tAppID,"Q7"); m_pUserApi->SubmitUserSystemInfo(&field1); } 请参阅:
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 看穿 监管 交易 终端 信息 采集 CTP 主席 客户 测试 流程