完成QDP项目代码的修改,尚未完成测试

This commit is contained in:
chenxy123 2016-12-11 17:36:13 +08:00
parent af985ac39a
commit 49d704f801
38 changed files with 4447 additions and 11337 deletions

View File

@ -145,6 +145,8 @@ vn.py使用github托管其源代码贡献代码使用github的PR(Pull Request
* 飞鼠vn.sgit
* 飞创vn.xspeed
* QDPvn.qdp
* OANDAvn.oanda

Binary file not shown.

View File

@ -1,106 +0,0 @@
cmake_minimum_required(VERSION 2.8)
project(vn_qdp_api)
# 使
set(CMAKE_BUILD_TYPE "Release")
if (CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11")
endif ()
#
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
# 使64
option(USE_64BITS "comiple 64bits" ON)
if (USE_64BITS)
add_definitions(-DUSE_64BITS)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
endif()
# C++ API
if (WIN32)
set(QDPAPI_PATH qdpapi)
elseif (UNIX)
message("Under unix: " ${CMAKE_SIZEOF_VOID_P})
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
set(QDPAPI_PATH qdpapi/x64_linux)
endif()
endif()
include_directories(${QDPAPI_PATH})
set(QDPAPI_LIBRARY )
find_library(QDPAPI_MD_LIBRARY
NAMES qdpmdapi
PATHS ${QDPAPI_PATH})
find_library(QDPAPI_TD_LIBRARY
NAMES qdptraderapi
PATHS ${QDPAPI_PATH})
#
set (vnqdpmd )
set (vnqdptd )
option(BUILD_QDP_MD "build qdp md" ON)
if (BUILD_QDP_MD)
add_definitions(-DBUILD_QDP_MD)
set(QDP_MD_PATH vnqdpmd/vnqdpmd)
include_directories(QDP_MD_PATH)
set(VN_QDP_MD_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/vnqdpmd/vnqdpmd/vnqdpmd.cpp)
add_library(vnqdpmd SHARED ${VN_QDP_MD_SOURCE})
endif()
option(BUILD_QDP_TD "build qdp td" ON)
if (BUILD_QDP_TD)
add_definitions(-DBUILD_QDP_TD)
set(QDP_TD_PATH vnqdptd/vnqdptd)
include_directories(QDP_TD_PATH)
set(VN_QDP_TD_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/vnqdptd/vnqdptd/vnqdptd.cpp)
add_library(vnqdptd SHARED ${VN_QDP_TD_SOURCE})
endif()
# Python
set(PYTHON_LIBRARY )
if (WIN32)
set(PYTHON_INCLUDE_PATH D:/Anaconda2/include)
find_library(PYTHON_LIBRARY
NAMES python27
PATHS D:/Anaconda2/libs)
include_directories(${PYTHON_INCLUDE_PATH})
else()
set(PYTHON_INCLUDE_PATH /usr/include/python2.7/)
find_library(PYTHON_LIBRARY
NAMES python2.7
PATHS /usr/lib/x86_64-linux-gnu)
include_directories(${PYTHON_INCLUDE_PATH})
endif()
# boostanaconda
if (WIN32)
set(Boost_USE_STATIC_LIBS ON) #boost
endif()
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.55.0 COMPONENTS python thread date_time system chrono REQUIRED) # boost否者message(${Boost_LIBRARIES})
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
# solib
set_target_properties(vnqdpmd PROPERTIES PREFIX "")
# .so
target_link_libraries(vnqdpmd ${Boost_LIBRARIES} ${PYTHON_LIBRARY} ${QDPAPI_MD_LIBRARY})
# dllpydwindows
set(MD_DLL "${LIBRARY_OUTPUT_PATH}/Release/vnqdpmd.dll")
if (EXISTS ${MD_DLL})
file(RENAME ${MD_DLL} ${LIBRARY_OUTPUT_PATH}/Release/vnqdpmd.pyd)
endif()
# MD
set_target_properties(vnqdptd PROPERTIES PREFIX "")
target_link_libraries(vnqdptd ${Boost_LIBRARIES} ${PYTHON_LIBRARY} ${QDPAPI_TD_LIBRARY})
set(TD_DLL ${LIBRARY_OUTPUT_PATH}/Release/vnqdptd.dll)
if (EXISTS ${TD_DLL})
file(RENAME ${TD_DLL} ${LIBRARY_OUTPUT_PATH}/Release/vnqdptd.pyd)
endif()

View File

@ -1,17 +0,0 @@
#!/bin/bash
# Written by Suzhengchun on 20160213
set -e
BUILDDIR=build
rm -rf $BUILDDIR
if [ ! -f $BUILDDIR ]; then
mkdir -p $BUILDDIR
fi
pushd $BUILDDIR
cmake ..
make VERBOSE=1 -j 1
ln -fs `pwd`/lib/vnctpmd.so ../vnctpmd/test/vnctpmd.so
ln -fs `pwd`/lib/vnctptd.so ../vnctptd/test/vnctptd.so
cp ../vnctpmd/test/vnctpmd.* ../../vn.trader/ctpGateway/
cp ../vnctptd/test/vnctptd.* ../../vn.trader/ctpGateway/
popd

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,219 +0,0 @@
/////////////////////////////////////////////////////////////////////////
///@system QuantDo Platform
///@company 上海量投网络科技有限公司
///@file QdpFtdcMduserApi.h
///@brief 定义了客户端接口
///@history
///20130520 徐忠华 创建该文件
/////////////////////////////////////////////////////////////////////////
#ifndef QDP_FTDCMDUSERAPI_H
#define QDP_FTDCMDUSERAPI_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "QdpFtdcUserApiStruct.h"
#if defined(ISLIB) && defined(WIN32)
#ifdef LIB_MDUSER_API_EXPORT
#define MDUSER_API_EXPORT __declspec(dllexport)
#else
#define MDUSER_API_EXPORT __declspec(dllimport)
#endif
#else
#define MDUSER_API_EXPORT
#endif
class CQdpFtdcMduserSpi
{
public:
///当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
virtual void OnFrontConnected(){};
///当客户端与交易后台通信连接断开时该方法被调用。当发生这个情况后API会自动重新连接客户端可不做处理。
///@param nReason 错误原因
/// 0x1001 网络读失败
/// 0x1002 网络写失败
/// 0x2001 接收心跳超时
/// 0x2002 发送心跳失败
/// 0x2003 收到错误报文
virtual void OnFrontDisconnected(int nReason){};
///心跳超时警告。当长时间未收到报文时,该方法被调用。
///@param nTimeLapse 距离上次接收报文的时间
virtual void OnHeartBeatWarning(int nTimeLapse){};
///报文回调开始通知。当API收到一个报文后首先调用本方法然后是各数据域的回调最后是报文回调结束通知。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageStart(int nTopicID, int nSequenceNo){};
///报文回调结束通知。当API收到一个报文后首先调用报文回调开始通知然后是各数据域的回调最后调用本方法。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageEnd(int nTopicID, int nSequenceNo){};
//新增多播心跳接口 add by zbz 20150304
virtual void OnMultiHeartbeat(char *CurrTime,char *MultiCastIP) {};
//当广播收到值得时候回调函数被调用返回qmdata
virtual void UdpMarketData(CQdpFtdcDepthMarketDataField *qmdata){};
///错误应答
virtual void OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户登录应答
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户退出应答
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pRspUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///郑州合约状态
virtual void OnRtnQmdInstrumentStatu(CQdpFtdcQmdInstrumentStateField *pQmdInstrumentState) {};
///订阅主题应答
virtual void OnRspSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///主题查询应答
virtual void OnRspQryTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///深度行情通知
virtual void OnRtnDepthMarketData(CQdpFtdcDepthMarketDataField *pDepthMarketData) {};
///订阅合约的相关信息
virtual void OnRspSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///退订合约的相关信息
virtual void OnRspUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///行情查询应答
virtual void OnRspQryDepthMarketData(CQdpFtdcRspMarketDataField *pRspMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
};
class MDUSER_API_EXPORT CQdpFtdcMduserApi
{
public:
///创建MduserApi
///@param pszFlowPath 存贮订阅信息文件的目录,默认为当前目录
///@return 创建出的UserApi
static CQdpFtdcMduserApi *CreateFtdcMduserApi(const char *pszFlowPath = "");
///获取系统版本号
///@param nMajorVersion 主版本号
///@param nMinorVersion 子版本号
///@return 系统标识字符串
static const char *GetVersion(int &nMajorVersion, int &nMinorVersion);
///删除接口对象本身
///@remark 不再使用本接口对象时,调用该函数删除接口对象
virtual void Release() = 0;
//多播设置开关
virtual void SetMultiCast(bool bMultiCast=false) = 0;
//注册多播地址
virtual void RegTopicMultiAddr(char *pMultiAddr)=0;
///初始化
///@remark 初始化运行环境,只有调用后,接口才开始工作
virtual void Init() = 0;
///等待接口线程结束运行
///@return 线程退出代码
virtual int Join() = 0;
///获取当前交易日
///@retrun 获取到的交易日
///@remark 只有登录成功后,才能得到正确的交易日
virtual const char *GetTradingDay() = 0;
///注册前置机网络地址
///@param pszFrontAddress前置机网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:17001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”17001”代表服务器端口号。
virtual void RegisterFront(char *pszFrontAddress) = 0;
///注册名字服务器网络地址
///@param pszNsAddress名字服务器网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:12001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”12001”代表服务器端口号。
///@remark RegisterFront优先于RegisterNameServer
virtual void RegisterNameServer(char *pszNsAddress) = 0;
///注册回调接口
///@param pSpi 派生自回调接口类的实例
virtual void RegisterSpi(CQdpFtdcMduserSpi *pSpi) = 0;
///订阅市场行情。
///@param nTopicID 市场行情主题
///@param nResumeType 市场行情重传方式
/// QDP_TERT_RESTART:从本交易日开始重传
/// QDP_TERT_RESUME:从上次收到的续传(非订阅全部合约时,不支持续传模式)
/// QDP_TERT_QUICK:先传送当前行情快照,再传送登录后市场行情的内容
///@remark 该方法要在Init方法前调用。若不调用则不会收到私有流的数据。
virtual void SubscribeMarketDataTopic(int nTopicID, QDP_TE_RESUME_TYPE nResumeType) = 0;
///订阅合约行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int SubMarketData(char *ppInstrumentID[], int nCount)=0;
///退订合约行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int UnSubMarketData(char *ppInstrumentID[], int nCount)=0;
///设置心跳超时时间。
///@param timeout 心跳超时时间(秒)
virtual void SetHeartbeatTimeout(unsigned int timeout) = 0;
///共享内存取值
///@param CQdpFtdcShmDepthMarketDataField 传入参数
///@param CQdpFtdcDepthMarketDataField 查询到的行情值
///@return 0 操作成功
///@return -1 打开日志文件失败
virtual void ShmMarketData(CQdpFtdcShmDepthMarketDataField *reqfield,CQdpFtdcDepthMarketDataField *defdata) = 0;
///建立UDP连接
///@param udpip广播地址
///@return 0 操作成功
///@return -1 读取UDP失败
virtual void setudpchannel(char *udpip)= 0;
///用户登录请求
virtual int ReqUserLogin(CQdpFtdcReqUserLoginField *pReqUserLogin, int nRequestID) = 0;
///用户退出请求
virtual int ReqUserLogout(CQdpFtdcReqUserLogoutField *pReqUserLogout, int nRequestID) = 0;
///订阅主题请求
virtual int ReqSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///主题查询请求
virtual int ReqQryTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///订阅合约的相关信息
virtual int ReqSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, int nRequestID) = 0;
///退订合约的相关信息
virtual int ReqUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, int nRequestID) = 0;
///行情查询请求
virtual int ReqQryDepthMarketData(CQdpFtdcQryMarketDataField *pQryMarketData, int nRequestID) = 0;
//启动多播
//在无法登录服务器的情况下,调用此接口可以接收组播行情
//在可以登录的情况下无需调用此接口
//@param TradingDay 交易日,在没有登录的情况下,可以是自然日,但是要注意交易所的交易日
virtual void ActiveMultiMarketData(char * TradingDay) = 0;
protected:
~CQdpFtdcMduserApi(){};
};
#endif

View File

@ -156,7 +156,7 @@ struct CQdpFtdcInputOrderField
TQdpFtdcBoolType IsAutoSuspend;
///业务单元
TQdpFtdcBusinessUnitType BusinessUnit;
///用户自定义域
///用户自定义域`
TQdpFtdcCustomType UserCustom;
///营业部代码
TQdpFtdcBranchIDType BranchID;

File diff suppressed because it is too large Load Diff

View File

@ -48,9 +48,11 @@ void MdApi::processRspUserLogin(Task task)
data["UserID"] = task_data.UserID;
data["DataCenterID"] = task_data.DataCenterID;
data["TradingDay"] = task_data.TradingDay;
data["SessionID"] = task_data.SessionID;
data["BrokerID"] = task_data.BrokerID;
data["MaxOrderLocalID"] = task_data.MaxOrderLocalID;
data["TradingSystemName"] = task_data.TradingSystemName;
data["FrontID"] = task_data.FrontID;
data["LoginTime"] = task_data.LoginTime;
data["UserFlowSize"] = task_data.UserFlowSize;
@ -81,7 +83,13 @@ void MdApi::processRspUserLogout(Task task)
void MdApi::processRtnQmdInstrumentStatu(Task task)
{
PyLock lock;
this->onRtnQmdInstrumentStatu();
CQdpFtdcQmdInstrumentStateField task_data = any_cast<CQdpFtdcQmdInstrumentStateField>(task.task_data);
dict data;
data["InstrumentID"] = task_data.InstrumentID;
data["InstrumentStatus"] = task_data.InstrumentStatus;
data["ExchangeID"] = task_data.ExchangeID;
this->onRtnQmdInstrumentStatu(data);
};
void MdApi::processRspSubscribeTopic(Task task)
@ -201,11 +209,41 @@ void MdApi::processRspUnSubMarketData(Task task)
void MdApi::processRspQryDepthMarketData(Task task)
{
PyLock lock;
CQdpFtdcRspMarketDataField task_data = any_cast<CQdpFtdcRspMarketDataField>(task.task_data);
dict data;
data["HighestPrice"] = task_data.HighestPrice;
data["BidPrice1"] = task_data.BidPrice1;
data["LowerLimitPrice"] = task_data.LowerLimitPrice;
data["PreOpenInterest"] = task_data.PreOpenInterest;
data["PreClosePrice"] = task_data.PreClosePrice;
data["AskPrice1"] = task_data.AskPrice1;
data["PreSettlementPrice"] = task_data.PreSettlementPrice;
data["AskVolume1"] = task_data.AskVolume1;
data["UpdateTime"] = task_data.UpdateTime;
data["UpdateMillisec"] = task_data.UpdateMillisec;
data["SettlementGroupID"] = task_data.SettlementGroupID;
data["BidVolume1"] = task_data.BidVolume1;
data["Volume"] = task_data.Volume;
data["UpperLimitPrice"] = task_data.UpperLimitPrice;
data["InstrumentID"] = task_data.InstrumentID;
data["ClosePrice"] = task_data.ClosePrice;
data["ExchangeID"] = task_data.ExchangeID;
data["SettlementID"] = task_data.SettlementID;
data["TradingDay"] = task_data.TradingDay;
data["PreDelta"] = task_data.PreDelta;
data["OpenInterest"] = task_data.OpenInterest;
data["CurrDelta"] = task_data.CurrDelta;
data["Turnover"] = task_data.Turnover;
data["LastPrice"] = task_data.LastPrice;
data["SettlementPrice"] = task_data.SettlementPrice;
data["OpenPrice"] = task_data.OpenPrice;
data["LowestPrice"] = task_data.LowestPrice;
CQdpFtdcRspInfoField task_error = any_cast<CQdpFtdcRspInfoField>(task.task_error);
dict error;
error["ErrorMsg"] = task_error.ErrorMsg;
error["ErrorID"] = task_error.ErrorID;
this->onRspQryDepthMarketData(error, task.task_id, task.task_last);
this->onRspQryDepthMarketData(data, error, task.task_id, task.task_last);
};

