Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ environment:
CMD_IN_ENV: 'cmd /E:ON /V:ON /C .\extra\appveyor\compiler.cmd'
matrix:

- PYTHON_DIR: "C:\\Python39-x64"
PYTHON: "C:\\Python39-x64\\python"
PYTHON_VERSION: "3.9"
PYTHON_ARCH: "64"

- PYTHON_DIR: "C:\\Python310-x64"
PYTHON: "C:\\Python310-x64\\python"
PYTHON_VERSION: "3.10"
Expand All @@ -61,12 +56,17 @@ environment:
PYTHON_VERSION: "3.13"
PYTHON_ARCH: "64"

- PYTHON_DIR: "C:\\Python314-x64"
PYTHON: "C:\\Python314-x64\\python"
PYTHON_VERSION: "3.14"
PYTHON_ARCH: "64"

- PYTHON_DIR: "C:\\pypy3"
PYTHON: "C:\\pypy3\\pypy"
PYTHON_ARCH: "64"
PYTHON_PYPY: "pypy3"
PYTHON_VERSION: "3.10"
PYTHON_PYPY_VERSION: "7.3.19"
PYTHON_VERSION: "3.11"
PYTHON_PYPY_VERSION: "7.3.23"


matrix:
Expand All @@ -85,7 +85,7 @@ skip_commits:

install:
# https://downloads.python.org/pypy/pypy3.10-v7.3.19-win64.zip
- ps: If(($env:PYTHON).Contains("pypy3")) { (New-Object Net.WebClient).DownloadFile('https://downloads.python.org/pypy/pypy3.10-v7.3.19-win64.zip', "$env:appveyor_build_folder\pypy3.zip"); 7z x pypy3.zip | Out-Null; move pypy3.10-v7.3.19-win64 C:\pypy3; }
- ps: If(($env:PYTHON).Contains("pypy3")) { (New-Object Net.WebClient).DownloadFile('https://downloads.python.org/pypy/pypy3.11-v7.3.23-win64.zip', "$env:appveyor_build_folder\pypy3.zip"); 7z x pypy3.zip | Out-Null; move pypy3.11-v7.3.23-win64 C:\pypy3; }

- "SET PATH=%PYTHON_DIR%;%PYTHON_DIR%\\bin;%PYTHON_DIR%\\Scripts;%PATH%"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12","3.13", "pypy3.10", "pypy3.11" ]
python-version: [ "3.10", "3.11", "3.12","3.13", "3.14", "pypy3.10", "pypy3.11" ]
steps:
- name: checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

- name: Set up Python 3.12
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: 3.12
python-version: 3.13

