上期所提供的4个文件thostftdcmdapi.h,thostftdctraderapi.h,thostftdcuserapidatatype.h,thostftdcuserapistruct.h要怎么用啊
解决方案
200
一般是通过继承CThostFtdcTraderSpi类,然后重载他提供的虚函数来实现。
这是头文件,然后在对应的CPP文件里面实现
#ifndef TRADERSPI_H
#define TRADERSPI_H
#include “ThostFtdcTraderApi.h”
class CtpTraderSpi : public CThostFtdcTraderSpi
{
public:
CtpTraderSpi(CThostFtdcTraderApi* api);
///当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
virtual void OnFrontConnected();
///客户端认证响应
virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///登录请求响应
virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
//virtual void OnRspQryInvestorPositionDetail(

本文介绍了如何使用C++对接程序化交易系统的API接口,包括继承CThostFtdcTraderSpi类并重载其虚函数,如OnFrontConnected、OnRspUserLogin等,以实现交易和查询功能。此外,还提供了请求登录、查询结算信息、报单录入和操作等功能的实现方法。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