View File

@ -159,7 +159,7 @@ CQdpFtdcInputOrderField["ForceCloseReason"] = "char"
CQdpFtdcInputOrderField["IsAutoSuspend"] = "int"
#业务单元
CQdpFtdcInputOrderField["BusinessUnit"] = "string"
#用户自定义域
#用户自定义域`
CQdpFtdcInputOrderField["UserCustom"] = "string"
#营业部代码
CQdpFtdcInputOrderField["BranchID"] = "string"

View File

@ -1,219 +0,0 @@
/////////////////////////////////////////////////////////////////////////
///@system QuantDo Platform
///@company 上海量投网络科技有限公司
///@file QdpFtdcMduserApi.h
///@brief 定义了客户端接口
///@history
///20130520 徐忠华 创建该文件
/////////////////////////////////////////////////////////////////////////
#ifndef QDP_FTDCMDUSERAPI_H
#define QDP_FTDCMDUSERAPI_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "QdpFtdcUserApiStruct.h"
#if defined(ISLIB) && defined(WIN32)
#ifdef LIB_MDUSER_API_EXPORT
#define MDUSER_API_EXPORT __declspec(dllexport)
#else
#define MDUSER_API_EXPORT __declspec(dllimport)
#endif
#else
#define MDUSER_API_EXPORT
#endif
class CQdpFtdcMduserSpi
{
public:
///当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
virtual void OnFrontConnected(){};
///当客户端与交易后台通信连接断开时该方法被调用。当发生这个情况后API会自动重新连接客户端可不做处理。
///@param nReason 错误原因
/// 0x1001 网络读失败
/// 0x1002 网络写失败
/// 0x2001 接收心跳超时
/// 0x2002 发送心跳失败
/// 0x2003 收到错误报文
virtual void OnFrontDisconnected(int nReason){};
///心跳超时警告。当长时间未收到报文时,该方法被调用。
///@param nTimeLapse 距离上次接收报文的时间
virtual void OnHeartBeatWarning(int nTimeLapse){};
///报文回调开始通知。当API收到一个报文后首先调用本方法然后是各数据域的回调最后是报文回调结束通知。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageStart(int nTopicID, int nSequenceNo){};
///报文回调结束通知。当API收到一个报文后首先调用报文回调开始通知然后是各数据域的回调最后调用本方法。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageEnd(int nTopicID, int nSequenceNo){};
//新增多播心跳接口 add by zbz 20150304
virtual void OnMultiHeartbeat(char *CurrTime,char *MultiCastIP) {};
//当广播收到值得时候回调函数被调用返回qmdata
virtual void UdpMarketData(CQdpFtdcDepthMarketDataField *qmdata){};
///错误应答
virtual void OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户登录应答
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户退出应答
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pRspUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///郑州合约状态
virtual void OnRtnQmdInstrumentStatu(CQdpFtdcQmdInstrumentStateField *pQmdInstrumentState) {};
///订阅主题应答
virtual void OnRspSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///主题查询应答
virtual void OnRspQryTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///深度行情通知
virtual void OnRtnDepthMarketData(CQdpFtdcDepthMarketDataField *pDepthMarketData) {};
///订阅合约的相关信息
virtual void OnRspSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///退订合约的相关信息
virtual void OnRspUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///行情查询应答
virtual void OnRspQryDepthMarketData(CQdpFtdcRspMarketDataField *pRspMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
};
class MDUSER_API_EXPORT CQdpFtdcMduserApi
{
public:
///创建MduserApi
///@param pszFlowPath 存贮订阅信息文件的目录,默认为当前目录
///@return 创建出的UserApi
static CQdpFtdcMduserApi *CreateFtdcMduserApi(const char *pszFlowPath = "");
///获取系统版本号
///@param nMajorVersion 主版本号
///@param nMinorVersion 子版本号
///@return 系统标识字符串
static const char *GetVersion(int &nMajorVersion, int &nMinorVersion);
///删除接口对象本身
///@remark 不再使用本接口对象时,调用该函数删除接口对象
virtual void Release() = 0;
//多播设置开关
virtual void SetMultiCast(bool bMultiCast=false) = 0;
//注册多播地址
virtual void RegTopicMultiAddr(char *pMultiAddr)=0;
///初始化
///@remark 初始化运行环境,只有调用后,接口才开始工作
virtual void Init() = 0;
///等待接口线程结束运行
///@return 线程退出代码
virtual int Join() = 0;
///获取当前交易日
///@retrun 获取到的交易日
///@remark 只有登录成功后,才能得到正确的交易日
virtual const char *GetTradingDay() = 0;
///注册前置机网络地址
///@param pszFrontAddress前置机网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:17001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”17001”代表服务器端口号。
virtual void RegisterFront(char *pszFrontAddress) = 0;
///注册名字服务器网络地址
///@param pszNsAddress名字服务器网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:12001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”12001”代表服务器端口号。
///@remark RegisterFront优先于RegisterNameServer
virtual void RegisterNameServer(char *pszNsAddress) = 0;
///注册回调接口
///@param pSpi 派生自回调接口类的实例
virtual void RegisterSpi(CQdpFtdcMduserSpi *pSpi) = 0;
///订阅市场行情。
///@param nTopicID 市场行情主题
///@param nResumeType 市场行情重传方式
/// QDP_TERT_RESTART:从本交易日开始重传
/// QDP_TERT_RESUME:从上次收到的续传(非订阅全部合约时,不支持续传模式)
/// QDP_TERT_QUICK:先传送当前行情快照,再传送登录后市场行情的内容
///@remark 该方法要在Init方法前调用。若不调用则不会收到私有流的数据。
virtual void SubscribeMarketDataTopic(int nTopicID, QDP_TE_RESUME_TYPE nResumeType) = 0;
///订阅合约行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int SubMarketData(char *ppInstrumentID[], int nCount)=0;
///退订合约行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int UnSubMarketData(char *ppInstrumentID[], int nCount)=0;
///设置心跳超时时间。
///@param timeout 心跳超时时间(秒)
virtual void SetHeartbeatTimeout(unsigned int timeout) = 0;
///共享内存取值
///@param CQdpFtdcShmDepthMarketDataField 传入参数
///@param CQdpFtdcDepthMarketDataField 查询到的行情值
///@return 0 操作成功
///@return -1 打开日志文件失败
virtual void ShmMarketData(CQdpFtdcShmDepthMarketDataField *reqfield,CQdpFtdcDepthMarketDataField *defdata) = 0;
///建立UDP连接
///@param udpip广播地址
///@return 0 操作成功
///@return -1 读取UDP失败
virtual void setudpchannel(char *udpip)= 0;
///用户登录请求
virtual int ReqUserLogin(CQdpFtdcReqUserLoginField *pReqUserLogin, int nRequestID) = 0;
///用户退出请求
virtual int ReqUserLogout(CQdpFtdcReqUserLogoutField *pReqUserLogout, int nRequestID) = 0;
///订阅主题请求
virtual int ReqSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///主题查询请求
virtual int ReqQryTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///订阅合约的相关信息
virtual int ReqSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, int nRequestID) = 0;
///退订合约的相关信息
virtual int ReqUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, int nRequestID) = 0;
///行情查询请求
virtual int ReqQryDepthMarketData(CQdpFtdcQryMarketDataField *pQryMarketData, int nRequestID) = 0;
//启动多播
//在无法登录服务器的情况下,调用此接口可以接收组播行情
//在可以登录的情况下无需调用此接口
//@param TradingDay 交易日,在没有登录的情况下,可以是自然日,但是要注意交易所的交易日
virtual void ActiveMultiMarketData(char * TradingDay) = 0;
protected:
~CQdpFtdcMduserApi(){};
};
#endif

View File

@ -1,219 +0,0 @@
/////////////////////////////////////////////////////////////////////////
///@system QuantDo Platform
///@company 上海量投网络科技有限公司
///@file QdpFtdcMduserApi.h
///@brief 定义了客户端接口
///@history
///20130520 徐忠华 创建该文件
/////////////////////////////////////////////////////////////////////////
#ifndef QDP_FTDCMDUSERAPI_H
#define QDP_FTDCMDUSERAPI_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "QdpFtdcUserApiStruct.h"
#if defined(ISLIB) && defined(WIN32)
#ifdef LIB_MDUSER_API_EXPORT
#define MDUSER_API_EXPORT __declspec(dllexport)
#else
#define MDUSER_API_EXPORT __declspec(dllimport)
#endif
#else
#define MDUSER_API_EXPORT
#endif
class CQdpFtdcMduserSpi
{
public:
///当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
virtual void OnFrontConnected(){};
///当客户端与交易后台通信连接断开时该方法被调用。当发生这个情况后API会自动重新连接客户端可不做处理。
///@param nReason 错误原因
/// 0x1001 网络读失败
/// 0x1002 网络写失败
/// 0x2001 接收心跳超时
/// 0x2002 发送心跳失败
/// 0x2003 收到错误报文
virtual void OnFrontDisconnected(int nReason){};
///心跳超时警告。当长时间未收到报文时,该方法被调用。
///@param nTimeLapse 距离上次接收报文的时间
virtual void OnHeartBeatWarning(int nTimeLapse){};
///报文回调开始通知。当API收到一个报文后首先调用本方法然后是各数据域的回调最后是报文回调结束通知。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageStart(int nTopicID, int nSequenceNo){};
///报文回调结束通知。当API收到一个报文后首先调用报文回调开始通知然后是各数据域的回调最后调用本方法。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageEnd(int nTopicID, int nSequenceNo){};
//新增多播心跳接口 add by zbz 20150304
virtual void OnMultiHeartbeat(char *CurrTime,char *MultiCastIP) {};
//当广播收到值得时候回调函数被调用返回qmdata
virtual void UdpMarketData(CQdpFtdcDepthMarketDataField *qmdata){};
///错误应答
virtual void OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户登录应答
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户退出应答
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pRspUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///郑州合约状态
virtual void OnRtnQmdInstrumentStatu(CQdpFtdcQmdInstrumentStateField *pQmdInstrumentState) {};
///订阅主题应答
virtual void OnRspSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///主题查询应答
virtual void OnRspQryTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///深度行情通知
virtual void OnRtnDepthMarketData(CQdpFtdcDepthMarketDataField *pDepthMarketData) {};
///订阅合约的相关信息
virtual void OnRspSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///退订合约的相关信息
virtual void OnRspUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///行情查询应答
virtual void OnRspQryDepthMarketData(CQdpFtdcRspMarketDataField *pRspMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
};
class MDUSER_API_EXPORT CQdpFtdcMduserApi
{
public:
///创建MduserApi
///@param pszFlowPath 存贮订阅信息文件的目录,默认为当前目录
///@return 创建出的UserApi
static CQdpFtdcMduserApi *CreateFtdcMduserApi(const char *pszFlowPath = "");
///获取系统版本号
///@param nMajorVersion 主版本号
///@param nMinorVersion 子版本号
///@return 系统标识字符串
static const char *GetVersion(int &nMajorVersion, int &nMinorVersion);
///删除接口对象本身
///@remark 不再使用本接口对象时,调用该函数删除接口对象
virtual void Release() = 0;
//多播设置开关
virtual void SetMultiCast(bool bMultiCast=false) = 0;
//注册多播地址
virtual void RegTopicMultiAddr(char *pMultiAddr)=0;
///初始化
///@remark 初始化运行环境,只有调用后,接口才开始工作
virtual void Init() = 0;
///等待接口线程结束运行
///@return 线程退出代码
virtual int Join() = 0;
///获取当前交易日
///@retrun 获取到的交易日
///@remark 只有登录成功后,才能得到正确的交易日
virtual const char *GetTradingDay() = 0;
///注册前置机网络地址
///@param pszFrontAddress前置机网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:17001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”17001”代表服务器端口号。
virtual void RegisterFront(char *pszFrontAddress) = 0;
///注册名字服务器网络地址
///@param pszNsAddress名字服务器网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:12001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”12001”代表服务器端口号。
///@remark RegisterFront优先于RegisterNameServer
virtual void RegisterNameServer(char *pszNsAddress) = 0;
///注册回调接口
///@param pSpi 派生自回调接口类的实例
virtual void RegisterSpi(CQdpFtdcMduserSpi *pSpi) = 0;
///订阅市场行情。
///@param nTopicID 市场行情主题
///@param nResumeType 市场行情重传方式
/// QDP_TERT_RESTART:从本交易日开始重传
/// QDP_TERT_RESUME:从上次收到的续传(非订阅全部合约时,不支持续传模式)
/// QDP_TERT_QUICK:先传送当前行情快照,再传送登录后市场行情的内容
///@remark 该方法要在Init方法前调用。若不调用则不会收到私有流的数据。
virtual void SubscribeMarketDataTopic(int nTopicID, QDP_TE_RESUME_TYPE nResumeType) = 0;
///订阅合约行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int SubMarketData(char *ppInstrumentID[], int nCount)=0;
///退订合约行情。
///@param ppInstrumentID 合约ID
///@param nCount 要订阅/退订行情的合约个数
///@remark
virtual int UnSubMarketData(char *ppInstrumentID[], int nCount)=0;
///设置心跳超时时间。
///@param timeout 心跳超时时间(秒)
virtual void SetHeartbeatTimeout(unsigned int timeout) = 0;
///共享内存取值
///@param CQdpFtdcShmDepthMarketDataField 传入参数
///@param CQdpFtdcDepthMarketDataField 查询到的行情值
///@return 0 操作成功
///@return -1 打开日志文件失败
virtual void ShmMarketData(CQdpFtdcShmDepthMarketDataField *reqfield,CQdpFtdcDepthMarketDataField *defdata) = 0;
///建立UDP连接
///@param udpip广播地址
///@return 0 操作成功
///@return -1 读取UDP失败
virtual void setudpchannel(char *udpip)= 0;
///用户登录请求
virtual int ReqUserLogin(CQdpFtdcReqUserLoginField *pReqUserLogin, int nRequestID) = 0;
///用户退出请求
virtual int ReqUserLogout(CQdpFtdcReqUserLogoutField *pReqUserLogout, int nRequestID) = 0;
///订阅主题请求
virtual int ReqSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///主题查询请求
virtual int ReqQryTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///订阅合约的相关信息
virtual int ReqSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, int nRequestID) = 0;
///退订合约的相关信息
virtual int ReqUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, int nRequestID) = 0;
///行情查询请求
virtual int ReqQryDepthMarketData(CQdpFtdcQryMarketDataField *pQryMarketData, int nRequestID) = 0;
//启动多播
//在无法登录服务器的情况下,调用此接口可以接收组播行情
//在可以登录的情况下无需调用此接口
//@param TradingDay 交易日,在没有登录的情况下,可以是自然日,但是要注意交易所的交易日
virtual void ActiveMultiMarketData(char * TradingDay) = 0;
protected:
~CQdpFtdcMduserApi(){};
};
#endif