- name: Install dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
[![implementation](https://img.shields.io/pypi/implementation/ctpwrapper.svg)](https://pypi.python.org/pypi/ctpwrapper)
[![Downloads](https://pepy.tech/badge/ctpwrapper)](https://pepy.tech/project/ctpwrapper)

[CTP Website](http://www.sfit.com.cn/5_2_DocumentDown_1.htm)
[CTP Website](https://www.simnow.com.cn/static/apiDownload.action)

Version: v6.7.9
Version: v6.7.13

Platform: Linux 64bit, Windows 64bit

Expand Down
5 changes: 2 additions & 3 deletions ctp/header/DataCollect.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#endif



///获取AES加密和RSA加密的终端信息 pSystemInfo的空间需要调用者自己分配 至少270个字节
/// windows返回值定义
/* 返回的int值 不为0 表示采集信息有误 具体哪个采集项有问题需要做如下判断
Expand Down Expand Up @@ -45,13 +44,13 @@
返回值 & (0x01 << 8) 不为0 表示 BIOS 获取失败
*/

DATA_COLLECT_API_EXPORT int CTP_GetSystemInfo(char* pSystemInfo, int& nLen);
DATA_COLLECT_API_EXPORT int CTP_GetSystemInfo(char *pSystemInfo, int &nLen);


//版本号格式
//Sfit + 生产还是测试秘钥(pro/tst) + 秘钥版本 + 编译时间 + 版本(内部)

DATA_COLLECT_API_EXPORT const char * CTP_GetDataCollectApiVersion(void);
DATA_COLLECT_API_EXPORT const char *CTP_GetDataCollectApiVersion(void);


#endif
6 changes: 4 additions & 2 deletions ctp/header/ThostFtdcMdApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define MD_API_EXPORT __declspec(dllimport)
#endif
#else
#define MD_API_EXPORT
#define MD_API_EXPORT
#endif

class CThostFtdcMdSpi {
Expand Down Expand Up @@ -80,9 +80,10 @@ class MD_API_EXPORT CThostFtdcMdApi {
public:
///创建MdApi
///@param pszFlowPath 存贮订阅信息文件的目录,默认为当前目录
///@param bIsProductionMode true:使用生产版本的API false:使用测评版本API
///@return 创建出的UserApi
///modify for udp marketdata
static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp = false, const bool bIsMulticast = false);
static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp = false, const bool bIsMulticast = false, bool bIsProductionMode = true);

///获取API的版本信息
///@retrun 获取到的版本号
Expand Down Expand Up @@ -153,6 +154,7 @@ class MD_API_EXPORT CThostFtdcMdApi {
///用户登录请求
virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;


///登出请求
virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0;

Expand Down
84 changes: 81 additions & 3 deletions ctp/header/ThostFtdcTraderApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define TRADER_API_EXPORT __declspec(dllimport)
#endif
#else
#define TRADER_API_EXPORT
#define TRADER_API_EXPORT
#endif

class CThostFtdcTraderSpi {
Expand All @@ -47,6 +47,9 @@ class CThostFtdcTraderSpi {
///客户端认证响应
virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///该方法在处理私有流之前被调用
///@param nSeqNo 即将被处理的私有流的序号
virtual void OnRtnPrivateSeqNo(int nSeqNo) {};

///登录请求响应
virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
Expand Down Expand Up @@ -144,6 +147,9 @@ class CThostFtdcTraderSpi {
///请求查询合约手续费率响应
virtual void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField *pInstrumentCommissionRate, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///请求查询用户会话响应
virtual void OnRspQryUserSession(CThostFtdcUserSessionField *pUserSession, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///请求查询交易所响应
virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

Expand Down Expand Up @@ -524,14 +530,54 @@ class CThostFtdcTraderSpi {

///投资者对冲设置查询响应
virtual void OnRspQryOffsetSetting(CThostFtdcOffsetSettingField *pOffsetSetting, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///申请短信验证码响应
virtual void OnRspGenSMSCode(CThostFtdcRspGenSMSCodeField *pRspGenSMSCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///套利确认回复
virtual void OnRspSpdApply(CThostFtdcInputSpdApplyField *pInputSpdApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///套利确认撤销回复
virtual void OnRspSpdApplyAction(CThostFtdcInputSpdApplyActionField *pInputSpdApplyAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///套利确认查询回复
virtual void OnRspQrySpdApply(CThostFtdcSpdApplyField *pSpdApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///套利确认通知
virtual void OnRtnSpdApply(CThostFtdcSpdApplyField *pSpdApply) {};

///套利申请录入错误回报
virtual void OnErrRtnSpdApply(CThostFtdcInputSpdApplyField *pInputSpdApply, CThostFtdcRspInfoField *pRspInfo) {};

///套利确认撤销通知
virtual void OnErrRtnSpdApplyAction(CThostFtdcSpdApplyActionField *pSpdApplyAction, CThostFtdcRspInfoField *pRspInfo) {};

///套保确认回复
virtual void OnRspHedgeCfm(CThostFtdcInputHedgeCfmField *pInputHedgeCfm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///套保确认撤销回复
virtual void OnRspHedgeCfmAction(CThostFtdcInputHedgeCfmActionField *pInputHedgeCfmAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///套保确认查询回复
virtual void OnRspQryHedgeCfm(CThostFtdcHedgeCfmField *pHedgeCfm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///套保确认通知
virtual void OnRtnHedgeCfm(CThostFtdcHedgeCfmField *pHedgeCfm) {};

///套保额度录入错误回报
virtual void OnErrRtnHedgeCfm(CThostFtdcInputHedgeCfmField *pInputHedgeCfm, CThostFtdcRspInfoField *pRspInfo) {};

///套保确认撤销通知
virtual void OnErrRtnHedgeCfmAction(CThostFtdcHedgeCfmActionField *pHedgeCfmAction, CThostFtdcRspInfoField *pRspInfo) {};
};

class TRADER_API_EXPORT CThostFtdcTraderApi {
public:
///创建TraderApi
///@param pszFlowPath 存贮订阅信息文件的目录,默认为当前目录
///@param bIsProductionMode true:使用生产版本的API false:使用测评版本的API
///@return 创建出的UserApi
static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = "");
static CThostFtdcTraderApi *CreateFtdcTraderApi(const char *pszFlowPath = "", bool bIsProductionMode = true);

///获取API的版本信息
///@retrun 获取到的版本号
Expand Down Expand Up @@ -586,8 +632,10 @@ class TRADER_API_EXPORT CThostFtdcTraderApi {
/// THOST_TERT_RESTART:从本交易日开始重传
/// THOST_TERT_RESUME:从上次收到的续传
/// THOST_TERT_QUICK:只传送登录后私有流的内容
/// THOST_TERT_RESUME_FROM_SEQ_NO:从指定序号开始重传,序号从1开始
///@param nSeqNo 私有流序号,只在THOST_TERT_RESUME_FROM_SEQ_NO模式下有效
///@remark 该方法要在Init方法前调用。若不调用则不会收到私有流的数据。
virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType) = 0;
virtual void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType, int nSeqNo = 1) = 0;

///订阅公共流。
///@param nResumeType 公共流重传方式
Expand All @@ -609,6 +657,12 @@ class TRADER_API_EXPORT CThostFtdcTraderApi {
///操作员登录后,可以多次调用该接口上报客户信息
virtual int SubmitUserSystemInfo(CThostFtdcUserSystemInfoField *pUserSystemInfo) = 0;

///注册用户终端信息,用于中继服务器多连接模式.用于微信小程序等应用上报信息.
virtual int RegisterWechatUserSystemInfo(CThostFtdcWechatUserSystemInfoField *pUserSystemInfo) = 0;

///上报用户终端信息,用于中继服务器操作员登录模式.用于微信小程序等应用上报信息.
virtual int SubmitWechatUserSystemInfo(CThostFtdcWechatUserSystemInfoField *pUserSystemInfo) = 0;

///用户登录请求
virtual int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;

Expand Down Expand Up @@ -714,6 +768,9 @@ class TRADER_API_EXPORT CThostFtdcTraderApi {
///请求查询合约手续费率
virtual int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID) = 0;

///请求查询用户会话
virtual int ReqQryUserSession(CThostFtdcQryUserSessionField *pQryUserSession, int nRequestID) = 0;

///请求查询交易所
virtual int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID) = 0;

Expand Down Expand Up @@ -957,6 +1014,27 @@ class TRADER_API_EXPORT CThostFtdcTraderApi {
///投资者对冲设置查询
virtual int ReqQryOffsetSetting(CThostFtdcQryOffsetSettingField *pQryOffsetSetting, int nRequestID) = 0;

///申请短信验证码请求
virtual int ReqGenSMSCode(CThostFtdcReqGenSMSCodeField *pReqGenSMSCode, int nRequestID) = 0;

///套利确认请求
virtual int ReqSpdApply(CThostFtdcInputSpdApplyField *pInputSpdApply, int nRequestID) = 0;

///套利确认撤销请求
virtual int ReqSpdApplyAction(CThostFtdcInputSpdApplyActionField *pInputSpdApplyAction, int nRequestID) = 0;

///套利确认查询请求
virtual int ReqQrySpdApply(CThostFtdcQrySpdApplyField *pQrySpdApply, int nRequestID) = 0;

///套保确认请求
virtual int ReqHedgeCfm(CThostFtdcInputHedgeCfmField *pInputHedgeCfm, int nRequestID) = 0;

///套保确认撤销请求
virtual int ReqHedgeCfmAction(CThostFtdcInputHedgeCfmActionField *pInputHedgeCfmAction, int nRequestID) = 0;

///套保确认查询请求
virtual int ReqQryHedgeCfm(CThostFtdcQryHedgeCfmField *pQryHedgeCfm, int nRequestID) = 0;

protected:
~CThostFtdcTraderApi() {};
};
Expand Down
Loading