View File

@ -1,345 +0,0 @@
/////////////////////////////////////////////////////////////////////////
///@system QuantDo Platform
///@company 上海量投网络科技有限公司
///@file QdpFtdcTraderApi.h
///@brief 定义了客户端接口
///@history
///20150520 徐忠华 创建该文件
/////////////////////////////////////////////////////////////////////////
#if !defined(QDP_FTDCTRADERAPI_H)
#define QDP_FTDCTRADERAPI_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "QdpFtdcUserApiStruct.h"
#if defined(ISLIB) && defined(WIN32)
#ifdef LIB_TRADER_API_EXPORT
#define TRADER_API_EXPORT __declspec(dllexport)
#else
#define TRADER_API_EXPORT __declspec(dllimport)
#endif
#else
#define TRADER_API_EXPORT
#endif
class CQdpFtdcTraderSpi
{
public:
///当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
virtual void OnFrontConnected(){};
///当客户端与交易后台通信连接断开时该方法被调用。当发生这个情况后API会自动重新连接客户端可不做处理。
///@param nReason 错误原因
/// 0x1001 网络读失败
/// 0x1002 网络写失败
/// 0x2001 接收心跳超时
/// 0x2002 发送心跳失败
/// 0x2003 收到错误报文
virtual void OnFrontDisconnected(int nReason){};
///心跳超时警告。当长时间未收到报文时,该方法被调用。
///@param nTimeLapse 距离上次接收报文的时间
virtual void OnHeartBeatWarning(int nTimeLapse){};
///报文回调开始通知。当API收到一个报文后首先调用本方法然后是各数据域的回调最后是报文回调结束通知。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageStart(int nTopicID, int nSequenceNo){};
///报文回调结束通知。当API收到一个报文后首先调用报文回调开始通知然后是各数据域的回调最后调用本方法。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageEnd(int nTopicID, int nSequenceNo){};
///错误应答
virtual void OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户登录应答
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户退出应答
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pRspUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///用户密码修改应答
virtual void OnRspUserPasswordUpdate(CQdpFtdcUserPasswordUpdateField *pUserPasswordUpdate, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///报单录入应答
virtual void OnRspOrderInsert(CQdpFtdcInputOrderField *pInputOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///报单操作应答
virtual void OnRspOrderAction(CQdpFtdcOrderActionField *pOrderAction, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///期货发起银行资金转期货应答
virtual void OnRspFromBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///期货发起期货资金转银行应答
virtual void OnRspFromFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///数据流回退通知
virtual void OnRtnFlowMessageCancel(CQdpFtdcFlowMessageCancelField *pFlowMessageCancel) {};
///成交回报
virtual void OnRtnTrade(CQdpFtdcTradeField *pTrade) {};
///报单回报
virtual void OnRtnOrder(CQdpFtdcOrderField *pOrder) {};
///报单录入错误回报
virtual void OnErrRtnOrderInsert(CQdpFtdcInputOrderField *pInputOrder, CQdpFtdcRspInfoField *pRspInfo) {};
///报单操作错误回报
virtual void OnErrRtnOrderAction(CQdpFtdcOrderActionField *pOrderAction, CQdpFtdcRspInfoField *pRspInfo) {};
///合约交易状态通知
virtual void OnRtnInstrumentStatus(CQdpFtdcInstrumentStatusField *pInstrumentStatus) {};
///账户出入金回报
virtual void OnRtnInvestorAccountDeposit(CQdpFtdcInvestorAccountDepositResField *pInvestorAccountDepositRes) {};
///QDP警告消息通知
virtual void OnRtnMessageNotify(CQdpFtdcMessageNotifyInfoField *pMessageNotifyInfo) {};
///期货发起查询银行余额错误回报
virtual void OnErrRtnQueryBankBalanceByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, CQdpFtdcRspInfoField *pRspInfo) {};
///期货发起银行资金转期货错误回报
virtual void OnErrRtnBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo) {};
///期货发起期货资金转银行错误回报
virtual void OnErrRtnFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo) {};
///期货发起查询银行余额通知
virtual void OnRtnQueryBankBalanceByFuture(CQdpFtdcNotifyQueryAccountField *pNotifyQueryAccount) {};
///期货发起银行资金转期货通知
virtual void OnRtnFromBankToFutureByFuture(CQdpFtdcRspTransferField *pRspTransfer) {};
///期货发起期货资金转银行通知
virtual void OnRtnFromFutureToBankByFuture(CQdpFtdcRspTransferField *pRspTransfer) {};
///金交所递延费率通知
virtual void OnRtnSGEDeferRate(CQdpFtdcSGEDeferRateField *pSGEDeferRate) {};
///报单查询应答
virtual void OnRspQryOrder(CQdpFtdcOrderField *pOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///成交单查询应答
virtual void OnRspQryTrade(CQdpFtdcTradeField *pTrade, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///可用投资者账户查询应答
virtual void OnRspQryUserInvestor(CQdpFtdcRspUserInvestorField *pRspUserInvestor, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///投资者资金账户查询应答
virtual void OnRspQryInvestorAccount(CQdpFtdcRspInvestorAccountField *pRspInvestorAccount, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///合约查询应答
virtual void OnRspQryInstrument(CQdpFtdcRspInstrumentField *pRspInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///交易所查询应答
virtual void OnRspQryExchange(CQdpFtdcRspExchangeField *pRspExchange, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///投资者持仓查询应答
virtual void OnRspQryInvestorPosition(CQdpFtdcRspInvestorPositionField *pRspInvestorPosition, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///订阅主题应答
virtual void OnRspSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///主题查询应答
virtual void OnRspQryTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///投资者手续费率查询应答
virtual void OnRspQryInvestorFee(CQdpFtdcInvestorFeeField *pInvestorFee, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///投资者保证金率查询应答
virtual void OnRspQryInvestorMargin(CQdpFtdcInvestorMarginField *pInvestorMargin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///交易所时间偏差查询应答
virtual void OnRspQryExchangeDiffTime(CQdpFtdcRspExchangeDiffTimeField *pRspExchangeDiffTime, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///查询签约银行应答
virtual void OnRspQryContractBank(CQdpFtdcContractBankField *pContractBank, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///期货发起查询银行余额应答
virtual void OnRspQueryBankAccountMoneyByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///查询转账流水应答
virtual void OnRspQryTransferSerial(CQdpFtdcTransferSerialField *pTransferSerial, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///金交所递延费率查询应答
virtual void OnRspQrySGEDeferRate(CQdpFtdcSGEDeferRateField *pSGEDeferRate, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
///实时行情查询应答
virtual void OnRspQryMarketData(CQdpFtdcMarketDataField *pMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
};
class TRADER_API_EXPORT CQdpFtdcTraderApi
{
public:
///创建TraderApi
///@param pszFlowPath 存贮订阅信息文件的目录,默认为当前目录
///@return 创建出的UserApi
static CQdpFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = "");
///获取系统版本号
///@param nMajorVersion 主版本号
///@param nMinorVersion 子版本号
///@return 系统标识字符串
static const char *GetVersion(int &nMajorVersion, int &nMinorVersion);
///删除接口对象本身
///@remark 不再使用本接口对象时,调用该函数删除接口对象
virtual void Release() = 0;
///初始化
///@remark 初始化运行环境,只有调用后,接口才开始工作
virtual void Init() = 0;
///等待接口线程结束运行
///@return 线程退出代码
virtual int Join() = 0;
///获取当前交易日
///@retrun 获取到的交易日
///@remark 只有登录成功后,才能得到正确的交易日
virtual const char *GetTradingDay() = 0;
///注册前置机网络地址
///@param pszFrontAddress前置机网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:17001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”17001”代表服务器端口号。
virtual void RegisterFront(char *pszFrontAddress) = 0;
///注册名字服务器网络地址
///@param pszNsAddress名字服务器网络地址。
///@remark 网络地址的格式为“protocol://ipaddress:port””tcp://127.0.0.1:12001”。
///@remark “tcp”代表传输协议“127.0.0.1”代表服务器地址。”12001”代表服务器端口号。
///@remark RegisterFront优先于RegisterNameServer
virtual void RegisterNameServer(char *pszNsAddress) = 0;
///注册回调接口
///@param pSpi 派生自回调接口类的实例
virtual void RegisterSpi(CQdpFtdcTraderSpi *pSpi) = 0;
///订阅私有流。
///@param nResumeType 私有流重传方式
/// QDP_TERT_RESTART:从本交易日开始重传
/// QDP_TERT_RESUME:从上次收到的续传
/// QDP_TERT_QUICK:只传送登录后私有流的内容
///@remark 该方法要在Init方法前调用。若不调用则不会收到私有流的数据。
virtual void SubscribePrivateTopic(QDP_TE_RESUME_TYPE nResumeType) = 0;
///订阅公共流。
///@param nResumeType 公共流重传方式
/// QDP_TERT_RESTART:从本交易日开始重传
/// QDP_TERT_RESUME:从上次收到的续传
/// QDP_TERT_QUICK:只传送登录后公共流的内容
///@remark 该方法要在Init方法前调用。若不调用则不会收到公共流的数据。
virtual void SubscribePublicTopic(QDP_TE_RESUME_TYPE nResumeType) = 0;
///订阅交易员流。
///@param nResumeType 交易员流重传方式
/// QDP_TERT_RESTART:从本交易日开始重传
/// QDP_TERT_RESUME:从上次收到的续传
/// QDP_TERT_QUICK:只传送登录后交易员流的内容
///@remark 该方法要在Init方法前调用。若不调用则不会收到交易员流的数据。
virtual void SubscribeUserTopic(QDP_TE_RESUME_TYPE nResumeType) = 0;
///设置心跳超时时间。
///@param timeout 心跳超时时间(秒)
virtual void SetHeartbeatTimeout(unsigned int timeout) = 0;
///打开请求日志文件
///@param pszReqLogFileName 请求日志文件名
///@return 0 操作成功
///@return -1 打开日志文件失败
virtual int OpenRequestLog(const char *pszReqLogFileName) = 0;
///打开应答日志文件
///@param pszRspLogFileName 应答日志文件名
///@return 0 操作成功
///@return -1 打开日志文件失败
virtual int OpenResponseLog(const char *pszRspLogFileName) = 0;
///用户登录请求
virtual int ReqUserLogin(CQdpFtdcReqUserLoginField *pReqUserLogin, int nRequestID) = 0;
///用户退出请求
virtual int ReqUserLogout(CQdpFtdcReqUserLogoutField *pReqUserLogout, int nRequestID) = 0;
///用户密码修改请求
virtual int ReqUserPasswordUpdate(CQdpFtdcUserPasswordUpdateField *pUserPasswordUpdate, int nRequestID) = 0;
///报单录入请求
virtual int ReqOrderInsert(CQdpFtdcInputOrderField *pInputOrder, int nRequestID) = 0;
///报单操作请求
virtual int ReqOrderAction(CQdpFtdcOrderActionField *pOrderAction, int nRequestID) = 0;
///期货发起银行资金转期货请求
virtual int ReqFromBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, int nRequestID) = 0;
///期货发起期货资金转银行请求
virtual int ReqFromFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, int nRequestID) = 0;
///报单查询请求
virtual int ReqQryOrder(CQdpFtdcQryOrderField *pQryOrder, int nRequestID) = 0;
///成交单查询请求
virtual int ReqQryTrade(CQdpFtdcQryTradeField *pQryTrade, int nRequestID) = 0;
///可用投资者账户查询请求
virtual int ReqQryUserInvestor(CQdpFtdcQryUserInvestorField *pQryUserInvestor, int nRequestID) = 0;
///投资者资金账户查询请求
virtual int ReqQryInvestorAccount(CQdpFtdcQryInvestorAccountField *pQryInvestorAccount, int nRequestID) = 0;
///合约查询请求
virtual int ReqQryInstrument(CQdpFtdcQryInstrumentField *pQryInstrument, int nRequestID) = 0;
///交易所查询请求
virtual int ReqQryExchange(CQdpFtdcQryExchangeField *pQryExchange, int nRequestID) = 0;
///投资者持仓查询请求
virtual int ReqQryInvestorPosition(CQdpFtdcQryInvestorPositionField *pQryInvestorPosition, int nRequestID) = 0;
///订阅主题请求
virtual int ReqSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///主题查询请求
virtual int ReqQryTopic(CQdpFtdcDisseminationField *pDissemination, int nRequestID) = 0;
///投资者手续费率查询请求
virtual int ReqQryInvestorFee(CQdpFtdcQryInvestorFeeField *pQryInvestorFee, int nRequestID) = 0;
///投资者保证金率查询请求
virtual int ReqQryInvestorMargin(CQdpFtdcQryInvestorMarginField *pQryInvestorMargin, int nRequestID) = 0;
///交易所时间偏差查询请求
virtual int ReqQryExchangeDiffTime(CQdpFtdcQryExchangeDiffTimeField *pQryExchangeDiffTime, int nRequestID) = 0;
///查询签约银行请求
virtual int ReqQryContractBank(CQdpFtdcQryContractBankField *pQryContractBank, int nRequestID) = 0;
///期货发起查询银行余额请求
virtual int ReqQueryBankAccountMoneyByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, int nRequestID) = 0;
///查询转账流水请求
virtual int ReqQryTransferSerial(CQdpFtdcQryTransferSerialField *pQryTransferSerial, int nRequestID) = 0;
///金交所递延费率查询请求
virtual int ReqQrySGEDeferRate(CQdpFtdcQrySGEDeferRateField *pQrySGEDeferRate, int nRequestID) = 0;
///实时行情查询请求
virtual int ReqQryMarketData(CQdpFtdcQryMarketDataField *pQryMarketData, int nRequestID) = 0;
protected:
~CQdpFtdcTraderApi(){};
};
#endif

View File

@ -1,840 +0,0 @@
/////////////////////////////////////////////////////////////////////////
///@system QuantDo Platform
///@company QuantDo
///@file QdpFtdcUserApiDataType.h
///@brief 定义了客户端接口使用的业务数据类型
///@history
///
/////////////////////////////////////////////////////////////////////////
#ifndef QDP_FTDCDATATYPE_H
#define QDP_FTDCDATATYPE_H
enum QDP_TE_RESUME_TYPE
{
QDP_TERT_RESTART = 0,
QDP_TERT_RESUME,
QDP_TERT_QUICK
};
/////////////////////////////////////////////////////////////////////////
///定义交易通道类型类别
/////////////////////////////////////////////////////////////////////////
//连接中金所
#define QDP_EI_CFFEX "CFFEX"
//连接上期所
#define QDP_EI_SHFE "SHFE"
//连接大商所
#define QDP_EI_DCE "DCE"
//连接郑商所
#define QDP_EI_ZCE "CZCE"
//连接上证所
#define QDP_EI_SSE "SSE"
//连接深交所
#define QDP_EI_SZSE "SZSE"
//连接黄金交易所
#define QDP_EI_SGE "SGE"
//连接芝加哥商品期货交易所
#define QDP_EI_CME "CME"
//连接伦敦金属交易所
#define QDP_EI_LME "LME"
//连接国泰君安的通道
#define QDP_EI_GTJA "GTJA"
//连接上海国际能源中心的通道
#define QDP_EI_INE "INE"
const int QDP_TSS_DIALOG = 1; //对话流
const int QDP_TSS_PRIVATE = 2; //客户私有流
const int QDP_TSS_PUBLIC = 3; //公共流
const int QDP_TSS_QUERY = 4; //查询
const int QDP_TSS_USER = 5; //用户私有流
/////////////////////////////////////////////////////////////////////////
///TFtdcPriceTickType是一个最小变动价位类型
/////////////////////////////////////////////////////////////////////////
typedef double TQdpFtdcPriceTickType;
/////////////////////////////////////////////////////////////////////////
///TFtdcPriceType是一个价格类型
/////////////////////////////////////////////////////////////////////////
typedef double TQdpFtdcPriceType;
/////////////////////////////////////////////////////////////////////////
///TFtdcRatioType是一个比率类型
/////////////////////////////////////////////////////////////////////////
typedef double TQdpFtdcRatioType;
/////////////////////////////////////////////////////////////////////////
///TFtdcMoneyType是一个资金类型
/////////////////////////////////////////////////////////////////////////
typedef double TQdpFtdcMoneyType;
/////////////////////////////////////////////////////////////////////////
///TFtdcLargeVolumeType是一个大额数量类型
/////////////////////////////////////////////////////////////////////////
typedef double TQdpFtdcLargeVolumeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcFeeType是一个费用类型
/////////////////////////////////////////////////////////////////////////
typedef double TQdpFtdcFeeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcInventoryType是一个库存类型
/////////////////////////////////////////////////////////////////////////
typedef double TQdpFtdcInventoryType;
/////////////////////////////////////////////////////////////////////////
///TFtdcSequenceNoType是一个序列号类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcSequenceNoType;
/////////////////////////////////////////////////////////////////////////
///TFtdcMillisecType是一个最后修改毫秒类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcMillisecType;
/////////////////////////////////////////////////////////////////////////
///TFtdcVolumeType是一个数量类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcVolumeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcUnderlyingMultipleType是一个合约乘数类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcUnderlyingMultipleType;
/////////////////////////////////////////////////////////////////////////
///TFtdcVolumeMultipleType是一个数量乘数类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcVolumeMultipleType;
/////////////////////////////////////////////////////////////////////////
///TFtdcSequenceSeriesType是一个序列系列号类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcSequenceSeriesType;
/////////////////////////////////////////////////////////////////////////
///TFtdcSessionIDType是一个会话编号类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcSessionIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcErrorIDType是一个错误代码类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcErrorIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcDataCenterIDType是一个数据中心代码类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcDataCenterIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcFrontIDType是一个前置编号类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcFrontIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcRequestIDType是一个报单编号类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcRequestIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcTopicIDType是一个主题代码类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcTopicIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcSettlementIDType是一个结算编号类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcSettlementIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcTotalNumsType是一个累加次数类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcTotalNumsType;
/////////////////////////////////////////////////////////////////////////
///TFtdcDiffSndType是一个偏差时间类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcDiffSndType;
/////////////////////////////////////////////////////////////////////////
///TFtdcTIDType是一个交易ID类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcTIDType;
/////////////////////////////////////////////////////////////////////////
///TFtdcMonthType是一个月份类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcMonthType;
/////////////////////////////////////////////////////////////////////////
///TFtdcBoolType是一个布尔型类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcBoolType;
/////////////////////////////////////////////////////////////////////////
///TFtdcYearType是一个年类型
/////////////////////////////////////////////////////////////////////////
typedef int TQdpFtdcYearType;
/////////////////////////////////////////////////////////////////////////
///TFtdcMemTableNameType是一个内存表名类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcMemTableNameType[61];
/////////////////////////////////////////////////////////////////////////
///TFtdcOrderSysIDType是一个报单编号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcOrderSysIDType[31];
/////////////////////////////////////////////////////////////////////////
///TFtdcTradeIDType是一个成交编号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcTradeIDType[21];
/////////////////////////////////////////////////////////////////////////
///TFtdcUserIDType是一个用户代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcUserIDType[16];
/////////////////////////////////////////////////////////////////////////
///TFtdcParticipantIDType是一个会员编号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcParticipantIDType[11];
/////////////////////////////////////////////////////////////////////////
///TFtdcIPAddressType是一个IP地址类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcIPAddressType[21];
/////////////////////////////////////////////////////////////////////////
///TFtdcMacAddressType是一个Mac地址类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcMacAddressType[21];
/////////////////////////////////////////////////////////////////////////
///TFtdcInstrumentNameType是一个合约名称类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcInstrumentNameType[21];
/////////////////////////////////////////////////////////////////////////
///TFtdcBranchIDType是一个营业部代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcBranchIDType[7];
/////////////////////////////////////////////////////////////////////////
///TFtdcInstrumentIDType是一个合约编号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcInstrumentIDType[31];
/////////////////////////////////////////////////////////////////////////
///TFtdcIdentifiedCardNoType是一个证件号码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcIdentifiedCardNoType[51];
/////////////////////////////////////////////////////////////////////////
///TFtdcIdentifiedCardTypeType是一个证件类型类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcIdentifiedCardTypeType[16];
/////////////////////////////////////////////////////////////////////////
///TFtdcExchangeIDType是一个交易(所)通道类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcExchangeIDType[11];
/////////////////////////////////////////////////////////////////////////
///TFtdcExchangeNameType是一个交易(所)所名称类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcExchangeNameType[31];
/////////////////////////////////////////////////////////////////////////
///TFtdcDateType是一个日期类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcDateType[9];
/////////////////////////////////////////////////////////////////////////
///TFtdcTimeType是一个时间类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcTimeType[9];
/////////////////////////////////////////////////////////////////////////
///TFtdcClientTypeType是一个客户类型类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcClientTypeType[2];
/////////////////////////////////////////////////////////////////////////
///TFtdcClientNameType是一个客户名称类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcClientNameType[81];
/////////////////////////////////////////////////////////////////////////
///TFtdcClientIDType是一个客户编码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcClientIDType[19];
/////////////////////////////////////////////////////////////////////////
///TFtdcAccountIDType是一个资金帐号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcAccountIDType[13];
/////////////////////////////////////////////////////////////////////////
///TFtdcSeatIDType是一个席位号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcSeatIDType[13];
/////////////////////////////////////////////////////////////////////////
///TFtdcProductNameType是一个品种名称类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcProductNameType[41];
/////////////////////////////////////////////////////////////////////////
///TFtdcUserOrderLocalIDType是一个用户本地报单号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcUserOrderLocalIDType[23];
/////////////////////////////////////////////////////////////////////////
///TFtdcOrderLocalIDType是一个本地报单编号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcOrderLocalIDType[33];
/////////////////////////////////////////////////////////////////////////
///TFtdcInvestorIDType是一个投资者编号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcInvestorIDType[19];
/////////////////////////////////////////////////////////////////////////
///TFtdcUserNameType是一个用户编码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcUserNameType[31];
/////////////////////////////////////////////////////////////////////////
///TFtdcPasswordType是一个密码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcPasswordType[41];
/////////////////////////////////////////////////////////////////////////
///TFtdcAbstractType是一个消息摘要类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcAbstractType[81];
/////////////////////////////////////////////////////////////////////////
///TFtdcProductInfoType是一个产品信息类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcProductInfoType[41];
/////////////////////////////////////////////////////////////////////////
///TFtdcProtocolInfoType是一个协议信息类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcProtocolInfoType[41];
/////////////////////////////////////////////////////////////////////////
///TFtdcBusinessUnitType是一个业务单元类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcBusinessUnitType[21];
/////////////////////////////////////////////////////////////////////////
///TFtdcTradingSystemNameType是一个交易系统名称类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcTradingSystemNameType[61];
/////////////////////////////////////////////////////////////////////////
///TFtdcBrokerIDType是一个经纪公司代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcBrokerIDType[11];
/////////////////////////////////////////////////////////////////////////
///TFtdcCustomType是一个用户自定义域类型类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcCustomType[65];
/////////////////////////////////////////////////////////////////////////
///TFtdcTradingDayType是一个交易日类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcTradingDayType[9];
/////////////////////////////////////////////////////////////////////////
///TFtdcDepartmentType是一个营业部类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcDepartmentType[41];
/////////////////////////////////////////////////////////////////////////
///TFtdcGrantFuncSetType是一个授权功能号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcGrantFuncSetType[5];
/////////////////////////////////////////////////////////////////////////
///TFtdcProductIDType是一个品种编号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcProductIDType[13];
/////////////////////////////////////////////////////////////////////////
///TFtdcAccountSeqNoType是一个资金流水号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcAccountSeqNoType[21];
/////////////////////////////////////////////////////////////////////////
///TFtdcSettlementGroupIDType是一个结算组代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcSettlementGroupIDType[9];
/////////////////////////////////////////////////////////////////////////
///TFtdcBankIDType是一个银行代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcBankIDType[4];
/////////////////////////////////////////////////////////////////////////
///TFtdcBankBrchIDType是一个银行分中心代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcBankBrchIDType[5];
/////////////////////////////////////////////////////////////////////////
///TFtdcBankAccountType是一个银行账号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcBankAccountType[41];
/////////////////////////////////////////////////////////////////////////
///TFtdcNameType是一个名称类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcNameType[101];
/////////////////////////////////////////////////////////////////////////
///TFtdcTradeCodeType是一个业务功能码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcTradeCodeType[7];
/////////////////////////////////////////////////////////////////////////
///TFtdcSerialType是一个流水号类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcSerialType[13];
/////////////////////////////////////////////////////////////////////////
///TFtdcDeviceIDType是一个渠道标志类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcDeviceIDType[3];
/////////////////////////////////////////////////////////////////////////
///TFtdcBankCodingForFutureType是一个期货公司银行编码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcBankCodingForFutureType[33];
/////////////////////////////////////////////////////////////////////////
///TFtdcErrorMsgType是一个错误信息类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcErrorMsgType[81];
/////////////////////////////////////////////////////////////////////////
///TFtdcVolumeConditionType是一个成交量类型类型
/////////////////////////////////////////////////////////////////////////
///任何数量
#define QDP_FTDC_VC_AV '1'
///最小数量
#define QDP_FTDC_VC_MV '2'
///全部数量
#define QDP_FTDC_VC_CV '3'
typedef char TQdpFtdcVolumeConditionType;
/////////////////////////////////////////////////////////////////////////
///TFtdcForceCloseReasonType是一个强平原因类型
/////////////////////////////////////////////////////////////////////////
///非强平
#define QDP_FTDC_FCR_NotForceClose '0'
///资金不足
#define QDP_FTDC_FCR_LackDeposit '1'
///客户超仓
#define QDP_FTDC_FCR_ClientOverPositionLimit '2'
///会员超仓
#define QDP_FTDC_FCR_MemberOverPositionLimit '3'
///持仓非整数倍
#define QDP_FTDC_FCR_NotMultiple '4'
typedef char TQdpFtdcForceCloseReasonType;
/////////////////////////////////////////////////////////////////////////
///TFtdcInstrumentStatusType是一个合约交易状态类型
/////////////////////////////////////////////////////////////////////////
///开盘前
#define QDP_FTDC_IS_BeforeTrading '0'
///非交易
#define QDP_FTDC_IS_NoTrading '1'
///连续交易
#define QDP_FTDC_IS_Continous '2'
///集合竞价报单
#define QDP_FTDC_IS_AuctionOrdering '3'
///集合竞价价格平衡
#define QDP_FTDC_IS_AuctionBalance '4'
///集合竞价撮合
#define QDP_FTDC_IS_AuctionMatch '5'
///收盘
#define QDP_FTDC_IS_Closed '6'
///金交所交割申报
#define QDP_FTDC_IS_SGE_Dery_App '7'
///金交所交割申报结束
#define QDP_FTDC_IS_SGE_Dery_Match '8'
///金交所中立仓申报
#define QDP_FTDC_IS_SGE_Mid_App '9'
///金交所交割申报撮合
#define QDP_FTDC_IS_SGE_Mid_Match 'a'
///大商所自动转换报警
#define QDP_FTDC_IS_DCE_MarketStatusAlarm 'b'
typedef char TQdpFtdcInstrumentStatusType;
/////////////////////////////////////////////////////////////////////////
///TFtdcOffsetFlagType是一个开平标志类型
/////////////////////////////////////////////////////////////////////////
///开仓
#define QDP_FTDC_OF_Open '0'
///平仓
#define QDP_FTDC_OF_Close '1'
///强平
#define QDP_FTDC_OF_ForceClose '2'
///平今
#define QDP_FTDC_OF_CloseToday '3'
///平昨
#define QDP_FTDC_OF_CloseYesterday '4'
typedef char TQdpFtdcOffsetFlagType;
/////////////////////////////////////////////////////////////////////////
///TFtdcOrderPriceTypeType是一个报单价格条件类型
/////////////////////////////////////////////////////////////////////////
///任意价
#define QDP_FTDC_OPT_AnyPrice '1'
///限价
#define QDP_FTDC_OPT_LimitPrice '2'
///最优价
#define QDP_FTDC_OPT_BestPrice '3'
///五档价
#define QDP_FTDC_OPT_FiveLevelPrice '4'
typedef char TQdpFtdcOrderPriceTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcOrderStatusType是一个报单状态类型
/////////////////////////////////////////////////////////////////////////
///全部成交
#define QDP_FTDC_OS_AllTraded '0'
///部分成交还在队列中
#define QDP_FTDC_OS_PartTradedQueueing '1'
///部分成交不在队列中
#define QDP_FTDC_OS_PartTradedNotQueueing '2'
///未成交还在队列中
#define QDP_FTDC_OS_NoTradeQueueing '3'
///未成交不在队列中
#define QDP_FTDC_OS_NoTradeNotQueueing '4'
///撤单
#define QDP_FTDC_OS_Canceled '5'
///订单已报入交易所未应答
#define QDP_FTDC_OS_AcceptedNoReply '6'
typedef char TQdpFtdcOrderStatusType;
/////////////////////////////////////////////////////////////////////////
///TFtdcUserTypeType是一个用户类型类型
/////////////////////////////////////////////////////////////////////////
///自然人
#define QDP_FTDC_UT_Person '1'
///理财产品
#define QDP_FTDC_UT_Product '2'
///期货公司管理员
#define QDP_FTDC_UT_Manager '3'
///席位
#define QDP_FTDC_UT_Seat '4'
typedef char TQdpFtdcUserTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcTradingRightType是一个交易权限类型
/////////////////////////////////////////////////////////////////////////
///可以交易
#define QDP_FTDC_TR_Allow '0'
///只能平仓
#define QDP_FTDC_TR_CloseOnly '1'
///不能交易
#define QDP_FTDC_TR_Forbidden '2'
typedef char TQdpFtdcTradingRightType;
/////////////////////////////////////////////////////////////////////////
///TFtdcTimeConditionType是一个有效期类型类型
/////////////////////////////////////////////////////////////////////////
///立即完成,否则撤销
#define QDP_FTDC_TC_IOC '1'
///本节有效
#define QDP_FTDC_TC_GFS '2'
///当日有效
#define QDP_FTDC_TC_GFD '3'
///指定日期前有效
#define QDP_FTDC_TC_GTD '4'
///撤销前有效
#define QDP_FTDC_TC_GTC '5'
///集合竞价有效
#define QDP_FTDC_TC_GFA '6'
typedef char TQdpFtdcTimeConditionType;
/////////////////////////////////////////////////////////////////////////
///TFtdcOrderSourceType是一个报单来源类型
/////////////////////////////////////////////////////////////////////////
///来自参与者
#define QDP_FTDC_OS_Participant '0'
///来自管理员
#define QDP_FTDC_OS_Administrator '1'
typedef char TQdpFtdcOrderSourceType;
/////////////////////////////////////////////////////////////////////////
///TFtdcDirectionType是一个买卖方向类型
/////////////////////////////////////////////////////////////////////////
///买
#define QDP_FTDC_D_Buy '0'
///卖
#define QDP_FTDC_D_Sell '1'
typedef char TQdpFtdcDirectionType;
/////////////////////////////////////////////////////////////////////////
///TFtdcCurrencyType是一个币种类型
/////////////////////////////////////////////////////////////////////////
///人民币
#define QDP_FTDC_C_RMB '1'
///美元
#define QDP_FTDC_C_UDOLLAR '2'
typedef char TQdpFtdcCurrencyType;
/////////////////////////////////////////////////////////////////////////
///TFtdcAccountDirectionType是一个出入金方向类型
/////////////////////////////////////////////////////////////////////////
///入金
#define QDP_FTDC_AD_In '1'
///出金
#define QDP_FTDC_AD_Out '2'
typedef char TQdpFtdcAccountDirectionType;
/////////////////////////////////////////////////////////////////////////
///TFtdcClientHedgeFlagType是一个客户投机套保标志类型
/////////////////////////////////////////////////////////////////////////
///投机
#define QDP_FTDC_CHF_Speculation '1'
///套利
#define QDP_FTDC_CHF_Arbitrage '2'
///套保
#define QDP_FTDC_CHF_Hedge '3'
///做市商
#define QDP_FTDC_CHF_MarketMaker '4'
typedef char TQdpFtdcClientHedgeFlagType;
/////////////////////////////////////////////////////////////////////////
///TFtdcHedgeFlagType是一个投机套保标志类型
/////////////////////////////////////////////////////////////////////////
///投机
#define QDP_FTDC_CHF_Speculation '1'
///套利
#define QDP_FTDC_CHF_Arbitrage '2'
///套保
#define QDP_FTDC_CHF_Hedge '3'
///做市商
#define QDP_FTDC_CHF_MarketMaker '4'
typedef char TQdpFtdcHedgeFlagType;
/////////////////////////////////////////////////////////////////////////
///TFtdcActionFlagType是一个操作标志类型
/////////////////////////////////////////////////////////////////////////
///删除
#define QDP_FTDC_AF_Delete '0'
///挂起
#define QDP_FTDC_AF_Suspend '1'
///激活
#define QDP_FTDC_AF_Active '2'
///修改
#define QDP_FTDC_AF_Modify '3'
typedef char TQdpFtdcActionFlagType;
/////////////////////////////////////////////////////////////////////////
///TFtdcPositionTypeType是一个持仓类型类型
/////////////////////////////////////////////////////////////////////////
///净持仓
#define QDP_FTDC_PT_Net '1'
///综合持仓
#define QDP_FTDC_PT_Gross '2'
typedef char TQdpFtdcPositionTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcOptionsTypeType是一个期权类型类型
/////////////////////////////////////////////////////////////////////////
///非期权
#define QDP_FTDC_OT_NotOptions '0'
///看涨
#define QDP_FTDC_OT_CallOptions '1'
///看跌
#define QDP_FTDC_OT_PutOptions '2'
typedef char TQdpFtdcOptionsTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcIsActiveType是一个是否活跃类型
/////////////////////////////////////////////////////////////////////////
///不活跃
#define QDP_FTDC_UIA_NoActive '0'
///活跃
#define QDP_FTDC_UIA_Active '1'
typedef char TQdpFtdcIsActiveType;
/////////////////////////////////////////////////////////////////////////
///TFtdcProductClassType是一个产品类型类型
/////////////////////////////////////////////////////////////////////////
///期货
#define QDP_FTDC_PC_Futures '1'
///期权
#define QDP_FTDC_PC_Options '2'
///组合
#define QDP_FTDC_PC_Combination '3'
///即期
#define QDP_FTDC_PC_Spot '4'
///期转现
#define QDP_FTDC_PC_EFP '5'
///未知类型
#define QDP_FTDC_PC_Unknown '6'
///证券
#define QDP_FTDC_PC_Stocks '7'
///股票期权
#define QDP_FTDC_PC_StockOptions '8'
///金交所现货
#define QDP_FTDC_PC_SGE_SPOT '9'
///金交所递延
#define QDP_FTDC_PC_SGE_DEFER 'a'
///金交所远期
#define QDP_FTDC_PC_SGE_FOWARD 'b'
typedef char TQdpFtdcProductClassType;
/////////////////////////////////////////////////////////////////////////
///TFtdcCurrencyIDType是一个币种代码类型
/////////////////////////////////////////////////////////////////////////
typedef char TQdpFtdcCurrencyIDType[4];
/////////////////////////////////////////////////////////////////////////
///TFtdcBusinessTypeType是一个业务类别类型
/////////////////////////////////////////////////////////////////////////
///普通
#define QDP_FTDC_BT_Normal '1'
///撤单
#define QDP_FTDC_BT_Cancel '2'
///ETF申赎
#define QDP_FTDC_BT_AppliedForRedeemed '3'
///最优五档即时成交剩余撤销
#define QDP_FTDC_BT_FiveLevelIOC '4'
///最优五档即时成交剩余转限价
#define QDP_FTDC_BT_FiveLevelGFD '5'
///即时成交剩余撤销
#define QDP_FTDC_BT_BestPriceIOC '6'
///全额成交或撤销
#define QDP_FTDC_BT_FOK '7'
///本方最优价格
#define QDP_FTDC_BT_SelfGFD '8'
///对方最优价格
#define QDP_FTDC_BT_CpGFD '9'
///金交所中立仓申报
#define QDP_FTDC_BT_SGEMidApp 'a'
///套利组合单
#define QDP_FTDC_BT_Combination 'b'
///套利非组合单
#define QDP_FTDC_BT_Grab 'c'
///金交所递延交割申报
#define QDP_FTDC_BT_SGEDeferDeliApp 'd'
typedef char TQdpFtdcBusinessTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcTransferStatusType是一个转账交易状态类型
/////////////////////////////////////////////////////////////////////////
///正常
#define QDP_FTDC_TS_TRFS_Normal '0'
///被冲正
#define QDP_FTDC_TS_TRFS_Repealed '1'
typedef char TQdpFtdcTransferStatusType;
/////////////////////////////////////////////////////////////////////////
///TFtdcFeePayFlagType是一个费用支付标志类型
/////////////////////////////////////////////////////////////////////////
///由受益方支付费用
#define QDP_FTDC_FPF_FPF_BEN '0'
///由发送方支付费用
#define QDP_FTDC_FPF_FPF_OUR '1'
///由发送方支付发起的费用,受益方支付接受的费用
#define QDP_FTDC_FPF_FPF_SHA '2'
typedef char TQdpFtdcFeePayFlagType;
/////////////////////////////////////////////////////////////////////////
///TFtdcPwdFlagType是一个密码标志类型
/////////////////////////////////////////////////////////////////////////
///不核对
#define QDP_FTDC_PF_BPWDF_NoCheck '0'
///明文核对
#define QDP_FTDC_PF_BPWDF_BlankCheck '1'
///密文核对
#define QDP_FTDC_PF_BPWDF_EncryptCheck '2'
typedef char TQdpFtdcPwdFlagType;
/////////////////////////////////////////////////////////////////////////
///TFtdcBankAccTypeType是一个银行账号类型类型
/////////////////////////////////////////////////////////////////////////
///存折
#define QDP_FTDC_BAT_VBAT_BankBook '1'
///储蓄卡
#define QDP_FTDC_BAT_VBAT_BankCard '2'
///信用卡
#define QDP_FTDC_BAT_VBAT_CreditCard '3'
typedef char TQdpFtdcBankAccTypeType;
/////////////////////////////////////////////////////////////////////////
///TFtdcYesNoIndicatorType是一个是否标志类型
/////////////////////////////////////////////////////////////////////////
///是
#define QDP_FTDC_YNI_YNI_Yes '0'
///否
#define QDP_FTDC_YNI_YNI_No '1'
typedef char TQdpFtdcYesNoIndicatorType;
/////////////////////////////////////////////////////////////////////////
///TFtdcAvailabilityFlagType是一个有效标志类型
/////////////////////////////////////////////////////////////////////////
///未确认
#define QDP_FTDC_ALF_AVAF_Invalid '0'
///有效
#define QDP_FTDC_ALF_AVAF_Valid '1'
///冲正
#define QDP_FTDC_ALF_AVAF_Repeal '2'
///失败
#define QDP_FTDC_ALF_AVAF_FAIL '3'
typedef char TQdpFtdcAvailabilityFlagType;
/////////////////////////////////////////////////////////////////////////
///TFtdcPayDirectionType是一个金交所递延支付方向类型
/////////////////////////////////////////////////////////////////////////
///多付空
#define QDP_FTDC_PD_Buy '0'
///空付多
#define QDP_FTDC_PD_Sell '1'
///支付方向未定
#define QDP_FTDC_PD_Unknown '2'
typedef char TQdpFtdcPayDirectionType;
#endif

View File

@ -1,79 +1,23 @@
# vn.ctp
# vn.qdp
### 简介
CTP柜台API接口的Python封装基于pyscript目录下的脚本自动分析头文件生成封装代码模块提供原生C++ API中的全部功能。
QDP柜台API接口的Python封装提供原生C++ API中的全部功能。
QDP特点
* 高性能柜台系统延时显著低于CTP
* 同时支持期货、期货期权、贵金属现货
* 上期所查询持仓返回的今昨仓合并为一条CTP分两条返回
### 目录说明
* vnctpmd: 行情API
* vnctptd: 交易API
* vnqdpmd: 行情API
* vnqdptd: 交易API
* pyscript: 自动封装脚本
* ctpapiC++ API文件
### 使用CMake编译
**Windows 7**
环境配置:
* Anaconda和Boost的安装方式请参考www.vnpy.org上的教程必须使用32位
* cmake:安装最新版本的cmake,用于配置编译环境
* 设置环境变量BOOST_ROOT = C:\boost_1_57_0
* 编译工具Visual Studio 2013
编译过程:
* 在vn.ctp目录下新建文件夹并命名为build, 保存编译的临时文件及库文件
* 打开命令行工具输入cmake-gui .. 则打开cmake配置界面
* 点击configure。
* 点击generate。如果没有错误则配置成功
* 进入build目录双击vn_ctp_api.sln打开解决方案
* 点击编译按钮,建议编译release库
**Linux (Debian jessie, Ubuntu 16.04)**
环境配置:
* 参考[这里](http://www.continuum.io/downloads)的教程下载并安装Anaconda的Linux 64位版本
* 使用apt-get安装编译相关的工具
- apt-get install build-essential
- apt-get install libboost-all-dev
- apt-get install python-dev
- apt-get install cmake
* 如果从官网下载新的ctp api tar包比如v6.3.5_20150803_tradeapi_linux64.tar需要重命名ctp api so文件名否则可以忽略该步骤
- thostmduserapi.so --> libthostmduserapi.so
- thosttraderapi.so --> libthosttraderapi.so
编译过程:
* 当前目录运行build.sh完成编译
* qdpapiC++ API文件
* docsQDP开发文档
### API版本
日期2015-08-04
日期2016-11-09
名称:fsopt_traderapi
名称QDPV1.0.1_trade_20161109_1
描述个股期权API
链接:[http://www.sfit.com.cn/5_2_DocumentDown.htm](http://www.sfit.com.cn/5_2_DocumentDown.htm)
说明ctpapi文件夹下的是Windows的32位版本其下文件夹x64_linux中的是Linux的64位版本
来源量投科技QDP群165187900

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<SubscriptionDataContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Authentication.CacheManagement">
<Items />
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAACQk+guh+ywWR7iJKHx4q/rl8GJs1w1kHOBDxLxLwyRwQAAAAAOgAAAAAIAACAAAABPgLw+AuxePq11TX16PdB1NyHEqJD1OGjxXDrk6zI58BAAAABDp/NWkif0PpHu24ZiWNDpQAAAAD6czV67awJHJ1Lad1N571p8XaKpngFM3+M/dUiuA7rb48Ig57TRmOwHTcx9xbSoJ+NTqxs+B47Ro2YPRnS43xc=</TokenCache>
</SubscriptionDataContainer>

View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vnqdpmd", "vnqdpmd\vnqdpmd.vcxproj", "{30DD4F96-08AD-42DB-ABB6-C3358871C142}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{30DD4F96-08AD-42DB-ABB6-C3358871C142}.Debug|Win32.ActiveCfg = Debug|Win32
{30DD4F96-08AD-42DB-ABB6-C3358871C142}.Debug|Win32.Build.0 = Debug|Win32
{30DD4F96-08AD-42DB-ABB6-C3358871C142}.Release|Win32.ActiveCfg = Release|Win32
{30DD4F96-08AD-42DB-ABB6-C3358871C142}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<SubscriptionDataContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Authentication.CacheManagement">
<Items />
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAABkvo2w3rMuhyfuwLijaHtSFPFzY7lTzt7knzYWNBpklAAAAAAOgAAAAAIAACAAAACCThm5IVeiW66dPH+91RfxdBg398zCL8la18ZuW4vssxAAAACuenGVqI7ZTM+3Zx87vC5sQAAAAD2+AjhbwIvI/KtSbsX4/PBEKzZ0ROhOswBfG+HCPjVcm9Z2fEditw9Jo3sr6e+qSZOeYIITilPWgS0zh3L6akU=</TokenCache>
</SubscriptionDataContainer>

File diff suppressed because it is too large Load Diff

View File

@ -30,17 +30,20 @@ using namespace boost;
#define ONFRONTCONNECTED 1
#define ONFRONTDISCONNECTED 2
#define ONHEARTBEATWARNING 3
#define ONRSPUSERLOGIN 4
#define ONRSPUSERLOGOUT 5
#define ONPACKAGESTART 4
#define ONPACKAGEEND 5
#define ONRSPERROR 6
#define ONRSPSUBMARKETDATA 7
#define ONRSPUNSUBMARKETDATA 8
#define ONRSPSUBFORQUOTERSP 9
#define ONRSPUNSUBFORQUOTERSP 10
#define ONRTNDEPTHMARKETDATA 11
#define ONRTNFORQUOTERSP 12
#define ONRSPUSERLOGIN 7
#define ONRSPUSERLOGOUT 8
#define ONRTNQMDINSTRUMENTSTATU 9
#define ONRSPSUBSCRIBETOPIC 10
#define ONRSPQRYTOPIC 11
#define ONRTNDEPTHMARKETDATA 12
#define ONRSPSUBMARKETDATA 13
#define ONRSPUNSUBMARKETDATA 14
#define ONRSPQRYDEPTHMARKETDATA 15
#define ONMULTIHEARTBEAT 16 //手动添加
#define UDPMARKETDATA 17 //手动添加
///-------------------------------------------------------------------------------------
///API中的部分组件
@ -76,6 +79,10 @@ struct Task
any task_error; //错误结构体
int task_id; //请求id
bool task_last; //是否为最后返回
int additional_int; //整数型补充数据
string additional_str1; //字符串型补充数据1
string additional_str2; //字符串型补充数据2
};
@ -185,30 +192,51 @@ public:
///@param nTimeLapse 距离上次接收报文的时间
virtual void OnHeartBeatWarning(int nTimeLapse);
///登录请求响应
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///报文回调开始通知。当API收到一个报文后首先调用本方法然后是各数据域的回调最后是报文回调结束通知。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageStart(int nTopicID, int nSequenceNo);
///登出请求响应
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///报文回调结束通知。当API收到一个报文后首先调用报文回调开始通知然后是各数据域的回调最后调用本方法。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageEnd(int nTopicID, int nSequenceNo);
//新增多播心跳接口 add by zbz 20150304
virtual void OnMultiHeartbeat(char *CurrTime, char *MultiCastIP) ;
//当广播收到值得时候回调函数被调用返回qmdata
virtual void UdpMarketData(CQdpFtdcDepthMarketDataField *qmdata);
///错误应答
virtual void OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
virtual void OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///订阅行情应答
virtual void OnRspSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///用户登录应答
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///取消订阅行情应答
virtual void OnRspUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///用户退出应答
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pRspUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///订阅询价应答
virtual void OnRspSubForQuoteRsp(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///郑州合约状态
virtual void OnRtnQmdInstrumentStatu(CQdpFtdcQmdInstrumentStateField *pQmdInstrumentState) ;
///取消订阅询价应答
virtual void OnRspUnSubForQuoteRsp(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///订阅主题应答
virtual void OnRspSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///主题查询应答
virtual void OnRspQryTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///深度行情通知
virtual void OnRtnDepthMarketData(CQdpFtdcDepthMarketDataField *pDepthMarketData);
virtual void OnRtnDepthMarketData(CQdpFtdcDepthMarketDataField *pDepthMarketData) ;
///订阅合约的相关信息
virtual void OnRspSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///退订合约的相关信息
virtual void OnRspUnSubMarketData(CQdpFtdcSpecificInstrumentField *pSpecificInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///行情查询应答
virtual void OnRspQryDepthMarketData(CQdpFtdcRspMarketDataField *pRspMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
//-------------------------------------------------------------------------------------
//task任务
@ -222,22 +250,33 @@ public:
void processHeartBeatWarning(Task task);
void processPackageStart(Task task);
void processPackageEnd(Task task);
void processMultiHeartbeat(Task task);
void processUdpMarketData(Task task);
void processRspError(Task task);
void processRspUserLogin(Task task);
void processRspUserLogout(Task task);
void processRspError(Task task);
void processRtnQmdInstrumentStatu(Task task);
void processRspSubscribeTopic(Task task);
void processRspQryTopic(Task task);
void processRtnDepthMarketData(Task task);
void processRspSubMarketData(Task task);
void processRspUnSubMarketData(Task task);
void processRspSubForQuoteRsp(Task task);
void processRspUnSubForQuoteRsp(Task task);
void processRtnDepthMarketData(Task task);
void processRspQryDepthMarketData(Task task);
//-------------------------------------------------------------------------------------
//data回调函数的数据字典
@ -253,23 +292,33 @@ public:
virtual void onHeartBeatWarning(int i){};
virtual void onPackageStart(int topicID, int sequenceNo) {};
virtual void onPackageEnd(int topicID, int sequenceNo) {};
virtual void onMultiHeartbeat(string currTime, string multiCastIP) {};
virtual void udpMarketData(dict data) {};
virtual void onRspError(dict error, int id, bool last) {};
virtual void onRspUserLogin(dict data, dict error, int id, bool last) {};
virtual void onRspUserLogout(dict data, dict error, int id, bool last) {};
virtual void onRspError(dict error, int id, bool last) {};
virtual void onRtnQmdInstrumentStatu(dict data) {};
virtual void onRspSubscribeTopic(dict data, dict error, int id, bool last) {};
virtual void onRspQryTopic(dict data, dict error, int id, bool last) {};
virtual void onRtnDepthMarketData(dict data) {};
virtual void onRspSubMarketData(dict data, dict error, int id, bool last) {};
virtual void onRspUnSubMarketData(dict data, dict error, int id, bool last) {};
virtual void onRspSubForQuoteRsp(dict data, dict error, int id, bool last) {};
virtual void onRspUnSubForQuoteRsp(dict data, dict error, int id, bool last) {};
virtual void onRtnDepthMarketData(dict data) {};
virtual void onRtnForQuoteRsp(dict data) {};
virtual void onRspQryDepthMarketData(dict data, dict error, int id, bool last) {};
//-------------------------------------------------------------------------------------
//req:主动函数的请求字典
@ -277,8 +326,14 @@ public:
void createFtdcMdApi(string pszFlowPath = "");
string getVersion(int major, int minor);
void release();
void setMultiCast(bool multicast);
void regTopicMultiAddr(string multiAddr);
void init();
int join();
@ -289,11 +344,33 @@ public:
void registerFront(string pszFrontAddress);
int subscribeMarketData(string instrumentID);
void registerNameServer(string pszNsAddress);
int unSubscribeMarketData(string instrumentID);
void subscribeMarketDataTopic(int topicID, int resumeType);
int subMarketData(string instrumentID);
int unSubMarketData(string instrumentID);
void setHeartbeatTimeout(int timeout);
void shmMarketData(dict req, dict defdata);
void setUdpChannel(string udpid);
int reqUserLogin(dict req, int nRequestID);
int reqUserLogout(dict req, int nRequestID);
int reqSubscribeTopic(dict req, int nRequestID);
int reqQryTopic(dict req, int nRequestID);
int reqSubMarketData(dict req, int nRequestID);
int reqUnSubMarketData(dict req, int nRequestID);
int reqQryDepthMarketData(dict req, int nRequestID);
void activateMultiMarketData(string tradingDay);
};

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{30DD4F96-08AD-42DB-ABB6-C3358871C142}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>vnqdpmd</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.pyd</TargetExt>
<IncludePath>X:\GithubProject\vnpy\vn.qdp\qdpapi;D:\boost_1_57_0;D:\Anaconda2\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\boost_1_57_0\libs;D:\Anaconda2\libs;X:\GithubProject\vnpy\vn.qdp\qdpapi;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;VNQDPMD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Create</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;VNQDPMD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>D:\boost_1_57_0\stage\lib;D:\Anaconda2\libs;X:\GithubProject\vnpy\vn.qdp\qdpapi;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcMdApi.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcTraderApi.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiDataType.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiStruct.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="vnqdpmd.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="vnqdpmd.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll" />
<None Include="..\..\..\qdpapi\qdptraderapi.dll" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib" />
<Library Include="..\..\..\qdpapi\qdptraderapi.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiStruct.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcMdApi.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcTraderApi.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiDataType.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="vnqdpmd.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vnqdpmd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll">
<Filter>Resource Files</Filter>
</None>
<None Include="..\..\..\qdpapi\qdptraderapi.dll">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib">
<Filter>Resource Files</Filter>
</Library>
<Library Include="..\..\..\qdpapi\qdptraderapi.lib">
<Filter>Resource Files</Filter>
</Library>
</ItemGroup>
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<SubscriptionDataContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.Authentication.CacheManagement">
<Items />
<TokenCache>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAyRIhRmRN8UK7w5RuPHePCQAAAAACAAAAAAAQZgAAAAEAACAAAAAAl4/w4VyqjUA3HilyerwjMwA8XWYuFqc0TymfwFacrgAAAAAOgAAAAAIAACAAAAA70M9sM2rW/I2svTmUIna/CghrIcaZufLj9Cra+3ylJRAAAABdxANXJfXRyoQazkSdgBYkQAAAAOmsd+eZrQTZXzPUzzcUIgIQDnT2hVaEGUrkkSKoTBipziykhRHEZOhlPWbHeZvg4aiJQcT7GeYyqyYKHBbl+aw=</TokenCache>
</SubscriptionDataContainer>

View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vnqdptd", "vnqdptd\vnqdptd.vcxproj", "{AA86CEC9-CAE8-439A-AD2C-02593E50E318}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AA86CEC9-CAE8-439A-AD2C-02593E50E318}.Debug|Win32.ActiveCfg = Debug|Win32
{AA86CEC9-CAE8-439A-AD2C-02593E50E318}.Debug|Win32.Build.0 = Debug|Win32
{AA86CEC9-CAE8-439A-AD2C-02593E50E318}.Release|Win32.ActiveCfg = Release|Win32
{AA86CEC9-CAE8-439A-AD2C-02593E50E318}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

View File

@ -36,118 +36,48 @@ using namespace boost;
#define ONFRONTCONNECTED 1
#define ONFRONTDISCONNECTED 2
#define ONHEARTBEATWARNING 3
#define ONRSPAUTHENTICATE 4
#define ONRSPUSERLOGIN 5
#define ONRSPUSERLOGOUT 6
#define ONRSPUSERPASSWORDUPDATE 7
#define ONRSPTRADINGACCOUNTPASSWORDUPDATE 8
#define ONRSPORDERINSERT 9
#define ONRSPPARKEDORDERINSERT 10
#define ONRSPPARKEDORDERACTION 11
#define ONRSPORDERACTION 12
#define ONRSPQUERYMAXORDERVOLUME 13
#define ONRSPSETTLEMENTINFOCONFIRM 14
#define ONRSPREMOVEPARKEDORDER 15
#define ONRSPREMOVEPARKEDORDERACTION 16
#define ONRSPEXECORDERINSERT 17
#define ONRSPEXECORDERACTION 18
#define ONRSPFORQUOTEINSERT 19
#define ONRSPQUOTEINSERT 20
#define ONRSPQUOTEACTION 21
#define ONRSPLOCKINSERT 22
#define ONRSPCOMBACTIONINSERT 23
#define ONRSPQRYORDER 24
#define ONRSPQRYTRADE 25
#define ONRSPQRYINVESTORPOSITION 26
#define ONRSPQRYTRADINGACCOUNT 27
#define ONRSPQRYINVESTOR 28
#define ONRSPQRYTRADINGCODE 29
#define ONRSPQRYINSTRUMENTMARGINRATE 30
#define ONRSPQRYINSTRUMENTCOMMISSIONRATE 31
#define ONRSPQRYEXCHANGE 32
#define ONRSPQRYPRODUCT 33
#define ONRSPQRYINSTRUMENT 34
#define ONRSPQRYDEPTHMARKETDATA 35
#define ONRSPQRYSETTLEMENTINFO 36
#define ONRSPQRYTRANSFERBANK 37
#define ONRSPQRYINVESTORPOSITIONDETAIL 38
#define ONRSPQRYNOTICE 39
#define ONRSPQRYSETTLEMENTINFOCONFIRM 40
#define ONRSPQRYINVESTORPOSITIONCOMBINEDETAIL 41
#define ONRSPQRYCFMMCTRADINGACCOUNTKEY 42
#define ONRSPQRYEWARRANTOFFSET 43
#define ONRSPQRYINVESTORPRODUCTGROUPMARGIN 44
#define ONRSPQRYEXCHANGEMARGINRATE 45
#define ONRSPQRYEXCHANGEMARGINRATEADJUST 46
#define ONRSPQRYEXCHANGERATE 47
#define ONRSPQRYSECAGENTACIDMAP 48
#define ONRSPQRYPRODUCTEXCHRATE 49
#define ONRSPQRYPRODUCTGROUP 50
#define ONRSPQRYOPTIONINSTRTRADECOST 51
#define ONRSPQRYOPTIONINSTRCOMMRATE 52
#define ONRSPQRYEXECORDER 53
#define ONRSPQRYFORQUOTE 54
#define ONRSPQRYQUOTE 55
#define ONRSPQRYLOCK 56
#define ONRSPQRYLOCKPOSITION 57
#define ONRSPQRYINVESTORLEVEL 58
#define ONRSPQRYEXECFREEZE 59
#define ONRSPQRYCOMBINSTRUMENTGUARD 60
#define ONRSPQRYCOMBACTION 61
#define ONRSPQRYTRANSFERSERIAL 62
#define ONRSPQRYACCOUNTREGISTER 63
#define ONRSPERROR 64
#define ONRTNORDER 65
#define ONRTNTRADE 66
#define ONERRRTNORDERINSERT 67
#define ONERRRTNORDERACTION 68
#define ONRTNINSTRUMENTSTATUS 69
#define ONRTNTRADINGNOTICE 70
#define ONRTNERRORCONDITIONALORDER 71
#define ONRTNEXECORDER 72
#define ONERRRTNEXECORDERINSERT 73
#define ONERRRTNEXECORDERACTION 74
#define ONERRRTNFORQUOTEINSERT 75
#define ONRTNQUOTE 76
#define ONERRRTNQUOTEINSERT 77
#define ONERRRTNQUOTEACTION 78
#define ONRTNFORQUOTERSP 79
#define ONRTNCFMMCTRADINGACCOUNTTOKEN 80
#define ONRTNLOCK 81
#define ONERRRTNLOCKINSERT 82
#define ONRTNCOMBACTION 83
#define ONERRRTNCOMBACTIONINSERT 84
#define ONRSPQRYCONTRACTBANK 85
#define ONRSPQRYPARKEDORDER 86
#define ONRSPQRYPARKEDORDERACTION 87
#define ONRSPQRYTRADINGNOTICE 88
#define ONRSPQRYBROKERTRADINGPARAMS 89
#define ONRSPQRYBROKERTRADINGALGOS 90
#define ONRSPQUERYCFMMCTRADINGACCOUNTTOKEN 91
#define ONRTNFROMBANKTOFUTUREBYBANK 92
#define ONRTNFROMFUTURETOBANKBYBANK 93
#define ONRTNREPEALFROMBANKTOFUTUREBYBANK 94
#define ONRTNREPEALFROMFUTURETOBANKBYBANK 95
#define ONRTNFROMBANKTOFUTUREBYFUTURE 96
#define ONRTNFROMFUTURETOBANKBYFUTURE 97
#define ONRTNREPEALFROMBANKTOFUTUREBYFUTUREMANUAL 98
#define ONRTNREPEALFROMFUTURETOBANKBYFUTUREMANUAL 99
#define ONRTNQUERYBANKBALANCEBYFUTURE 100
#define ONERRRTNBANKTOFUTUREBYFUTURE 101
#define ONERRRTNFUTURETOBANKBYFUTURE 102
#define ONERRRTNREPEALBANKTOFUTUREBYFUTUREMANUAL 103
#define ONERRRTNREPEALFUTURETOBANKBYFUTUREMANUAL 104
#define ONERRRTNQUERYBANKBALANCEBYFUTURE 105
#define ONRTNREPEALFROMBANKTOFUTUREBYFUTURE 106
#define ONRTNREPEALFROMFUTURETOBANKBYFUTURE 107
#define ONRSPFROMBANKTOFUTUREBYFUTURE 108
#define ONRSPFROMFUTURETOBANKBYFUTURE 109
#define ONRSPQUERYBANKACCOUNTMONEYBYFUTURE 110
#define ONRTNOPENACCOUNTBYBANK 111
#define ONRTNCANCELACCOUNTBYBANK 112
#define ONRTNCHANGEACCOUNTBYBANK 113
#define ONRSPQRYUSERINVESTOR 114
#define ONPACKAGESTART 4
#define ONPACKAGEEND 5
#define ONRSPERROR 6
#define ONRSPUSERLOGIN 7
#define ONRSPUSERLOGOUT 8
#define ONRSPUSERPASSWORDUPDATE 9
#define ONRSPORDERINSERT 10
#define ONRSPORDERACTION 11
#define ONRSPFROMBANKTOFUTUREBYFUTURE 12
#define ONRSPFROMFUTURETOBANKBYFUTURE 13
#define ONRTNFLOWMESSAGECANCEL 14
#define ONRTNTRADE 15
#define ONRTNORDER 16
#define ONERRRTNORDERINSERT 17
#define ONERRRTNORDERACTION 18
#define ONRTNINSTRUMENTSTATUS 19
#define ONRTNINVESTORACCOUNTDEPOSIT 20
#define ONRTNMESSAGENOTIFY 21
#define ONERRRTNQUERYBANKBALANCEBYFUTURE 22
#define ONERRRTNBANKTOFUTUREBYFUTURE 23
#define ONERRRTNFUTURETOBANKBYFUTURE 24
#define ONRTNQUERYBANKBALANCEBYFUTURE 25
#define ONRTNFROMBANKTOFUTUREBYFUTURE 26
#define ONRTNFROMFUTURETOBANKBYFUTURE 27
#define ONRTNSGEDEFERRATE 28
#define ONRSPQRYORDER 29
#define ONRSPQRYTRADE 30
#define ONRSPQRYUSERINVESTOR 31
#define ONRSPQRYINVESTORACCOUNT 32
#define ONRSPQRYINSTRUMENT 33
#define ONRSPQRYEXCHANGE 34
#define ONRSPQRYINVESTORPOSITION 35
#define ONRSPSUBSCRIBETOPIC 36
#define ONRSPQRYTOPIC 37
#define ONRSPQRYINVESTORFEE 38
#define ONRSPQRYINVESTORMARGIN 39
#define ONRSPQRYEXCHANGEDIFFTIME 40
#define ONRSPQRYCONTRACTBANK 41
#define ONRSPQUERYBANKACCOUNTMONEYBYFUTURE 42
#define ONRSPQRYTRANSFERSERIAL 43
#define ONRSPQRYSGEDEFERRATE 44
#define ONRSPQRYMARKETDATA 45
///-------------------------------------------------------------------------------------
@ -184,6 +114,8 @@ struct Task
any task_error; //错误结构体
int task_id; //请求id
bool task_last; //是否为最后返回
int additional_int; //整数型补充字段
};
@ -293,58 +225,50 @@ public:
///@param nTimeLapse 距离上次接收报文的时间
virtual void OnHeartBeatWarning(int nTimeLapse);
///登录请求响应
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///报文回调开始通知。当API收到一个报文后首先调用本方法然后是各数据域的回调最后是报文回调结束通知。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageStart(int nTopicID, int nSequenceNo);
///登出请求响应
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///报文回调结束通知。当API收到一个报文后首先调用报文回调开始通知然后是各数据域的回调最后调用本方法。
///@param nTopicID 主题代码(如私有流、公共流、行情流等)
///@param nSequenceNo 报文序号
virtual void OnPackageEnd(int nTopicID, int nSequenceNo);
///用户口令更新请求响应
virtual void OnRspUserPasswordUpdate(CQdpFtdcUserPasswordUpdateField *pUserPasswordUpdate, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///报单录入请求响应
virtual void OnRspOrderInsert(CQdpFtdcInputOrderField *pInputOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///报单操作请求响应
virtual void OnRspOrderAction(CQdpFtdcOrderActionField *pInputOrderAction, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///请求查询报单响应
virtual void OnRspQryOrder(CQdpFtdcOrderField *pOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///请求查询成交响应
virtual void OnRspQryTrade(CQdpFtdcTradeField *pTrade, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///请求查询投资者持仓响应
virtual void OnRspQryInvestorPosition(CQdpFtdcRspInvestorPositionField *pInvestorPosition, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///请求查询用户投资账户
virtual void OnRspQryUserInvestor(CQdpFtdcRspUserInvestorField *pUserInvestor, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///请求查询投资者响应
virtual void OnRspQryInvestorAccount(CQdpFtdcRspInvestorAccountField *pInvestor, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///请求查询交易所响应
virtual void OnRspQryExchange(CQdpFtdcRspExchangeField *pExchange, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///请求查询合约响应
virtual void OnRspQryInstrument(CQdpFtdcRspInstrumentField *pInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
///请求查询行情响应
virtual void OnRspQryMarketData(CQdpFtdcMarketDataField *pDepthMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///请求查询转帐流水响应
virtual void OnRspQryTransferSerial(CQdpFtdcTransferSerialField *pTransferSerial, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///错误应答
virtual void OnRspError(CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///报单通知
virtual void OnRtnOrder(CQdpFtdcOrderField *pOrder) ;
///用户登录应答
virtual void OnRspUserLogin(CQdpFtdcRspUserLoginField *pRspUserLogin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///成交通知
///用户退出应答
virtual void OnRspUserLogout(CQdpFtdcRspUserLogoutField *pRspUserLogout, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///用户密码修改应答
virtual void OnRspUserPasswordUpdate(CQdpFtdcUserPasswordUpdateField *pUserPasswordUpdate, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///报单录入应答
virtual void OnRspOrderInsert(CQdpFtdcInputOrderField *pInputOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///报单操作应答
virtual void OnRspOrderAction(CQdpFtdcOrderActionField *pOrderAction, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///期货发起银行资金转期货应答
virtual void OnRspFromBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///期货发起期货资金转银行应答
virtual void OnRspFromFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///数据流回退通知
virtual void OnRtnFlowMessageCancel(CQdpFtdcFlowMessageCancelField *pFlowMessageCancel) ;
///成交回报
virtual void OnRtnTrade(CQdpFtdcTradeField *pTrade) ;
///报单回报
virtual void OnRtnOrder(CQdpFtdcOrderField *pOrder) ;
///报单录入错误回报
virtual void OnErrRtnOrderInsert(CQdpFtdcInputOrderField *pInputOrder, CQdpFtdcRspInfoField *pRspInfo) ;
@ -354,23 +278,14 @@ public:
///合约交易状态通知
virtual void OnRtnInstrumentStatus(CQdpFtdcInstrumentStatusField *pInstrumentStatus) ;
///请求查询签约银行响应
virtual void OnRspQryContractBank(CQdpFtdcContractBankField *pContractBank, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///账户出入金回报
virtual void OnRtnInvestorAccountDeposit(CQdpFtdcInvestorAccountDepositResField *pInvestorAccountDepositRes) ;
///银行发起银行资金转期货通知
virtual void OnRtnFromBankToFutureByBank(CQdpFtdcRspTransferField *pRspTransfer) ;
///QDP警告消息通知
virtual void OnRtnMessageNotify(CQdpFtdcMessageNotifyInfoField *pMessageNotifyInfo) ;
///银行发起期货资金转银行通知
virtual void OnRtnFromFutureToBankByBank(CQdpFtdcRspTransferField *pRspTransfer) ;
///期货发起银行资金转期货通知
virtual void OnRtnFromBankToFutureByFuture(CQdpFtdcRspTransferField *pRspTransfer) ;
///期货发起期货资金转银行通知
virtual void OnRtnFromFutureToBankByFuture(CQdpFtdcRspTransferField *pRspTransfer) ;
///期货发起查询银行余额通知
virtual void OnRtnQueryBankBalanceByFuture(CQdpFtdcNotifyQueryAccountField *pNotifyQueryAccount) ;
///期货发起查询银行余额错误回报
virtual void OnErrRtnQueryBankBalanceByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, CQdpFtdcRspInfoField *pRspInfo) ;
///期货发起银行资金转期货错误回报
virtual void OnErrRtnBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo) ;
@ -378,18 +293,68 @@ public:
///期货发起期货资金转银行错误回报
virtual void OnErrRtnFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo) ;
///期货发起查询银行余额错误回报
virtual void OnErrRtnQueryBankBalanceByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, CQdpFtdcRspInfoField *pRspInfo) ;
///期货发起查询银行余额通知
virtual void OnRtnQueryBankBalanceByFuture(CQdpFtdcNotifyQueryAccountField *pNotifyQueryAccount) ;
///期货发起银行资金转期货应答
virtual void OnRspFromBankToFutureByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///期货发起银行资金转期货通知
virtual void OnRtnFromBankToFutureByFuture(CQdpFtdcRspTransferField *pRspTransfer) ;
///期货发起期货资金转银行应答
virtual void OnRspFromFutureToBankByFuture(CQdpFtdcReqTransferField *pReqTransfer, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///期货发起期货资金转银行通知
virtual void OnRtnFromFutureToBankByFuture(CQdpFtdcRspTransferField *pRspTransfer) ;
///金交所递延费率通知
virtual void OnRtnSGEDeferRate(CQdpFtdcSGEDeferRateField *pSGEDeferRate) ;
///报单查询应答
virtual void OnRspQryOrder(CQdpFtdcOrderField *pOrder, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///成交单查询应答
virtual void OnRspQryTrade(CQdpFtdcTradeField *pTrade, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///可用投资者账户查询应答
virtual void OnRspQryUserInvestor(CQdpFtdcRspUserInvestorField *pRspUserInvestor, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///投资者资金账户查询应答
virtual void OnRspQryInvestorAccount(CQdpFtdcRspInvestorAccountField *pRspInvestorAccount, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///合约查询应答
virtual void OnRspQryInstrument(CQdpFtdcRspInstrumentField *pRspInstrument, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///交易所查询应答
virtual void OnRspQryExchange(CQdpFtdcRspExchangeField *pRspExchange, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///投资者持仓查询应答
virtual void OnRspQryInvestorPosition(CQdpFtdcRspInvestorPositionField *pRspInvestorPosition, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///订阅主题应答
virtual void OnRspSubscribeTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///主题查询应答
virtual void OnRspQryTopic(CQdpFtdcDisseminationField *pDissemination, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///投资者手续费率查询应答
virtual void OnRspQryInvestorFee(CQdpFtdcInvestorFeeField *pInvestorFee, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///投资者保证金率查询应答
virtual void OnRspQryInvestorMargin(CQdpFtdcInvestorMarginField *pInvestorMargin, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///交易所时间偏差查询应答
virtual void OnRspQryExchangeDiffTime(CQdpFtdcRspExchangeDiffTimeField *pRspExchangeDiffTime, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///查询签约银行应答
virtual void OnRspQryContractBank(CQdpFtdcContractBankField *pContractBank, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///期货发起查询银行余额应答
virtual void OnRspQueryBankAccountMoneyByFuture(CQdpFtdcReqQueryAccountField *pReqQueryAccount, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///查询转账流水应答
virtual void OnRspQryTransferSerial(CQdpFtdcTransferSerialField *pTransferSerial, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///金交所递延费率查询应答
virtual void OnRspQrySGEDeferRate(CQdpFtdcSGEDeferRateField *pSGEDeferRate, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
///实时行情查询应答
virtual void OnRspQryMarketData(CQdpFtdcMarketDataField *pMarketData, CQdpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ;
//-------------------------------------------------------------------------------------
//task任务
@ -403,76 +368,90 @@ public:
void processHeartBeatWarning(Task task);
void processPackageStart(Task task);
void processPackageEnd(Task task);
void processRspError(Task task);
void processRspUserLogin(Task task);
void processRspUserLogout(Task task);
void processRspQryUserInvestor(Task task);
void processRspQryContractBank(Task task);
void processRspQryTransferSerial(Task task);
void processRtnFromBankToFutureByBank(Task task);
void processRtnFromFutureToBankByBank(Task task);
void processRspUserPasswordUpdate(Task task);
void processRspTradingAccountPasswordUpdate(Task task);
void processRspOrderInsert(Task task);
void processRspOrderAction(Task task);
void processRspQryOrder(Task task);
void processRspFromBankToFutureByFuture(Task task);
void processRspQryTrade(Task task);
void processRspFromFutureToBankByFuture(Task task);
void processRspQryInvestorPosition(Task task);
void processRspQryInvestorAccount(Task task);
void processRspQryExchange(Task task);
void processRspQryInstrument(Task task);
void processRspQryMarketData(Task task);
void processRspQryExecFreeze(Task task);
void processRspQryCombAction(Task task);
void processRspError(Task task);
void processRtnOrder(Task task);
void processRtnFlowMessageCancel(Task task);
void processRtnTrade(Task task);
void processRtnOrder(Task task);
void processErrRtnOrderInsert(Task task);
void processErrRtnOrderAction(Task task);
void processRtnInstrumentStatus(Task task);
void processRtnFromBankToFutureByFuture(Task task);
void processRtnInvestorAccountDeposit(Task task);
void processRtnFromFutureToBankByFuture(Task task);
void processRtnMessageNotify(Task task);
void processRtnQueryBankBalanceByFuture(Task task);
void processErrRtnQueryBankBalanceByFuture(Task task);
void processErrRtnBankToFutureByFuture(Task task);
void processErrRtnFutureToBankByFuture(Task task);
void processErrRtnQueryBankBalanceByFuture(Task task);
void processRtnQueryBankBalanceByFuture(Task task);
void processRspFromBankToFutureByFuture(Task task);
void processRtnFromBankToFutureByFuture(Task task);
void processRspFromFutureToBankByFuture(Task task);
void processRtnFromFutureToBankByFuture(Task task);
void processRtnSGEDeferRate(Task task);
void processRspQryOrder(Task task);
void processRspQryTrade(Task task);
void processRspQryUserInvestor(Task task);
void processRspQryInvestorAccount(Task task);
void processRspQryInstrument(Task task);
void processRspQryExchange(Task task);
void processRspQryInvestorPosition(Task task);
void processRspSubscribeTopic(Task task);
void processRspQryTopic(Task task);
void processRspQryInvestorFee(Task task);
void processRspQryInvestorMargin(Task task);
void processRspQryExchangeDiffTime(Task task);
void processRspQryContractBank(Task task);
void processRspQueryBankAccountMoneyByFuture(Task task);
void processRspQryTransferSerial(Task task);
void processRspQrySGEDeferRate(Task task);
void processRspQryMarketData(Task task);
//-------------------------------------------------------------------------------------
//data回调函数的数据字典
//error回调函数的错误字典
@ -487,7 +466,11 @@ public:
virtual void onHeartBeatWarning(int i){};
virtual void onRspAuthenticate(dict data, dict error, int id, bool last) {};
virtual void onPackageStart(int topicID, int sequenceNo){};
virtual void onPackageEnd(int topicID, int sequenceNo){};
virtual void onRspError(dict error, int id, bool last) {};
virtual void onRspUserLogin(dict data, dict error, int id, bool last) {};
@ -495,69 +478,77 @@ public:
virtual void onRspUserPasswordUpdate(dict data, dict error, int id, bool last) {};
virtual void onRspTradingAccountPasswordUpdate(dict data, dict error, int id, bool last) {};
virtual void onRspOrderInsert(dict data, dict error, int id, bool last) {};
virtual void onRspOrderAction(dict data, dict error, int id, bool last) {};
virtual void onRspQryUserInvestor(dict data, dict error, int id, bool last) {};
virtual void onRspFromBankToFutureByFuture(dict data, dict error, int id, bool last) {};
virtual void onRspQryOrder(dict data, dict error, int id, bool last) {};
virtual void onRspFromFutureToBankByFuture(dict data, dict error, int id, bool last) {};
virtual void onRspQryTrade(dict data, dict error, int id, bool last) {};
virtual void onRspQryTransferSerial(dict data, dict error, int id, bool last){};
virtual void onRspQryInvestorPosition(dict data, dict error, int id, bool last) {};
virtual void onRspQryInvestorAccount(dict data, dict error, int id, bool last) {};
virtual void onRspQryInvestor(dict data, dict error, int id, bool last) {};
virtual void onRspQryExchange(dict data, dict error, int id, bool last) {};
virtual void onRspQryInstrument(dict data, dict error, int id, bool last) {};
virtual void onRspQryMarketData(dict data, dict error, int id, bool last) {};
virtual void onRspError(dict error, int id, bool last) {};
virtual void onRtnOrder(dict data) {};
virtual void onRtnFlowMessageCancel(dict data) {};
virtual void onRtnTrade(dict data) {};
virtual void onRtnOrder(dict data) {};
virtual void onErrRtnOrderInsert(dict data, dict error) {};
virtual void onErrRtnOrderAction(dict data, dict error) {};
virtual void onRtnInstrumentStatus(dict data) {};
virtual void onRspQryContractBank(dict data, dict error, int id, bool last) {};
virtual void onRtnInvestorAccountDeposit(dict data) {};
virtual void onRtnFromBankToFutureByBank(dict data) {};
virtual void onRtnMessageNotify(dict data) {};
virtual void onRtnFromFutureToBankByBank(dict data) {};
virtual void onRtnFromBankToFutureByFuture(dict data) {};
virtual void onRtnFromFutureToBankByFuture(dict data) {};
virtual void onRtnQueryBankBalanceByFuture(dict data) {};
virtual void onErrRtnQueryBankBalanceByFuture(dict data, dict error) {};
virtual void onErrRtnBankToFutureByFuture(dict data, dict error) {};
virtual void onErrRtnFutureToBankByFuture(dict data, dict error) {};
virtual void onErrRtnQueryBankBalanceByFuture(dict data, dict error) {};
virtual void onRtnQueryBankBalanceByFuture(dict data) {};
virtual void onRspFromBankToFutureByFuture(dict data, dict error, int id, bool last) {};
virtual void onRtnFromBankToFutureByFuture(dict data) {};
virtual void onRspFromFutureToBankByFuture(dict data, dict error, int id, bool last) {};
virtual void onRtnFromFutureToBankByFuture(dict data) {};
virtual void onRtnSGEDeferRate(dict data) {};
virtual void onRspQryOrder(dict data, dict error, int id, bool last) {};
virtual void onRspQryTrade(dict data, dict error, int id, bool last) {};
virtual void onRspQryUserInvestor(dict data, dict error, int id, bool last) {};
virtual void onRspQryInvestorAccount(dict data, dict error, int id, bool last) {};
virtual void onRspQryInstrument(dict data, dict error, int id, bool last) {};
virtual void onRspQryExchange(dict data, dict error, int id, bool last) {};
virtual void onRspQryInvestorPosition(dict data, dict error, int id, bool last) {};
virtual void onRspSubscribeTopic(dict data, dict error, int id, bool last) {};
virtual void onRspQryTopic(dict data, dict error, int id, bool last) {};
virtual void onRspQryInvestorFee(dict data, dict error, int id, bool last) {};
virtual void onRspQryInvestorMargin(dict data, dict error, int id, bool last) {};
virtual void onRspQryExchangeDiffTime(dict data, dict error, int id, bool last) {};
virtual void onRspQryContractBank(dict data, dict error, int id, bool last) {};
virtual void onRspQueryBankAccountMoneyByFuture(dict data, dict error, int id, bool last) {};
virtual void onRspQryTransferSerial(dict data, dict error, int id, bool last) {};
virtual void onRspQrySGEDeferRate(dict data, dict error, int id, bool last) {};
virtual void onRspQryMarketData(dict data, dict error, int id, bool last) {};
//-------------------------------------------------------------------------------------
//req:主动函数的请求字典
@ -565,6 +556,8 @@ public:
void createFtdcTraderApi(string pszFlowPath = "");
string getVersion(int major, int minor);
void release();
void init();
@ -577,80 +570,64 @@ public:
void registerFront(string pszFrontAddress);
void registerNameServer(string pszNsAddress);
void subscribePrivateTopic(int nType);
void subscribePublicTopic(int nType);
int reqAuthenticate(dict req, int nRequestID);
void setHeartbeatTimeout(int timeout);
int openRequestLog(string fileName);
int openResponseLog(string fileName);
int reqUserLogin(dict req, int nRequestID);
int reqUserLogout(dict req, int nRequestID);
int reqQryUserInvestor(dict req, int nRequestID);
int reqUserPasswordUpdate(dict req, int nRequestID);
int reqTradingAccountPasswordUpdate(dict req, int nRequestID);
int reqOrderInsert(dict req, int nRequestID);
int reqParkedOrderInsert(dict req, int nRequestID);
int reqParkedOrderAction(dict req, int nRequestID);
int reqOrderAction(dict req, int nRequestID);
int reqExecOrderInsert(dict req, int nRequestID);
int reqExecOrderAction(dict req, int nRequestID);
int reqForQuoteInsert(dict req, int nRequestID);
int reqQuoteInsert(dict req, int nRequestID);
int reqQuoteAction(dict req, int nRequestID);
int reqLockInsert(dict req, int nRequestID);
int reqCombActionInsert(dict req, int nRequestID);
int reqQryOrder(dict req, int nRequestID);
int reqQryTrade(dict req, int nRequestID);
int reqQryInvestorPosition(dict req, int nRequestID);
int reqQryInvestorAccount(dict req, int nRequestID);
int reqQryTradingCode(dict req, int nRequestID);
int reqQryInstrumentMarginRate(dict req, int nRequestID);
int reqQryInstrumentCommissionRate(dict req, int nRequestID);
int reqQryExchange(dict req, int nRequestID);
int reqQryProduct(dict req, int nRequestID);
int reqQryInstrument(dict req, int nRequestID);
int reqQryMarketData(dict req, int nRequestID);
int reqQryInvestorLevel(dict req, int nRequestID);
int reqQryExecFreeze(dict req, int nRequestID);
int reqQryCombInstrumentGuard(dict req, int nRequestID);
int reqQryCombAction(dict req, int nRequestID);
int reqQryContractBank(dict req, int nRequestID);
int reqFromBankToFutureByFuture(dict req, int nRequestID);
int reqFromFutureToBankByFuture(dict req, int nRequestID);
int reqQryOrder(dict req, int nRequestID);
int reqQryTrade(dict req, int nRequestID);
int reqQryUserInvestor(dict req, int nRequestID);
int reqQryInvestorAccount(dict req, int nRequestID);
int reqQryInstrument(dict req, int nRequestID);
int reqQryExchange(dict req, int nRequestID);
int reqQryInvestorPosition(dict req, int nRequestID);
int reqSubscribeTopic(dict req, int nRequestID);
int reqQryTopic(dict req, int nRequestID);
int reqQryInvestorFee(dict req, int nRequestID);
int reqQryInvestorMargin(dict req, int nRequestID);
int reqQryExchangeDiffTime(dict req, int nRequestID);
int reqQryContractBank(dict req, int nRequestID);
int reqQueryBankAccountMoneyByFuture(dict req, int nRequestID);
int reqQryTransferSerial(dict req, int nRequestID);
int reqQrySGEDeferRate(dict req, int nRequestID);
int reqQryMarketData(dict req, int nRequestID);
};

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{AA86CEC9-CAE8-439A-AD2C-02593E50E318}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>vnqdptd</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.pyd</TargetExt>
<IncludePath>X:\GithubProject\vnpy\vn.qdp\qdpapi;D:\boost_1_57_0;D:\Anaconda2\include;$(IncludePath)</IncludePath>
<ReferencePath>D:\boost_1_57_0\libs;D:\Anaconda2\libs;X:\GithubProject\vnpy\vn.qdp\qdpapi;$(ReferencePath)</ReferencePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;VNQDPTD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;VNQDPTD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>D:\boost_1_57_0\stage\lib;D:\Anaconda2\libs;X:\GithubProject\vnpy\vn.qdp\qdpapi;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcMdApi.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcTraderApi.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiDataType.h" />
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiStruct.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="vnqdptd.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="vnqdptd.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll" />
<None Include="..\..\..\qdpapi\qdptraderapi.dll" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib" />
<Library Include="..\..\..\qdpapi\qdptraderapi.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="vnqdptd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcMdApi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcTraderApi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiDataType.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\qdpapi\QdpFtdcUserApiStruct.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vnqdptd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\qdpapi\qdpmdapi.dll">
<Filter>Resource Files</Filter>
</None>
<None Include="..\..\..\qdpapi\qdptraderapi.dll">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\qdpapi\qdpmdapi.lib">
<Filter>Resource Files</Filter>
</Library>
<Library Include="..\..\..\qdpapi\qdptraderapi.lib">
<Filter>Resource Files</Filter>
</Library>
</ItemGroup>
</Project>

View File

@ -1,5 +1,4 @@
{
"name": "国富模拟",
"brokerID": "guofu",
"tdAddress": "tcp://211.147.74.221:30005",
"password": "111111",

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -474,7 +474,6 @@ class ErrorMonitor(BasicMonitor):
d['errorTime'] = {'chinese':u'错误时间', 'cellType':BasicCell}
d['errorID'] = {'chinese':u'错误代码', 'cellType':BasicCell}
d['errorMsg'] = {'chinese':u'错误信息', 'cellType':BasicCell}
d['additionalInfo'] = {'chinese':u'补充信息', 'cellType':BasicCell}
d['gatewayName'] = {'chinese':u'接口', 'cellType':BasicCell}
self.setHeaderDict(d)

View File

@ -75,7 +75,10 @@ class MainWindow(QtGui.QMainWindow):
connectFemasAction.triggered.connect(self.connectFemas)
connectXspeedAction = QtGui.QAction(u'连接飞创', self)
connectXspeedAction.triggered.connect(self.connectXspeed)
connectXspeedAction.triggered.connect(self.connectXspeed)
connectQdpAction = QtGui.QAction(u'连接QDP', self)
connectQdpAction.triggered.connect(self.connectQdp)
connectKsgoldAction = QtGui.QAction(u'连接金仕达黄金', self)
connectKsgoldAction.triggered.connect(self.connectKsgold)
@ -138,6 +141,8 @@ class MainWindow(QtGui.QMainWindow):
sysMenu.addAction(connectFemasAction)
if 'XSPEED' in self.mainEngine.gatewayDict:
sysMenu.addAction(connectXspeedAction)
if 'QDP' in self.mainEngine.gatewayDict:
sysMenu.addAction(connectQdpAction)
if 'KSOTP' in self.mainEngine.gatewayDict:
sysMenu.addAction(connectKsotpAction)
if 'KSGOLD' in self.mainEngine.gatewayDict:
@ -228,8 +233,13 @@ class MainWindow(QtGui.QMainWindow):
#----------------------------------------------------------------------
def connectXspeed(self):
"""连接飞马接口"""
self.mainEngine.connect('XSPEED')
"""连接飞创接口"""
self.mainEngine.connect('XSPEED')
#----------------------------------------------------------------------
def connectQdp(self):
"""连接QDP接口"""
self.mainEngine.connect('QDP')
#----------------------------------------------------------------------
def connectKsgold(self):

View File

@ -88,6 +88,13 @@ class MainEngine(object):
self.gatewayDict['XSPEED'].setQryEnabled(True)
except Exception, e:
print e
try:
from qdpGateway.qdpGateway import QdpGateway
self.addGateway(QdpGateway, 'QDP')
self.gatewayDict['QDP'].setQryEnabled(True)
except Exception, e:
print e
try:
from ksgoldGateway.ksgoldGateway import KsgoldGateway