diff --git a/.appveyor.yml b/.appveyor.yml
index 580c9b9..59f2540 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -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"
@@ -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:
@@ -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%"
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index c7858dd..57e7876 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -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 }}
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
index b0d4c6f..ddc4b5e 100644
--- a/.github/workflows/deploy.yaml
+++ b/.github/workflows/deploy.yaml
@@ -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: |
diff --git a/README.md b/README.md
index 9fd588c..48a2a36 100644
--- a/README.md
+++ b/README.md
@@ -9,9 +9,9 @@
[](https://pypi.python.org/pypi/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
diff --git a/ctp/header/DataCollect.h b/ctp/header/DataCollect.h
index 1daa650..16e234e 100644
--- a/ctp/header/DataCollect.h
+++ b/ctp/header/DataCollect.h
@@ -14,7 +14,6 @@
#endif
-
///获取AES加密和RSA加密的终端信息 pSystemInfo的空间需要调用者自己分配 至少270个字节
/// windows返回值定义
/* 返回的int值 不为0 表示采集信息有误 具体哪个采集项有问题需要做如下判断
@@ -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
diff --git a/ctp/header/ThostFtdcMdApi.h b/ctp/header/ThostFtdcMdApi.h
index 42da36d..287ea24 100644
--- a/ctp/header/ThostFtdcMdApi.h
+++ b/ctp/header/ThostFtdcMdApi.h
@@ -23,7 +23,7 @@
#define MD_API_EXPORT __declspec(dllimport)
#endif
#else
-#define MD_API_EXPORT
+#define MD_API_EXPORT
#endif
class CThostFtdcMdSpi {
@@ -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 获取到的版本号
@@ -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;
diff --git a/ctp/header/ThostFtdcTraderApi.h b/ctp/header/ThostFtdcTraderApi.h
index 2ac0ab4..3b808f4 100644
--- a/ctp/header/ThostFtdcTraderApi.h
+++ b/ctp/header/ThostFtdcTraderApi.h
@@ -23,7 +23,7 @@
#define TRADER_API_EXPORT __declspec(dllimport)
#endif
#else
-#define TRADER_API_EXPORT
+#define TRADER_API_EXPORT
#endif
class CThostFtdcTraderSpi {
@@ -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) {};
@@ -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) {};
@@ -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 获取到的版本号
@@ -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 公共流重传方式
@@ -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;
@@ -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;
@@ -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() {};
};
diff --git a/ctp/header/ThostFtdcUserApiDataType.h b/ctp/header/ThostFtdcUserApiDataType.h
index f32fa53..a11c9e3 100644
--- a/ctp/header/ThostFtdcUserApiDataType.h
+++ b/ctp/header/ThostFtdcUserApiDataType.h
@@ -14,7 +14,8 @@ enum THOST_TE_RESUME_TYPE {
THOST_TERT_RESTART = 0,
THOST_TERT_RESUME,
THOST_TERT_QUICK,
- THOST_TERT_NONE
+ THOST_TERT_NONE,
+ THOST_TERT_RESUME_FROM_SEQ_NO
};
/////////////////////////////////////////////////////////////////////////
@@ -127,6 +128,11 @@ typedef char TThostFtdcExchangeFlagType[2];
/////////////////////////////////////////////////////////////////////////
typedef char TThostFtdcMacAddressType[21];
+/////////////////////////////////////////////////////////////////////////
+///TFtdcDeviceTagType是一个客户端机器标识,可填MAC或UUID类型
+/////////////////////////////////////////////////////////////////////////
+typedef char TThostFtdcDeviceTagType[41];
+
/////////////////////////////////////////////////////////////////////////
///TFtdcSystemIDType是一个系统编号类型
/////////////////////////////////////////////////////////////////////////
@@ -546,6 +552,8 @@ typedef char TThostFtdcFunctionCodeType;
#define THOST_FTDC_BFC_FBSign 'W'
///银期签约解约
#define THOST_FTDC_BFC_FBAccount 'X'
+///接收短信验证码
+#define THOST_FTDC_BFC_RcvSMSCode 'Y'
typedef char TThostFtdcBrokerFunctionCodeType;
@@ -1556,6 +1564,12 @@ typedef char TThostFtdcSystemParamIDType;
#define THOST_FTDC_TPID_TradeChkPhase 'j'
///其他异常报单校验参数(价格和手数)
#define THOST_FTDC_TPID_TradeChkPriceVol 'k'
+///卖出垂直价差组合新算法
+#define THOST_FTDC_TPID_NewBESMarginAlgo 'l'
+///大商所期货组合平仓冻结算法
+#define THOST_FTDC_TPID_IsDceFutCloseFrozen 'm'
+///是否启用短信验证
+#define THOST_FTDC_TPID_UseSMSVerify 'n'
typedef char TThostFtdcTradeParamIDType;
@@ -6924,7 +6938,7 @@ typedef double TThostFtdcDeltaType;
typedef int TThostFtdcSpreadIdType;
/////////////////////////////////////////////////////////////////////////
-///TFtdcPortfolioType是一个新型组保算法类型
+///TFtdcPortfolioType是一个组保算法类型
/////////////////////////////////////////////////////////////////////////
///不使用新型组保算法
#define THOST_FTDC_EPF_None '0'
@@ -7176,4 +7190,74 @@ typedef char TThostFtdcSiteType[51];
/////////////////////////////////////////////////////////////////////////
typedef char TThostFtdcNetOperatorType[9];
+/////////////////////////////////////////////////////////////////////////
+///TFtdcApplySrcType是一个申请来源类型
+/////////////////////////////////////////////////////////////////////////
+///交易
+#define THOST_FTDC_AS_Trade '0'
+///会服
+#define THOST_FTDC_AS_Member '1'
+
+typedef char TThostFtdcApplySrcType;
+
+/////////////////////////////////////////////////////////////////////////
+///TFtdcReserveInfoType是一个预留信息类型
+/////////////////////////////////////////////////////////////////////////
+typedef char TThostFtdcReserveInfoType[65];
+
+/////////////////////////////////////////////////////////////////////////
+///TFtdcApplyStatusType是一个套利套保申请状态类型
+/////////////////////////////////////////////////////////////////////////
+///未知
+#define THOST_FTDC_AS2_Unknown 'a'
+///已撤销
+#define THOST_FTDC_AS2_Canceled '0'
+///已挂起
+#define THOST_FTDC_AS2_Suspended '1'
+///申请成功
+#define THOST_FTDC_AS2_Accepted '3'
+
+typedef char TThostFtdcApplyStatusType;
+
+/////////////////////////////////////////////////////////////////////////
+///TFtdcCmbTypeType是一个组合定单类型,0类型
+/////////////////////////////////////////////////////////////////////////
+///SPZ
+#define THOST_FTDC_ZCECT_SPZ '0'
+///SPD
+#define THOST_FTDC_ZCECT_SPD '1'
+///IPS
+#define THOST_FTDC_ZCECT_IPS '2'
+///BUL
+#define THOST_FTDC_ZCECT_BUL '3'
+///BER
+#define THOST_FTDC_ZCECT_BER '4'
+///BLT
+#define THOST_FTDC_ZCECT_BLT '5'
+///BRT
+#define THOST_FTDC_ZCECT_BRT '6'
+///STD
+#define THOST_FTDC_ZCECT_STD '7'
+///STG
+#define THOST_FTDC_ZCECT_STG '8'
+///PRT
+#define THOST_FTDC_ZCECT_PRT '9'
+
+typedef char TThostFtdcCmbTypeType;
+
+/////////////////////////////////////////////////////////////////////////
+///TFtdcSMSCodeType是一个短信验证码类型
+/////////////////////////////////////////////////////////////////////////
+typedef char TThostFtdcSMSCodeType[17];
+
+/////////////////////////////////////////////////////////////////////////
+///TFtdcSMSContentType是一个短信内容类型
+/////////////////////////////////////////////////////////////////////////
+typedef char TThostFtdcSMSContentType[129];
+
+/////////////////////////////////////////////////////////////////////////
+///TFtdcSMSPhoneType是一个手机号类型
+/////////////////////////////////////////////////////////////////////////
+typedef char TThostFtdcSMSPhoneType[17];
+
#endif
diff --git a/ctp/header/ThostFtdcUserApiStruct.h b/ctp/header/ThostFtdcUserApiStruct.h
index 0089692..8878723 100644
--- a/ctp/header/ThostFtdcUserApiStruct.h
+++ b/ctp/header/ThostFtdcUserApiStruct.h
@@ -53,6 +53,8 @@ struct CThostFtdcReqUserLoginField {
TThostFtdcIPPortType ClientIPPort;
///终端IP地址
TThostFtdcIPAddressType ClientIPAddress;
+ ///短信验证码
+ TThostFtdcSMSCodeType SMSCode;
};
///用户登录应答
@@ -91,6 +93,10 @@ struct CThostFtdcRspUserLoginField {
TThostFtdcDRIdentityIDType LoginDRIdentityID;
///用户所属中心号
TThostFtdcDRIdentityIDType UserDRIdentityID;
+ ///上次登陆时间
+ TThostFtdcDateTimeType LastLoginTime;
+ ///预留信息
+ TThostFtdcReserveInfoType ReserveInfo;
};
///用户登出请求
@@ -723,6 +729,8 @@ struct CThostFtdcTradingAccountField {
TThostFtdcMoneyType FrozenSwap;
///剩余换汇额度
TThostFtdcMoneyType RemainSwap;
+ ///期权市值
+ TThostFtdcMoneyType OptionValue;
};
///投资者持仓
@@ -827,6 +835,8 @@ struct CThostFtdcInvestorPositionField {
TThostFtdcMoneyType TasPositionCost;
///合约代码
TThostFtdcInstrumentIDType InstrumentID;
+ ///期权市值
+ TThostFtdcMoneyType OptionValue;
};
///合约保证金率
@@ -2233,6 +2243,8 @@ struct CThostFtdcSyncingTradingAccountField {
TThostFtdcMoneyType FrozenSwap;
///剩余换汇额度
TThostFtdcMoneyType RemainSwap;
+ ///期权市值
+ TThostFtdcMoneyType OptionValue;
};
///正在同步中的投资者持仓
@@ -5939,6 +5951,8 @@ struct CThostFtdcContractBankField {
TThostFtdcBankBrchIDType BankBrchID;
///银行名称
TThostFtdcBankNameType BankName;
+ ///上报csrc的银行代码
+ TThostFtdcBankIDType csrcBankID;
};
///投资者组合持仓明细
@@ -9723,6 +9737,8 @@ struct CThostFtdcUserSystemInfoField {
TThostFtdcIPAddressType ClientPublicIP;
///客户登录备注2
TThostFtdcClientLoginRemarkType ClientLoginRemark;
+ ///客户终端的MAC等标识
+ TThostFtdcDeviceTagType MAC;
};
///终端用户绑定信息
@@ -9811,6 +9827,8 @@ struct CThostFtdcReqUserLoginSMField {
TThostFtdcIPPortType ClientIPPort;
///终端IP地址
TThostFtdcIPAddressType ClientIPAddress;
+ ///短信验证码
+ TThostFtdcSMSCodeType SMSCode;
///经纪公司名称
TThostFtdcBrokerNameType BrokerName;
///认证码
@@ -10181,6 +10199,8 @@ struct CThostFtdcSyncDeltaTradingAccountField {
TThostFtdcMoneyType FrozenSwap;
///剩余换汇额度
TThostFtdcMoneyType RemainSwap;
+ ///期权市值
+ TThostFtdcMoneyType OptionValue;
///追平序号
TThostFtdcSequenceNoType SyncDeltaSequenceNo;
};
@@ -10237,7 +10257,7 @@ struct CThostFtdcSyncDeltaDceCombInstrumentField {
TThostFtdcDirectionType Direction;
///产品代码
TThostFtdcInstrumentIDType ProductID;
- ///期权组合保证金比例
+ ///期货/期权组合保证金比例
TThostFtdcDiscountRatioType Xparameter;
///操作标志
TThostFtdcActionDirectionType ActionDirection;
@@ -10855,7 +10875,7 @@ struct CThostFtdcPortfTradeParamSettingField {
TThostFtdcBrokerIDType BrokerID;
///投资者代码
TThostFtdcInvestorIDType InvestorID;
- ///新型组保算法
+ ///组保算法
TThostFtdcPortfolioType Portfolio;
///撤单是否验资
TThostFtdcBoolType IsActionVerify;
@@ -12003,6 +12023,8 @@ struct CThostFtdcIpAddrParamField {
TThostFtdcSiteType Site;
///网络运营商
TThostFtdcNetOperatorType NetOperator;
+ ///系统名称
+ TThostFtdcAddrNameType SysName;
};
///服务地址参数查询
@@ -12041,6 +12063,8 @@ struct CThostFtdcTGIpAddrParamField {
TThostFtdcSiteType Site;
///网络运营商
TThostFtdcNetOperatorType NetOperator;
+ ///系统名称
+ TThostFtdcAddrNameType SysName;
};
///服务地址参数查询
@@ -12787,6 +12811,8 @@ struct CThostFtdcOffsetSettingField {
TThostFtdcUserIDType ActiveUserID;
///经纪公司报单编号
TThostFtdcSequenceNoType BrokerOffsetSettingSeq;
+ ///申请来源
+ TThostFtdcApplySrcType ApplySrc;
};
///撤销对冲设置
@@ -12873,6 +12899,522 @@ struct CThostFtdcQryAddrAppIDRelationField {
TThostFtdcBrokerIDType BrokerID;
};
+///微信小程序等用户系统信息
+struct CThostFtdcWechatUserSystemInfoField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///微信小程序等用户端系统内部信息长度
+ TThostFtdcSystemInfoLenType WechatCltSysInfoLen;
+ ///微信小程序等用户端系统内部信息
+ TThostFtdcClientSystemInfoType WechatCltSysInfo;
+ ///终端IP端口
+ TThostFtdcIPPortType ClientIPPort;
+ ///登录成功时间
+ TThostFtdcTimeType ClientLoginTime;
+ ///App代码
+ TThostFtdcAppIDType ClientAppID;
+ ///用户公网IP
+ TThostFtdcIPAddressType ClientPublicIP;
+ ///客户登录备注2
+ TThostFtdcClientLoginRemarkType ClientLoginRemark;
+};
+
+///投资者预留信息
+struct CThostFtdcInvestorReserveInfoField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///预留信息
+ TThostFtdcReserveInfoType ReserveInfo;
+};
+
+///查询组织架构投资者对应关系
+struct CThostFtdcQryInvestorDepartmentFlatField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+};
+
+///组织架构投资者对应关系
+struct CThostFtdcInvestorDepartmentFlatField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///组织架构代码
+ TThostFtdcInvestorIDType DepartmentID;
+};
+
+///查询操作员组织架构关系
+struct CThostFtdcQryDepartmentUserField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+};
+
+///App客户端认证码
+struct CThostFtdcAppAuthenticationCodeField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///App代码
+ TThostFtdcAppIDType AppID;
+ ///认证码
+ TThostFtdcAuthCodeType AuthCode;
+ ///旧认证码
+ TThostFtdcAuthCodeType PreAuthCode;
+ ///App类型
+ TThostFtdcAppTypeType AppType;
+};
+
+///客户中心权限豁免
+struct CThostFtdcUserDRIBypassField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///交易中心代码
+ TThostFtdcDRIdentityIDType DRIdentityID;
+};
+
+///申请短信验证码请求
+struct CThostFtdcReqGenSMSCodeField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///手机号
+ TThostFtdcSMSPhoneType Mobile;
+};
+
+///申请短信验证码响应
+struct CThostFtdcRspGenSMSCodeField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///生成时间
+ TThostFtdcTimeType GenTime;
+};
+
+///短信验证信息通知
+struct CThostFtdcSMSVerifyInfoFromSecField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///经纪公司简称
+ TThostFtdcBrokerAbbrType BrokerAbbr;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///手机号
+ TThostFtdcSMSPhoneType Mobile;
+ ///短信验证码
+ TThostFtdcSMSCodeType SMSCode;
+ ///验证码创建日期
+ TThostFtdcDateType CreateDate;
+ ///验证码创建时间
+ TThostFtdcTimeType CreateTime;
+ ///验证码是否被使用过
+ TThostFtdcBoolType IsUsed;
+ ///次席的交易中心代码
+ TThostFtdcDRIdentityIDType FromSec;
+};
+
+///登录验证设置
+struct CThostFtdcSMSVerifyConfigField {
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///手机号
+ TThostFtdcSMSPhoneType Mobile;
+ ///是否启用短信验证
+ TThostFtdcBoolType UseSMSVerify;
+};
+
+///短信验证信息通知
+struct CThostFtdcSMSVerifyInfoField {
+ ///验证码创建时间
+ TThostFtdcTimeType CreateTime;
+ ///手机号
+ TThostFtdcSMSPhoneType Mobile;
+ ///短信验证信息内容
+ TThostFtdcSMSContentType SMSContent;
+};
+
+///套利确认输入基本信息
+struct CThostFtdcInputSpdApplyField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///合约代码
+ TThostFtdcInstrumentIDType FirstLegInstrumentID;
+ ///合约代码
+ TThostFtdcInstrumentIDType SecondLegInstrumentID;
+ ///数量
+ TThostFtdcVolumeType Volume;
+ ///买卖方向
+ TThostFtdcDirectionType Direction;
+ ///组合定单类型
+ TThostFtdcCmbTypeType CmbType;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+};
+
+///套保确认输入基本信息
+struct CThostFtdcInputHedgeCfmField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///合约代码
+ TThostFtdcInstrumentIDType InstrumentID;
+ ///数量
+ TThostFtdcVolumeType Volume;
+ ///买卖方向
+ TThostFtdcDirectionType Direction;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+};
+
+///套利申请回报
+struct CThostFtdcSpdApplyField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///合约代码
+ TThostFtdcInstrumentIDType FirstLegInstrumentID;
+ ///合约代码
+ TThostFtdcInstrumentIDType SecondLegInstrumentID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///数量
+ TThostFtdcVolumeType Volume;
+ ///买卖方向
+ TThostFtdcDirectionType Direction;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///前置编号
+ TThostFtdcFrontIDType FrontID;
+ ///会话编号
+ TThostFtdcSessionIDType SessionID;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///操作用户代码
+ TThostFtdcUserIDType ActiveUserID;
+ ///经纪公司报单编号
+ TThostFtdcSequenceNoType BrokerOrderSeq;
+ ///报单编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///申请状态
+ TThostFtdcApplyStatusType ApplyStatus;
+ ///序号
+ TThostFtdcSequenceNoType SequenceNo;
+ ///报单日期
+ TThostFtdcDateType InsertDate;
+ ///委托时间
+ TThostFtdcTimeType InsertTime;
+ ///撤销时间
+ TThostFtdcTimeType CancelTime;
+ ///本地报单编号
+ TThostFtdcOrderLocalIDType OrderLocalID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///会员代码
+ TThostFtdcParticipantIDType ParticipantID;
+ ///客户代码
+ TThostFtdcClientIDType ClientID;
+ ///合约在交易所的代码
+ TThostFtdcExchangeInstIDType ExchangeInstID;
+ ///交易所交易员代码
+ TThostFtdcTraderIDType TraderID;
+ ///安装编号
+ TThostFtdcInstallIDType InstallID;
+ ///报单提交状态
+ TThostFtdcOrderSubmitStatusType OrderSubmitStatus;
+ ///报单提示序号
+ TThostFtdcSequenceNoType NotifySequence;
+ ///交易日
+ TThostFtdcDateType TradingDay;
+ ///结算编号
+ TThostFtdcSettlementIDType SettlementID;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+ ///组合定单类型
+ TThostFtdcCmbTypeType CmbType;
+ ///状态信息
+ TThostFtdcErrorMsgType StatusMsg;
+};
+
+///套保申请回报
+struct CThostFtdcHedgeCfmField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///合约代码
+ TThostFtdcInstrumentIDType InstrumentID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///数量
+ TThostFtdcVolumeType Volume;
+ ///买卖方向
+ TThostFtdcDirectionType Direction;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///前置编号
+ TThostFtdcFrontIDType FrontID;
+ ///会话编号
+ TThostFtdcSessionIDType SessionID;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///操作用户代码
+ TThostFtdcUserIDType ActiveUserID;
+ ///经纪公司报单编号
+ TThostFtdcSequenceNoType BrokerOrderSeq;
+ ///报单编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///申请状态
+ TThostFtdcApplyStatusType ApplyStatus;
+ ///序号
+ TThostFtdcSequenceNoType SequenceNo;
+ ///成功处理数量
+ TThostFtdcVolumeType DealVolume;
+ ///报单日期
+ TThostFtdcDateType InsertDate;
+ ///委托时间
+ TThostFtdcTimeType InsertTime;
+ ///撤销时间
+ TThostFtdcTimeType CancelTime;
+ ///日期
+ TThostFtdcDateType ReqDate;
+ ///本地报单编号
+ TThostFtdcOrderLocalIDType OrderLocalID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///会员代码
+ TThostFtdcParticipantIDType ParticipantID;
+ ///客户代码
+ TThostFtdcClientIDType ClientID;
+ ///合约在交易所的代码
+ TThostFtdcExchangeInstIDType ExchangeInstID;
+ ///交易所交易员代码
+ TThostFtdcTraderIDType TraderID;
+ ///安装编号
+ TThostFtdcInstallIDType InstallID;
+ ///报单提交状态
+ TThostFtdcOrderSubmitStatusType OrderSubmitStatus;
+ ///报单提示序号
+ TThostFtdcSequenceNoType NotifySequence;
+ ///交易日
+ TThostFtdcDateType TradingDay;
+ ///结算编号
+ TThostFtdcSettlementIDType SettlementID;
+ ///状态信息
+ TThostFtdcErrorMsgType StatusMsg;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+};
+
+///套利套保申请查询
+struct CThostFtdcQrySpdApplyField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///报单编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///第一腿合约编码
+ TThostFtdcExchangeInstIDType FirstLegInstrumentID;
+ ///第二腿合约编码
+ TThostFtdcExchangeInstIDType SecondLegInstrumentID;
+};
+
+///套利套保申请查询
+struct CThostFtdcQryHedgeCfmField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///报单编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///合约代码
+ TThostFtdcInstrumentIDType InstrumentID;
+};
+
+///套利申请撤销
+struct CThostFtdcInputSpdApplyActionField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///合同编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///前置编号
+ TThostFtdcFrontIDType FrontID;
+ ///会话编号
+ TThostFtdcSessionIDType SessionID;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+};
+
+///套保申请撤销
+struct CThostFtdcInputHedgeCfmActionField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///合同编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///前置编号
+ TThostFtdcFrontIDType FrontID;
+ ///会话编号
+ TThostFtdcSessionIDType SessionID;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+};
+
+///套利申请撤销回报
+struct CThostFtdcSpdApplyActionField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///操作日期
+ TThostFtdcDateType ActionDate;
+ ///操作时间
+ TThostFtdcTimeType ActionTime;
+ ///交易所交易员代码
+ TThostFtdcTraderIDType TraderID;
+ ///安装编号
+ TThostFtdcInstallIDType InstallID;
+ ///本地报单编号
+ TThostFtdcOrderLocalIDType OrderLocalID;
+ ///操作本地编号
+ TThostFtdcOrderLocalIDType ActionLocalID;
+ ///会员代码
+ TThostFtdcParticipantIDType ParticipantID;
+ ///客户代码
+ TThostFtdcClientIDType ClientID;
+ ///报单操作状态
+ TThostFtdcOrderActionStatusType OrderActionStatus;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///合同编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///状态信息
+ TThostFtdcErrorMsgType StatusMsg;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///前置编号
+ TThostFtdcFrontIDType FrontID;
+ ///会话编号
+ TThostFtdcSessionIDType SessionID;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+};
+
+///套保申请撤销回报
+struct CThostFtdcHedgeCfmActionField {
+ ///经纪公司代码
+ TThostFtdcBrokerIDType BrokerID;
+ ///投资者代码
+ TThostFtdcInvestorIDType InvestorID;
+ ///操作日期
+ TThostFtdcDateType ActionDate;
+ ///操作时间
+ TThostFtdcTimeType ActionTime;
+ ///交易所交易员代码
+ TThostFtdcTraderIDType TraderID;
+ ///安装编号
+ TThostFtdcInstallIDType InstallID;
+ ///本地报单编号
+ TThostFtdcOrderLocalIDType OrderLocalID;
+ ///操作本地编号
+ TThostFtdcOrderLocalIDType ActionLocalID;
+ ///会员代码
+ TThostFtdcParticipantIDType ParticipantID;
+ ///客户代码
+ TThostFtdcClientIDType ClientID;
+ ///报单操作状态
+ TThostFtdcOrderActionStatusType OrderActionStatus;
+ ///用户代码
+ TThostFtdcUserIDType UserID;
+ ///交易所代码
+ TThostFtdcExchangeIDType ExchangeID;
+ ///合同编号
+ TThostFtdcOrderSysIDType OrderSysID;
+ ///请求编号
+ TThostFtdcRequestIDType RequestID;
+ ///状态信息
+ TThostFtdcErrorMsgType StatusMsg;
+ ///报单引用
+ TThostFtdcOrderRefType OrderRef;
+ ///前置编号
+ TThostFtdcFrontIDType FrontID;
+ ///会话编号
+ TThostFtdcSessionIDType SessionID;
+ ///IP地址
+ TThostFtdcIPAddressType IPAddress;
+ ///Mac地址
+ TThostFtdcMacAddressType MacAddress;
+};
+
///前置信息
struct CThostFtdcFrontInfoField {
diff --git a/ctp/header/error.dtd b/ctp/header/error.dtd
index d384c38..7c7276c 100644
--- a/ctp/header/error.dtd
+++ b/ctp/header/error.dtd
@@ -1,4 +1,4 @@
-
+
+
@@ -210,7 +211,7 @@
-
+
@@ -290,16 +291,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ctp/linux/libLinuxDataCollect.so b/ctp/linux/libLinuxDataCollect.so
old mode 100644
new mode 100755
index 254fd53..132c3af
Binary files a/ctp/linux/libLinuxDataCollect.so and b/ctp/linux/libLinuxDataCollect.so differ
diff --git a/ctp/linux/libthostmduserapi_se.so b/ctp/linux/libthostmduserapi_se.so
old mode 100644
new mode 100755
index bad4bac..a2516be
Binary files a/ctp/linux/libthostmduserapi_se.so and b/ctp/linux/libthostmduserapi_se.so differ
diff --git a/ctp/linux/libthosttraderapi_se.so b/ctp/linux/libthosttraderapi_se.so
old mode 100644
new mode 100755
index d718c76..5cb627d
Binary files a/ctp/linux/libthosttraderapi_se.so and b/ctp/linux/libthosttraderapi_se.so differ
diff --git a/ctp/version.txt b/ctp/version.txt
index d831ec2..665ff0c 100644
--- a/ctp/version.txt
+++ b/ctp/version.txt
@@ -1,3 +1,3 @@
-V6.7.9
+v6.7.13_20260225
windows-64x
linux-64x
\ No newline at end of file
diff --git a/ctp/win/WinDataCollect.dll b/ctp/win/WinDataCollect.dll
index 151795d..042c5e8 100644
Binary files a/ctp/win/WinDataCollect.dll and b/ctp/win/WinDataCollect.dll differ
diff --git a/ctp/win/WinDataCollect.lib b/ctp/win/WinDataCollect.lib
index d900590..18230d7 100644
Binary files a/ctp/win/WinDataCollect.lib and b/ctp/win/WinDataCollect.lib differ
diff --git a/ctp/win/thostmduserapi_se.dll b/ctp/win/thostmduserapi_se.dll
index 376826f..5f69e9d 100644
Binary files a/ctp/win/thostmduserapi_se.dll and b/ctp/win/thostmduserapi_se.dll differ
diff --git a/ctp/win/thostmduserapi_se.lib b/ctp/win/thostmduserapi_se.lib
index 6fd41b6..427a783 100644
Binary files a/ctp/win/thostmduserapi_se.lib and b/ctp/win/thostmduserapi_se.lib differ
diff --git a/ctp/win/thosttraderapi_se.dll b/ctp/win/thosttraderapi_se.dll
index ae04f3e..ac1a777 100644
Binary files a/ctp/win/thosttraderapi_se.dll and b/ctp/win/thosttraderapi_se.dll differ
diff --git a/ctp/win/thosttraderapi_se.lib b/ctp/win/thosttraderapi_se.lib
index 3c43c82..b9add16 100644
Binary files a/ctp/win/thosttraderapi_se.lib and b/ctp/win/thosttraderapi_se.lib differ
diff --git a/ctpwrapper/ApiStructure.py b/ctpwrapper/ApiStructure.py
index 3cab840..3ddf69f 100644
--- a/ctpwrapper/ApiStructure.py
+++ b/ctpwrapper/ApiStructure.py
@@ -32,12 +32,13 @@ class ReqUserLoginField(Base):
('LoginRemark', ctypes.c_char * 36), # 登录备注
('ClientIPPort', ctypes.c_int), # 终端IP端口
('ClientIPAddress', ctypes.c_char * 33), # 终端IP地址
+ ('SMSCode', ctypes.c_char * 17), # 短信验证码
]
def __init__(self, TradingDay: str = '', BrokerID: str = '', UserID: str = '', Password: str = '',
UserProductInfo: str = '', InterfaceProductInfo: str = '', ProtocolInfo: str = '',
MacAddress: str = '', OneTimePassword: str = '', reserve1: str = '', LoginRemark: str = '',
- ClientIPPort: int = 0, ClientIPAddress: str = ''):
+ ClientIPPort: int = 0, ClientIPAddress: str = '', SMSCode: str = ''):
super(ReqUserLoginField, self).__init__()
self.TradingDay = self._to_bytes(TradingDay)
self.BrokerID = self._to_bytes(BrokerID)
@@ -52,6 +53,7 @@ def __init__(self, TradingDay: str = '', BrokerID: str = '', UserID: str = '', P
self.LoginRemark = self._to_bytes(LoginRemark)
self.ClientIPPort = int(ClientIPPort)
self.ClientIPAddress = self._to_bytes(ClientIPAddress)
+ self.SMSCode = self._to_bytes(SMSCode)
class RspUserLoginField(Base):
@@ -74,12 +76,15 @@ class RspUserLoginField(Base):
('GFEXTime', ctypes.c_char * 9), # 广期所时间
('LoginDRIdentityID', ctypes.c_int), # 当前登录中心号
('UserDRIdentityID', ctypes.c_int), # 用户所属中心号
+ ('LastLoginTime', ctypes.c_char * 17), # 上次登陆时间
+ ('ReserveInfo', ctypes.c_char * 65), # 预留信息
]
def __init__(self, TradingDay: str = '', LoginTime: str = '', BrokerID: str = '', UserID: str = '',
SystemName: str = '', FrontID: int = 0, SessionID: int = 0, MaxOrderRef: str = '', SHFETime: str = '',
DCETime: str = '', CZCETime: str = '', FFEXTime: str = '', INETime: str = '', SysVersion: str = '',
- GFEXTime: str = '', LoginDRIdentityID: int = 0, UserDRIdentityID: int = 0):
+ GFEXTime: str = '', LoginDRIdentityID: int = 0, UserDRIdentityID: int = 0, LastLoginTime: str = '',
+ ReserveInfo: str = ''):
super(RspUserLoginField, self).__init__()
self.TradingDay = self._to_bytes(TradingDay)
self.LoginTime = self._to_bytes(LoginTime)
@@ -98,6 +103,8 @@ def __init__(self, TradingDay: str = '', LoginTime: str = '', BrokerID: str = ''
self.GFEXTime = self._to_bytes(GFEXTime)
self.LoginDRIdentityID = int(LoginDRIdentityID)
self.UserDRIdentityID = int(UserDRIdentityID)
+ self.LastLoginTime = self._to_bytes(LastLoginTime)
+ self.ReserveInfo = self._to_bytes(ReserveInfo)
class UserLogoutField(Base):
@@ -855,6 +862,7 @@ class TradingAccountField(Base):
('BizType', ctypes.c_char), # 业务类型
('FrozenSwap', ctypes.c_double), # 延时换汇冻结金额
('RemainSwap', ctypes.c_double), # 剩余换汇额度
+ ('OptionValue', ctypes.c_double), # 期权市值
]
def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float = 0.0, PreCredit: float = 0.0,
@@ -871,7 +879,7 @@ def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float =
SpecProductCommission: float = 0.0, SpecProductFrozenCommission: float = 0.0,
SpecProductPositionProfit: float = 0.0, SpecProductCloseProfit: float = 0.0,
SpecProductPositionProfitByAlg: float = 0.0, SpecProductExchangeMargin: float = 0.0, BizType: str = '',
- FrozenSwap: float = 0.0, RemainSwap: float = 0.0):
+ FrozenSwap: float = 0.0, RemainSwap: float = 0.0, OptionValue: float = 0.0):
super(TradingAccountField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.AccountID = self._to_bytes(AccountID)
@@ -922,6 +930,7 @@ def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float =
self.BizType = self._to_bytes(BizType)
self.FrozenSwap = float(FrozenSwap)
self.RemainSwap = float(RemainSwap)
+ self.OptionValue = float(OptionValue)
class InvestorPositionField(Base):
@@ -977,6 +986,7 @@ class InvestorPositionField(Base):
('TasPosition', ctypes.c_int), # tas持仓手数
('TasPositionCost', ctypes.c_double), # tas持仓成本
('InstrumentID', ctypes.c_char * 81), # 合约代码
+ ('OptionValue', ctypes.c_double), # 期权市值
]
def __init__(self, reserve1: str = '', BrokerID: str = '', InvestorID: str = '', PosiDirection: str = '',
@@ -993,7 +1003,7 @@ def __init__(self, reserve1: str = '', BrokerID: str = '', InvestorID: str = '',
MarginRateByVolume: float = 0.0, StrikeFrozen: int = 0, StrikeFrozenAmount: float = 0.0,
AbandonFrozen: int = 0, ExchangeID: str = '', YdStrikeFrozen: int = 0, InvestUnitID: str = '',
PositionCostOffset: float = 0.0, TasPosition: int = 0, TasPositionCost: float = 0.0,
- InstrumentID: str = ''):
+ InstrumentID: str = '', OptionValue: float = 0.0):
super(InvestorPositionField, self).__init__()
self.reserve1 = self._to_bytes(reserve1)
self.BrokerID = self._to_bytes(BrokerID)
@@ -1045,6 +1055,7 @@ def __init__(self, reserve1: str = '', BrokerID: str = '', InvestorID: str = '',
self.TasPosition = int(TasPosition)
self.TasPositionCost = float(TasPositionCost)
self.InstrumentID = self._to_bytes(InstrumentID)
+ self.OptionValue = float(OptionValue)
class InstrumentMarginRateField(Base):
@@ -2721,6 +2732,7 @@ class SyncingTradingAccountField(Base):
('SpecProductExchangeMargin', ctypes.c_double), # 特殊产品交易所保证金
('FrozenSwap', ctypes.c_double), # 延时换汇冻结金额
('RemainSwap', ctypes.c_double), # 剩余换汇额度
+ ('OptionValue', ctypes.c_double), # 期权市值
]
def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float = 0.0, PreCredit: float = 0.0,
@@ -2737,7 +2749,7 @@ def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float =
SpecProductCommission: float = 0.0, SpecProductFrozenCommission: float = 0.0,
SpecProductPositionProfit: float = 0.0, SpecProductCloseProfit: float = 0.0,
SpecProductPositionProfitByAlg: float = 0.0, SpecProductExchangeMargin: float = 0.0,
- FrozenSwap: float = 0.0, RemainSwap: float = 0.0):
+ FrozenSwap: float = 0.0, RemainSwap: float = 0.0, OptionValue: float = 0.0):
super(SyncingTradingAccountField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.AccountID = self._to_bytes(AccountID)
@@ -2787,6 +2799,7 @@ def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float =
self.SpecProductExchangeMargin = float(SpecProductExchangeMargin)
self.FrozenSwap = float(FrozenSwap)
self.RemainSwap = float(RemainSwap)
+ self.OptionValue = float(OptionValue)
class SyncingInvestorPositionField(Base):
@@ -7590,14 +7603,17 @@ class ContractBankField(Base):
('BankID', ctypes.c_char * 4), # 银行代码
('BankBrchID', ctypes.c_char * 5), # 银行分中心代码
('BankName', ctypes.c_char * 101), # 银行名称
+ ('csrcBankID', ctypes.c_char * 4), # 上报csrc的银行代码
]
- def __init__(self, BrokerID: str = '', BankID: str = '', BankBrchID: str = '', BankName: str = ''):
+ def __init__(self, BrokerID: str = '', BankID: str = '', BankBrchID: str = '', BankName: str = '',
+ csrcBankID: str = ''):
super(ContractBankField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.BankID = self._to_bytes(BankID)
self.BankBrchID = self._to_bytes(BankBrchID)
self.BankName = self._to_bytes(BankName)
+ self.csrcBankID = self._to_bytes(csrcBankID)
class InvestorPositionCombineDetailField(Base):
@@ -12318,11 +12334,12 @@ class UserSystemInfoField(Base):
('ClientAppID', ctypes.c_char * 33), # App代码
('ClientPublicIP', ctypes.c_char * 33), # 用户公网IP
('ClientLoginRemark', ctypes.c_char * 151), # 客户登录备注2
+ ('MAC', ctypes.c_char * 41), # 客户终端的MAC等标识
]
def __init__(self, BrokerID: str = '', UserID: str = '', ClientSystemInfoLen: int = 0, ClientSystemInfo: str = '',
reserve1: str = '', ClientIPPort: int = 0, ClientLoginTime: str = '', ClientAppID: str = '',
- ClientPublicIP: str = '', ClientLoginRemark: str = ''):
+ ClientPublicIP: str = '', ClientLoginRemark: str = '', MAC: str = ''):
super(UserSystemInfoField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.UserID = self._to_bytes(UserID)
@@ -12334,6 +12351,7 @@ def __init__(self, BrokerID: str = '', UserID: str = '', ClientSystemInfoLen: in
self.ClientAppID = self._to_bytes(ClientAppID)
self.ClientPublicIP = self._to_bytes(ClientPublicIP)
self.ClientLoginRemark = self._to_bytes(ClientLoginRemark)
+ self.MAC = self._to_bytes(MAC)
class AuthUserIDField(Base):
@@ -12436,6 +12454,7 @@ class ReqUserLoginSMField(Base):
('LoginRemark', ctypes.c_char * 36), # 登录备注
('ClientIPPort', ctypes.c_int), # 终端IP端口
('ClientIPAddress', ctypes.c_char * 33), # 终端IP地址
+ ('SMSCode', ctypes.c_char * 17), # 短信验证码
('BrokerName', ctypes.c_char * 81), # 经纪公司名称
('AuthCode', ctypes.c_char * 17), # 认证码
('AppID', ctypes.c_char * 33), # App代码
@@ -12445,8 +12464,8 @@ class ReqUserLoginSMField(Base):
def __init__(self, TradingDay: str = '', BrokerID: str = '', UserID: str = '', Password: str = '',
UserProductInfo: str = '', InterfaceProductInfo: str = '', ProtocolInfo: str = '',
MacAddress: str = '', OneTimePassword: str = '', reserve1: str = '', LoginRemark: str = '',
- ClientIPPort: int = 0, ClientIPAddress: str = '', BrokerName: str = '', AuthCode: str = '',
- AppID: str = '', PIN: str = ''):
+ ClientIPPort: int = 0, ClientIPAddress: str = '', SMSCode: str = '', BrokerName: str = '',
+ AuthCode: str = '', AppID: str = '', PIN: str = ''):
super(ReqUserLoginSMField, self).__init__()
self.TradingDay = self._to_bytes(TradingDay)
self.BrokerID = self._to_bytes(BrokerID)
@@ -12461,6 +12480,7 @@ def __init__(self, TradingDay: str = '', BrokerID: str = '', UserID: str = '', P
self.LoginRemark = self._to_bytes(LoginRemark)
self.ClientIPPort = int(ClientIPPort)
self.ClientIPAddress = self._to_bytes(ClientIPAddress)
+ self.SMSCode = self._to_bytes(SMSCode)
self.BrokerName = self._to_bytes(BrokerName)
self.AuthCode = self._to_bytes(AuthCode)
self.AppID = self._to_bytes(AppID)
@@ -12848,6 +12868,7 @@ class SyncDeltaTradingAccountField(Base):
('SpecProductExchangeMargin', ctypes.c_double), # 特殊产品交易所保证金
('FrozenSwap', ctypes.c_double), # 延时换汇冻结金额
('RemainSwap', ctypes.c_double), # 剩余换汇额度
+ ('OptionValue', ctypes.c_double), # 期权市值
('SyncDeltaSequenceNo', ctypes.c_int), # 追平序号
]
@@ -12865,7 +12886,8 @@ def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float =
SpecProductCommission: float = 0.0, SpecProductFrozenCommission: float = 0.0,
SpecProductPositionProfit: float = 0.0, SpecProductCloseProfit: float = 0.0,
SpecProductPositionProfitByAlg: float = 0.0, SpecProductExchangeMargin: float = 0.0,
- FrozenSwap: float = 0.0, RemainSwap: float = 0.0, SyncDeltaSequenceNo: int = 0):
+ FrozenSwap: float = 0.0, RemainSwap: float = 0.0, OptionValue: float = 0.0,
+ SyncDeltaSequenceNo: int = 0):
super(SyncDeltaTradingAccountField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.AccountID = self._to_bytes(AccountID)
@@ -12915,6 +12937,7 @@ def __init__(self, BrokerID: str = '', AccountID: str = '', PreMortgage: float =
self.SpecProductExchangeMargin = float(SpecProductExchangeMargin)
self.FrozenSwap = float(FrozenSwap)
self.RemainSwap = float(RemainSwap)
+ self.OptionValue = float(OptionValue)
self.SyncDeltaSequenceNo = int(SyncDeltaSequenceNo)
@@ -12974,7 +12997,7 @@ class SyncDeltaDceCombInstrumentField(Base):
('CombinationType', ctypes.c_char), # 组合类型
('Direction', ctypes.c_char), # 买卖
('ProductID', ctypes.c_char * 81), # 产品代码
- ('Xparameter', ctypes.c_double), # 期权组合保证金比例
+ ('Xparameter', ctypes.c_double), # 期货/期权组合保证金比例
('ActionDirection', ctypes.c_char), # 操作标志
('SyncDeltaSequenceNo', ctypes.c_int), # 追平序号
]
@@ -13798,7 +13821,7 @@ class PortfTradeParamSettingField(Base):
('ExchangeID', ctypes.c_char * 9), # 交易所代码
('BrokerID', ctypes.c_char * 11), # 经纪公司代码
('InvestorID', ctypes.c_char * 13), # 投资者代码
- ('Portfolio', ctypes.c_char), # 新型组保算法
+ ('Portfolio', ctypes.c_char), # 组保算法
('IsActionVerify', ctypes.c_int), # 撤单是否验资
('IsCloseVerify', ctypes.c_int), # 平仓是否验资
]
@@ -15332,11 +15355,12 @@ class IpAddrParamField(Base):
('Remark', ctypes.c_char * 161), # 地址补充信息
('Site', ctypes.c_char * 51), # 站点
('NetOperator', ctypes.c_char * 9), # 网络运营商
+ ('SysName', ctypes.c_char * 65), # 系统名称
]
def __init__(self, BrokerID: str = '', Address: str = '', DRIdentityID: int = 0, DRIdentityName: str = '',
AddrSrvMode: str = '', AddrVer: str = '', AddrNo: int = 0, AddrName: str = '', IsSM: int = 0,
- IsLocalAddr: int = 0, Remark: str = '', Site: str = '', NetOperator: str = ''):
+ IsLocalAddr: int = 0, Remark: str = '', Site: str = '', NetOperator: str = '', SysName: str = ''):
super(IpAddrParamField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.Address = self._to_bytes(Address)
@@ -15351,6 +15375,7 @@ def __init__(self, BrokerID: str = '', Address: str = '', DRIdentityID: int = 0,
self.Remark = self._to_bytes(Remark)
self.Site = self._to_bytes(Site)
self.NetOperator = self._to_bytes(NetOperator)
+ self.SysName = self._to_bytes(SysName)
class QryIpAddrParamField(Base):
@@ -15381,12 +15406,13 @@ class TGIpAddrParamField(Base):
('Remark', ctypes.c_char * 161), # 地址补充信息
('Site', ctypes.c_char * 51), # 站点
('NetOperator', ctypes.c_char * 9), # 网络运营商
+ ('SysName', ctypes.c_char * 65), # 系统名称
]
def __init__(self, BrokerID: str = '', UserID: str = '', Address: str = '', DRIdentityID: int = 0,
DRIdentityName: str = '', AddrSrvMode: str = '', AddrVer: str = '', AddrNo: int = 0,
AddrName: str = '', IsSM: int = 0, IsLocalAddr: int = 0, Remark: str = '', Site: str = '',
- NetOperator: str = ''):
+ NetOperator: str = '', SysName: str = ''):
super(TGIpAddrParamField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.UserID = self._to_bytes(UserID)
@@ -15402,6 +15428,7 @@ def __init__(self, BrokerID: str = '', UserID: str = '', Address: str = '', DRId
self.Remark = self._to_bytes(Remark)
self.Site = self._to_bytes(Site)
self.NetOperator = self._to_bytes(NetOperator)
+ self.SysName = self._to_bytes(SysName)
class QryTGIpAddrParamField(Base):
@@ -16287,6 +16314,7 @@ class OffsetSettingField(Base):
('StatusMsg', ctypes.c_char * 81), # 状态信息
('ActiveUserID', ctypes.c_char * 16), # 操作用户代码
('BrokerOffsetSettingSeq', ctypes.c_int), # 经纪公司报单编号
+ ('ApplySrc', ctypes.c_char), # 申请来源
]
def __init__(self, BrokerID: str = '', InvestorID: str = '', InstrumentID: str = '', UnderlyingInstrID: str = '',
@@ -16297,7 +16325,7 @@ def __init__(self, BrokerID: str = '', InvestorID: str = '', InstrumentID: str =
OrderSubmitStatus: str = '', TradingDay: str = '', SettlementID: int = 0, InsertDate: str = '',
InsertTime: str = '', CancelTime: str = '', ExecResult: str = '', SequenceNo: int = 0,
FrontID: int = 0, SessionID: int = 0, StatusMsg: str = '', ActiveUserID: str = '',
- BrokerOffsetSettingSeq: int = 0):
+ BrokerOffsetSettingSeq: int = 0, ApplySrc: str = ''):
super(OffsetSettingField, self).__init__()
self.BrokerID = self._to_bytes(BrokerID)
self.InvestorID = self._to_bytes(InvestorID)
@@ -16332,6 +16360,7 @@ def __init__(self, BrokerID: str = '', InvestorID: str = '', InstrumentID: str =
self.StatusMsg = self._to_bytes(StatusMsg)
self.ActiveUserID = self._to_bytes(ActiveUserID)
self.BrokerOffsetSettingSeq = int(BrokerOffsetSettingSeq)
+ self.ApplySrc = self._to_bytes(ApplySrc)
class CancelOffsetSettingField(Base):
@@ -16443,6 +16472,670 @@ def __init__(self, BrokerID: str = ''):
self.BrokerID = self._to_bytes(BrokerID)
+class WechatUserSystemInfoField(Base):
+ """微信小程序等用户系统信息"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('WechatCltSysInfoLen', ctypes.c_int), # 微信小程序等用户端系统内部信息长度
+ ('WechatCltSysInfo', ctypes.c_char * 273), # 微信小程序等用户端系统内部信息
+ ('ClientIPPort', ctypes.c_int), # 终端IP端口
+ ('ClientLoginTime', ctypes.c_char * 9), # 登录成功时间
+ ('ClientAppID', ctypes.c_char * 33), # App代码
+ ('ClientPublicIP', ctypes.c_char * 33), # 用户公网IP
+ ('ClientLoginRemark', ctypes.c_char * 151), # 客户登录备注2
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', WechatCltSysInfoLen: int = 0, WechatCltSysInfo: str = '',
+ ClientIPPort: int = 0, ClientLoginTime: str = '', ClientAppID: str = '', ClientPublicIP: str = '',
+ ClientLoginRemark: str = ''):
+ super(WechatUserSystemInfoField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.WechatCltSysInfoLen = int(WechatCltSysInfoLen)
+ self.WechatCltSysInfo = self._to_bytes(WechatCltSysInfo)
+ self.ClientIPPort = int(ClientIPPort)
+ self.ClientLoginTime = self._to_bytes(ClientLoginTime)
+ self.ClientAppID = self._to_bytes(ClientAppID)
+ self.ClientPublicIP = self._to_bytes(ClientPublicIP)
+ self.ClientLoginRemark = self._to_bytes(ClientLoginRemark)
+
+
+class InvestorReserveInfoField(Base):
+ """投资者预留信息"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('ReserveInfo', ctypes.c_char * 65), # 预留信息
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', ReserveInfo: str = ''):
+ super(InvestorReserveInfoField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.ReserveInfo = self._to_bytes(ReserveInfo)
+
+
+class QryInvestorDepartmentFlatField(Base):
+ """查询组织架构投资者对应关系"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ]
+
+ def __init__(self, BrokerID: str = ''):
+ super(QryInvestorDepartmentFlatField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+
+
+class InvestorDepartmentFlatField(Base):
+ """组织架构投资者对应关系"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('DepartmentID', ctypes.c_char * 13), # 组织架构代码
+ ]
+
+ def __init__(self, BrokerID: str = '', InvestorID: str = '', DepartmentID: str = ''):
+ super(InvestorDepartmentFlatField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.DepartmentID = self._to_bytes(DepartmentID)
+
+
+class QryDepartmentUserField(Base):
+ """查询操作员组织架构关系"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ]
+
+ def __init__(self, BrokerID: str = ''):
+ super(QryDepartmentUserField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+
+
+class AppAuthenticationCodeField(Base):
+ """App客户端认证码"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('AppID', ctypes.c_char * 33), # App代码
+ ('AuthCode', ctypes.c_char * 17), # 认证码
+ ('PreAuthCode', ctypes.c_char * 17), # 旧认证码
+ ('AppType', ctypes.c_char), # App类型
+ ]
+
+ def __init__(self, BrokerID: str = '', AppID: str = '', AuthCode: str = '', PreAuthCode: str = '',
+ AppType: str = ''):
+ super(AppAuthenticationCodeField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.AppID = self._to_bytes(AppID)
+ self.AuthCode = self._to_bytes(AuthCode)
+ self.PreAuthCode = self._to_bytes(PreAuthCode)
+ self.AppType = self._to_bytes(AppType)
+
+
+class UserDRIBypassField(Base):
+ """客户中心权限豁免"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('DRIdentityID', ctypes.c_int), # 交易中心代码
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', DRIdentityID: int = 0):
+ super(UserDRIBypassField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.DRIdentityID = int(DRIdentityID)
+
+
+class ReqGenSMSCodeField(Base):
+ """申请短信验证码请求"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('Mobile', ctypes.c_char * 17), # 手机号
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', Mobile: str = ''):
+ super(ReqGenSMSCodeField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.Mobile = self._to_bytes(Mobile)
+
+
+class RspGenSMSCodeField(Base):
+ """申请短信验证码响应"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('GenTime', ctypes.c_char * 9), # 生成时间
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', GenTime: str = ''):
+ super(RspGenSMSCodeField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.GenTime = self._to_bytes(GenTime)
+
+
+class SMSVerifyInfoFromSecField(Base):
+ """短信验证信息通知"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('BrokerAbbr', ctypes.c_char * 9), # 经纪公司简称
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('Mobile', ctypes.c_char * 17), # 手机号
+ ('SMSCode', ctypes.c_char * 17), # 短信验证码
+ ('CreateDate', ctypes.c_char * 9), # 验证码创建日期
+ ('CreateTime', ctypes.c_char * 9), # 验证码创建时间
+ ('IsUsed', ctypes.c_int), # 验证码是否被使用过
+ ('FromSec', ctypes.c_int), # 次席的交易中心代码
+ ]
+
+ def __init__(self, BrokerID: str = '', BrokerAbbr: str = '', UserID: str = '', Mobile: str = '', SMSCode: str = '',
+ CreateDate: str = '', CreateTime: str = '', IsUsed: int = 0, FromSec: int = 0):
+ super(SMSVerifyInfoFromSecField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.BrokerAbbr = self._to_bytes(BrokerAbbr)
+ self.UserID = self._to_bytes(UserID)
+ self.Mobile = self._to_bytes(Mobile)
+ self.SMSCode = self._to_bytes(SMSCode)
+ self.CreateDate = self._to_bytes(CreateDate)
+ self.CreateTime = self._to_bytes(CreateTime)
+ self.IsUsed = int(IsUsed)
+ self.FromSec = int(FromSec)
+
+
+class SMSVerifyConfigField(Base):
+ """登录验证设置"""
+ _fields_ = [
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('Mobile', ctypes.c_char * 17), # 手机号
+ ('UseSMSVerify', ctypes.c_int), # 是否启用短信验证
+ ]
+
+ def __init__(self, UserID: str = '', BrokerID: str = '', Mobile: str = '', UseSMSVerify: int = 0):
+ super(SMSVerifyConfigField, self).__init__()
+ self.UserID = self._to_bytes(UserID)
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.Mobile = self._to_bytes(Mobile)
+ self.UseSMSVerify = int(UseSMSVerify)
+
+
+class SMSVerifyInfoField(Base):
+ """短信验证信息通知"""
+ _fields_ = [
+ ('CreateTime', ctypes.c_char * 9), # 验证码创建时间
+ ('Mobile', ctypes.c_char * 17), # 手机号
+ ('SMSContent', ctypes.c_char * 129), # 短信验证信息内容
+ ]
+
+ def __init__(self, CreateTime: str = '', Mobile: str = '', SMSContent: str = ''):
+ super(SMSVerifyInfoField, self).__init__()
+ self.CreateTime = self._to_bytes(CreateTime)
+ self.Mobile = self._to_bytes(Mobile)
+ self.SMSContent = self._to_bytes(SMSContent)
+
+
+class InputSpdApplyField(Base):
+ """套利确认输入基本信息"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('FirstLegInstrumentID', ctypes.c_char * 81), # 合约代码
+ ('SecondLegInstrumentID', ctypes.c_char * 81), # 合约代码
+ ('Volume', ctypes.c_int), # 数量
+ ('Direction', ctypes.c_char), # 买卖方向
+ ('CmbType', ctypes.c_char), # 组合定单类型
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', InvestorID: str = '', ExchangeID: str = '',
+ FirstLegInstrumentID: str = '', SecondLegInstrumentID: str = '', Volume: int = 0, Direction: str = '',
+ CmbType: str = '', RequestID: int = 0, OrderRef: str = '', IPAddress: str = '', MacAddress: str = ''):
+ super(InputSpdApplyField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.FirstLegInstrumentID = self._to_bytes(FirstLegInstrumentID)
+ self.SecondLegInstrumentID = self._to_bytes(SecondLegInstrumentID)
+ self.Volume = int(Volume)
+ self.Direction = self._to_bytes(Direction)
+ self.CmbType = self._to_bytes(CmbType)
+ self.RequestID = int(RequestID)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+
+
+class InputHedgeCfmField(Base):
+ """套保确认输入基本信息"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('InstrumentID', ctypes.c_char * 81), # 合约代码
+ ('Volume', ctypes.c_int), # 数量
+ ('Direction', ctypes.c_char), # 买卖方向
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', InvestorID: str = '', ExchangeID: str = '',
+ InstrumentID: str = '', Volume: int = 0, Direction: str = '', RequestID: int = 0, OrderRef: str = '',
+ IPAddress: str = '', MacAddress: str = ''):
+ super(InputHedgeCfmField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.InstrumentID = self._to_bytes(InstrumentID)
+ self.Volume = int(Volume)
+ self.Direction = self._to_bytes(Direction)
+ self.RequestID = int(RequestID)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+
+
+class SpdApplyField(Base):
+ """套利申请回报"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('FirstLegInstrumentID', ctypes.c_char * 81), # 合约代码
+ ('SecondLegInstrumentID', ctypes.c_char * 81), # 合约代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('Volume', ctypes.c_int), # 数量
+ ('Direction', ctypes.c_char), # 买卖方向
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('FrontID', ctypes.c_int), # 前置编号
+ ('SessionID', ctypes.c_int), # 会话编号
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('ActiveUserID', ctypes.c_char * 16), # 操作用户代码
+ ('BrokerOrderSeq', ctypes.c_int), # 经纪公司报单编号
+ ('OrderSysID', ctypes.c_char * 21), # 报单编号
+ ('ApplyStatus', ctypes.c_char), # 申请状态
+ ('SequenceNo', ctypes.c_int), # 序号
+ ('InsertDate', ctypes.c_char * 9), # 报单日期
+ ('InsertTime', ctypes.c_char * 9), # 委托时间
+ ('CancelTime', ctypes.c_char * 9), # 撤销时间
+ ('OrderLocalID', ctypes.c_char * 13), # 本地报单编号
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('ParticipantID', ctypes.c_char * 11), # 会员代码
+ ('ClientID', ctypes.c_char * 11), # 客户代码
+ ('ExchangeInstID', ctypes.c_char * 81), # 合约在交易所的代码
+ ('TraderID', ctypes.c_char * 21), # 交易所交易员代码
+ ('InstallID', ctypes.c_int), # 安装编号
+ ('OrderSubmitStatus', ctypes.c_char), # 报单提交状态
+ ('NotifySequence', ctypes.c_int), # 报单提示序号
+ ('TradingDay', ctypes.c_char * 9), # 交易日
+ ('SettlementID', ctypes.c_int), # 结算编号
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ('CmbType', ctypes.c_char), # 组合定单类型
+ ('StatusMsg', ctypes.c_char * 81), # 状态信息
+ ]
+
+ def __init__(self, BrokerID: str = '', InvestorID: str = '', FirstLegInstrumentID: str = '',
+ SecondLegInstrumentID: str = '', UserID: str = '', Volume: int = 0, Direction: str = '',
+ RequestID: int = 0, FrontID: int = 0, SessionID: int = 0, OrderRef: str = '', ActiveUserID: str = '',
+ BrokerOrderSeq: int = 0, OrderSysID: str = '', ApplyStatus: str = '', SequenceNo: int = 0,
+ InsertDate: str = '', InsertTime: str = '', CancelTime: str = '', OrderLocalID: str = '',
+ ExchangeID: str = '', ParticipantID: str = '', ClientID: str = '', ExchangeInstID: str = '',
+ TraderID: str = '', InstallID: int = 0, OrderSubmitStatus: str = '', NotifySequence: int = 0,
+ TradingDay: str = '', SettlementID: int = 0, IPAddress: str = '', MacAddress: str = '',
+ CmbType: str = '', StatusMsg: str = ''):
+ super(SpdApplyField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.FirstLegInstrumentID = self._to_bytes(FirstLegInstrumentID)
+ self.SecondLegInstrumentID = self._to_bytes(SecondLegInstrumentID)
+ self.UserID = self._to_bytes(UserID)
+ self.Volume = int(Volume)
+ self.Direction = self._to_bytes(Direction)
+ self.RequestID = int(RequestID)
+ self.FrontID = int(FrontID)
+ self.SessionID = int(SessionID)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.ActiveUserID = self._to_bytes(ActiveUserID)
+ self.BrokerOrderSeq = int(BrokerOrderSeq)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.ApplyStatus = self._to_bytes(ApplyStatus)
+ self.SequenceNo = int(SequenceNo)
+ self.InsertDate = self._to_bytes(InsertDate)
+ self.InsertTime = self._to_bytes(InsertTime)
+ self.CancelTime = self._to_bytes(CancelTime)
+ self.OrderLocalID = self._to_bytes(OrderLocalID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.ParticipantID = self._to_bytes(ParticipantID)
+ self.ClientID = self._to_bytes(ClientID)
+ self.ExchangeInstID = self._to_bytes(ExchangeInstID)
+ self.TraderID = self._to_bytes(TraderID)
+ self.InstallID = int(InstallID)
+ self.OrderSubmitStatus = self._to_bytes(OrderSubmitStatus)
+ self.NotifySequence = int(NotifySequence)
+ self.TradingDay = self._to_bytes(TradingDay)
+ self.SettlementID = int(SettlementID)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+ self.CmbType = self._to_bytes(CmbType)
+ self.StatusMsg = self._to_bytes(StatusMsg)
+
+
+class HedgeCfmField(Base):
+ """套保申请回报"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('InstrumentID', ctypes.c_char * 81), # 合约代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('Volume', ctypes.c_int), # 数量
+ ('Direction', ctypes.c_char), # 买卖方向
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('FrontID', ctypes.c_int), # 前置编号
+ ('SessionID', ctypes.c_int), # 会话编号
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('ActiveUserID', ctypes.c_char * 16), # 操作用户代码
+ ('BrokerOrderSeq', ctypes.c_int), # 经纪公司报单编号
+ ('OrderSysID', ctypes.c_char * 21), # 报单编号
+ ('ApplyStatus', ctypes.c_char), # 申请状态
+ ('SequenceNo', ctypes.c_int), # 序号
+ ('DealVolume', ctypes.c_int), # 成功处理数量
+ ('InsertDate', ctypes.c_char * 9), # 报单日期
+ ('InsertTime', ctypes.c_char * 9), # 委托时间
+ ('CancelTime', ctypes.c_char * 9), # 撤销时间
+ ('ReqDate', ctypes.c_char * 9), # 日期
+ ('OrderLocalID', ctypes.c_char * 13), # 本地报单编号
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('ParticipantID', ctypes.c_char * 11), # 会员代码
+ ('ClientID', ctypes.c_char * 11), # 客户代码
+ ('ExchangeInstID', ctypes.c_char * 81), # 合约在交易所的代码
+ ('TraderID', ctypes.c_char * 21), # 交易所交易员代码
+ ('InstallID', ctypes.c_int), # 安装编号
+ ('OrderSubmitStatus', ctypes.c_char), # 报单提交状态
+ ('NotifySequence', ctypes.c_int), # 报单提示序号
+ ('TradingDay', ctypes.c_char * 9), # 交易日
+ ('SettlementID', ctypes.c_int), # 结算编号
+ ('StatusMsg', ctypes.c_char * 81), # 状态信息
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ]
+
+ def __init__(self, BrokerID: str = '', InvestorID: str = '', InstrumentID: str = '', UserID: str = '',
+ Volume: int = 0, Direction: str = '', RequestID: int = 0, FrontID: int = 0, SessionID: int = 0,
+ OrderRef: str = '', ActiveUserID: str = '', BrokerOrderSeq: int = 0, OrderSysID: str = '',
+ ApplyStatus: str = '', SequenceNo: int = 0, DealVolume: int = 0, InsertDate: str = '',
+ InsertTime: str = '', CancelTime: str = '', ReqDate: str = '', OrderLocalID: str = '',
+ ExchangeID: str = '', ParticipantID: str = '', ClientID: str = '', ExchangeInstID: str = '',
+ TraderID: str = '', InstallID: int = 0, OrderSubmitStatus: str = '', NotifySequence: int = 0,
+ TradingDay: str = '', SettlementID: int = 0, StatusMsg: str = '', IPAddress: str = '',
+ MacAddress: str = ''):
+ super(HedgeCfmField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.InstrumentID = self._to_bytes(InstrumentID)
+ self.UserID = self._to_bytes(UserID)
+ self.Volume = int(Volume)
+ self.Direction = self._to_bytes(Direction)
+ self.RequestID = int(RequestID)
+ self.FrontID = int(FrontID)
+ self.SessionID = int(SessionID)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.ActiveUserID = self._to_bytes(ActiveUserID)
+ self.BrokerOrderSeq = int(BrokerOrderSeq)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.ApplyStatus = self._to_bytes(ApplyStatus)
+ self.SequenceNo = int(SequenceNo)
+ self.DealVolume = int(DealVolume)
+ self.InsertDate = self._to_bytes(InsertDate)
+ self.InsertTime = self._to_bytes(InsertTime)
+ self.CancelTime = self._to_bytes(CancelTime)
+ self.ReqDate = self._to_bytes(ReqDate)
+ self.OrderLocalID = self._to_bytes(OrderLocalID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.ParticipantID = self._to_bytes(ParticipantID)
+ self.ClientID = self._to_bytes(ClientID)
+ self.ExchangeInstID = self._to_bytes(ExchangeInstID)
+ self.TraderID = self._to_bytes(TraderID)
+ self.InstallID = int(InstallID)
+ self.OrderSubmitStatus = self._to_bytes(OrderSubmitStatus)
+ self.NotifySequence = int(NotifySequence)
+ self.TradingDay = self._to_bytes(TradingDay)
+ self.SettlementID = int(SettlementID)
+ self.StatusMsg = self._to_bytes(StatusMsg)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+
+
+class QrySpdApplyField(Base):
+ """套利套保申请查询"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('OrderSysID', ctypes.c_char * 21), # 报单编号
+ ('FirstLegInstrumentID', ctypes.c_char * 81), # 第一腿合约编码
+ ('SecondLegInstrumentID', ctypes.c_char * 81), # 第二腿合约编码
+ ]
+
+ def __init__(self, BrokerID: str = '', InvestorID: str = '', ExchangeID: str = '', OrderSysID: str = '',
+ FirstLegInstrumentID: str = '', SecondLegInstrumentID: str = ''):
+ super(QrySpdApplyField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.FirstLegInstrumentID = self._to_bytes(FirstLegInstrumentID)
+ self.SecondLegInstrumentID = self._to_bytes(SecondLegInstrumentID)
+
+
+class QryHedgeCfmField(Base):
+ """套利套保申请查询"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('OrderSysID', ctypes.c_char * 21), # 报单编号
+ ('InstrumentID', ctypes.c_char * 81), # 合约代码
+ ]
+
+ def __init__(self, BrokerID: str = '', InvestorID: str = '', ExchangeID: str = '', OrderSysID: str = '',
+ InstrumentID: str = ''):
+ super(QryHedgeCfmField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.InstrumentID = self._to_bytes(InstrumentID)
+
+
+class InputSpdApplyActionField(Base):
+ """套利申请撤销"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('OrderSysID', ctypes.c_char * 21), # 合同编号
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('FrontID', ctypes.c_int), # 前置编号
+ ('SessionID', ctypes.c_int), # 会话编号
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', InvestorID: str = '', ExchangeID: str = '',
+ OrderSysID: str = '', OrderRef: str = '', FrontID: int = 0, SessionID: int = 0, RequestID: int = 0,
+ IPAddress: str = '', MacAddress: str = ''):
+ super(InputSpdApplyActionField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.FrontID = int(FrontID)
+ self.SessionID = int(SessionID)
+ self.RequestID = int(RequestID)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+
+
+class InputHedgeCfmActionField(Base):
+ """套保申请撤销"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('OrderSysID', ctypes.c_char * 21), # 合同编号
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('FrontID', ctypes.c_int), # 前置编号
+ ('SessionID', ctypes.c_int), # 会话编号
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ]
+
+ def __init__(self, BrokerID: str = '', UserID: str = '', InvestorID: str = '', ExchangeID: str = '',
+ OrderSysID: str = '', OrderRef: str = '', FrontID: int = 0, SessionID: int = 0, RequestID: int = 0,
+ IPAddress: str = '', MacAddress: str = ''):
+ super(InputHedgeCfmActionField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.UserID = self._to_bytes(UserID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.FrontID = int(FrontID)
+ self.SessionID = int(SessionID)
+ self.RequestID = int(RequestID)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+
+
+class SpdApplyActionField(Base):
+ """套利申请撤销回报"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ActionDate', ctypes.c_char * 9), # 操作日期
+ ('ActionTime', ctypes.c_char * 9), # 操作时间
+ ('TraderID', ctypes.c_char * 21), # 交易所交易员代码
+ ('InstallID', ctypes.c_int), # 安装编号
+ ('OrderLocalID', ctypes.c_char * 13), # 本地报单编号
+ ('ActionLocalID', ctypes.c_char * 13), # 操作本地编号
+ ('ParticipantID', ctypes.c_char * 11), # 会员代码
+ ('ClientID', ctypes.c_char * 11), # 客户代码
+ ('OrderActionStatus', ctypes.c_char), # 报单操作状态
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('OrderSysID', ctypes.c_char * 21), # 合同编号
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('StatusMsg', ctypes.c_char * 81), # 状态信息
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('FrontID', ctypes.c_int), # 前置编号
+ ('SessionID', ctypes.c_int), # 会话编号
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ]
+
+ def __init__(self, BrokerID: str = '', InvestorID: str = '', ActionDate: str = '', ActionTime: str = '',
+ TraderID: str = '', InstallID: int = 0, OrderLocalID: str = '', ActionLocalID: str = '',
+ ParticipantID: str = '', ClientID: str = '', OrderActionStatus: str = '', UserID: str = '',
+ ExchangeID: str = '', OrderSysID: str = '', RequestID: int = 0, StatusMsg: str = '',
+ OrderRef: str = '', FrontID: int = 0, SessionID: int = 0, IPAddress: str = '', MacAddress: str = ''):
+ super(SpdApplyActionField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ActionDate = self._to_bytes(ActionDate)
+ self.ActionTime = self._to_bytes(ActionTime)
+ self.TraderID = self._to_bytes(TraderID)
+ self.InstallID = int(InstallID)
+ self.OrderLocalID = self._to_bytes(OrderLocalID)
+ self.ActionLocalID = self._to_bytes(ActionLocalID)
+ self.ParticipantID = self._to_bytes(ParticipantID)
+ self.ClientID = self._to_bytes(ClientID)
+ self.OrderActionStatus = self._to_bytes(OrderActionStatus)
+ self.UserID = self._to_bytes(UserID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.RequestID = int(RequestID)
+ self.StatusMsg = self._to_bytes(StatusMsg)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.FrontID = int(FrontID)
+ self.SessionID = int(SessionID)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+
+
+class HedgeCfmActionField(Base):
+ """套保申请撤销回报"""
+ _fields_ = [
+ ('BrokerID', ctypes.c_char * 11), # 经纪公司代码
+ ('InvestorID', ctypes.c_char * 13), # 投资者代码
+ ('ActionDate', ctypes.c_char * 9), # 操作日期
+ ('ActionTime', ctypes.c_char * 9), # 操作时间
+ ('TraderID', ctypes.c_char * 21), # 交易所交易员代码
+ ('InstallID', ctypes.c_int), # 安装编号
+ ('OrderLocalID', ctypes.c_char * 13), # 本地报单编号
+ ('ActionLocalID', ctypes.c_char * 13), # 操作本地编号
+ ('ParticipantID', ctypes.c_char * 11), # 会员代码
+ ('ClientID', ctypes.c_char * 11), # 客户代码
+ ('OrderActionStatus', ctypes.c_char), # 报单操作状态
+ ('UserID', ctypes.c_char * 16), # 用户代码
+ ('ExchangeID', ctypes.c_char * 9), # 交易所代码
+ ('OrderSysID', ctypes.c_char * 21), # 合同编号
+ ('RequestID', ctypes.c_int), # 请求编号
+ ('StatusMsg', ctypes.c_char * 81), # 状态信息
+ ('OrderRef', ctypes.c_char * 13), # 报单引用
+ ('FrontID', ctypes.c_int), # 前置编号
+ ('SessionID', ctypes.c_int), # 会话编号
+ ('IPAddress', ctypes.c_char * 33), # IP地址
+ ('MacAddress', ctypes.c_char * 21), # Mac地址
+ ]
+
+ def __init__(self, BrokerID: str = '', InvestorID: str = '', ActionDate: str = '', ActionTime: str = '',
+ TraderID: str = '', InstallID: int = 0, OrderLocalID: str = '', ActionLocalID: str = '',
+ ParticipantID: str = '', ClientID: str = '', OrderActionStatus: str = '', UserID: str = '',
+ ExchangeID: str = '', OrderSysID: str = '', RequestID: int = 0, StatusMsg: str = '',
+ OrderRef: str = '', FrontID: int = 0, SessionID: int = 0, IPAddress: str = '', MacAddress: str = ''):
+ super(HedgeCfmActionField, self).__init__()
+ self.BrokerID = self._to_bytes(BrokerID)
+ self.InvestorID = self._to_bytes(InvestorID)
+ self.ActionDate = self._to_bytes(ActionDate)
+ self.ActionTime = self._to_bytes(ActionTime)
+ self.TraderID = self._to_bytes(TraderID)
+ self.InstallID = int(InstallID)
+ self.OrderLocalID = self._to_bytes(OrderLocalID)
+ self.ActionLocalID = self._to_bytes(ActionLocalID)
+ self.ParticipantID = self._to_bytes(ParticipantID)
+ self.ClientID = self._to_bytes(ClientID)
+ self.OrderActionStatus = self._to_bytes(OrderActionStatus)
+ self.UserID = self._to_bytes(UserID)
+ self.ExchangeID = self._to_bytes(ExchangeID)
+ self.OrderSysID = self._to_bytes(OrderSysID)
+ self.RequestID = int(RequestID)
+ self.StatusMsg = self._to_bytes(StatusMsg)
+ self.OrderRef = self._to_bytes(OrderRef)
+ self.FrontID = int(FrontID)
+ self.SessionID = int(SessionID)
+ self.IPAddress = self._to_bytes(IPAddress)
+ self.MacAddress = self._to_bytes(MacAddress)
+
+
class FrontInfoField(Base):
"""前置信息"""
_fields_ = [
diff --git a/ctpwrapper/Md.py b/ctpwrapper/Md.py
index 8c1e99e..cf5c8d2 100644
--- a/ctpwrapper/Md.py
+++ b/ctpwrapper/Md.py
@@ -29,14 +29,15 @@ class MdApiPy(MdApiWrapper):
def Create(self, pszFlowPath: Optional[str] = "",
bIsUsingUdp: Optional[bool] = False,
- bIsMulticast: Optional[bool] = False) -> None:
+ bIsMulticast: Optional[bool] = False,
+ bIsProductionMode: Optional[bool] = True) -> None:
"""
创建MdApi
:param pszFlowPath: 存贮订阅信息文件的目录,默认为当前目录
:param bIsUsingUdp:
:param bIsMulticast:
"""
- super(MdApiPy, self).Create(pszFlowPath.encode(), bIsUsingUdp, bIsMulticast)
+ super(MdApiPy, self).Create(pszFlowPath.encode(), bIsUsingUdp, bIsMulticast, bIsProductionMode)
def Init(self) -> None:
"""
diff --git a/ctpwrapper/MdApi.pyx b/ctpwrapper/MdApi.pyx
index 6d486f1..be2c30e 100644
--- a/ctpwrapper/MdApi.pyx
+++ b/ctpwrapper/MdApi.pyx
@@ -65,10 +65,10 @@ cdef class MdApiWrapper:
self._api = NULL
self._spi = NULL
- def Create(self, const_char *pszFlowPath, cbool bIsUsingUdp, cbool bIsMulticast):
+ def Create(self, const_char *pszFlowPath, cbool bIsUsingUdp, cbool bIsMulticast, cbool bIsProductionMode):
with nogil:
- self._api = CreateFtdcMdApi(pszFlowPath, bIsUsingUdp, bIsMulticast)
+ self._api = CreateFtdcMdApi(pszFlowPath, bIsUsingUdp, bIsMulticast, bIsProductionMode)
if not self._api:
raise MemoryError()
diff --git a/ctpwrapper/Trader.py b/ctpwrapper/Trader.py
index f22c2df..07232fb 100644
--- a/ctpwrapper/Trader.py
+++ b/ctpwrapper/Trader.py
@@ -20,7 +20,7 @@
from typing import Optional
from ctpwrapper.ApiStructure import (
- FensUserInfoField, UserSystemInfoField,
+ FensUserInfoField, UserSystemInfoField, WechatUserSystemInfoField,
ReqAuthenticateField, ReqGenUserCaptchaField,
ReqGenUserTextField, ReqQueryAccountField,
ReqTransferField, QueryCFMMCTradingAccountTokenField,
@@ -52,7 +52,7 @@
QryOrderField, QryTradeField,
QryInvestorPositionField, QryTradingAccountField,
QryInvestorField, QryTradingCodeField,
- QryInstrumentCommissionRateField,
+ QryInstrumentCommissionRateField, QryUserSessionField,
QryExchangeField, QryProductField,
QryInstrumentField, QryDepthMarketDataField,
QrySettlementInfoField, QryTransferBankField,
@@ -74,8 +74,8 @@
class TraderApiPy(TraderApiWrapper):
- def Create(self, pszFlowPath: Optional[str] = "") -> None:
- super(TraderApiPy, self).Create(pszFlowPath.encode())
+ def Create(self, pszFlowPath: Optional[str] = "", bIsProductionMode: bool = True) -> None:
+ super(TraderApiPy, self).Create(pszFlowPath.encode(), bIsProductionMode)
def Release(self) -> None:
super(TraderApiPy, self).Release()
@@ -135,7 +135,7 @@ def RegisterFensUserInfo(self, pFensUserInfo: "FensUserInfoField") -> None:
"""
super(TraderApiPy, self).RegisterFensUserInfo(pFensUserInfo)
- def SubscribePrivateTopic(self, nResumeType: int) -> None:
+ def SubscribePrivateTopic(self, nResumeType: int, nSeqNo: int) -> None:
"""
订阅私有流。
:param nResumeType: 私有流重传方式
@@ -161,6 +161,18 @@ def SubmitUserSystemInfo(self, pUserSystemInfo: "UserSystemInfoField") -> None:
"""
super(TraderApiPy, self).SubmitUserSystemInfo(pUserSystemInfo)
+ def RegisterWechatUserSystemInfo(self, pUserSystemInfo: "WechatUserSystemInfoField") -> None:
+ """
+ 注册用户终端信息,用于中继服务器多连接模式.用于微信小程序等应用上报信息.
+ """
+ super(TraderApiPy, self).RegisterWechatUserSystemInfo(pUserSystemInfo)
+
+ def SubmitWechatUserSystemInfo(self, pUserSystemInfo: "WechatUserSystemInfoField") -> None:
+ """
+ 上报用户终端信息,用于中继服务器操作员登录模式.用于微信小程序等应用上报信息.
+ """
+ super(TraderApiPy, self).SubmitWechatUserSystemInfo(pUserSystemInfo)
+
def SubscribePublicTopic(self, nResumeType: int) -> None:
"""
订阅公共流。
@@ -391,6 +403,12 @@ def ReqQryInstrumentCommissionRate(self, pQryInstrumentCommissionRate: "QryInstr
"""
return super(TraderApiPy, self).ReqQryInstrumentCommissionRate(pQryInstrumentCommissionRate, nRequestID)
+ def ReqQryUserSession(self, pQryUserSession: "QryUserSessionField", nRequestID: int) -> int:
+ """
+ 请求查询用户会话
+ """
+ return super(TraderApiPy, self).ReqQryUserSession(pQryUserSession, nRequestID)
+
def ReqQryExchange(self, pQryExchange: "QryExchangeField", nRequestID: int) -> int:
"""
请求查询交易所
@@ -811,6 +829,34 @@ def ReqCancelOffsetSetting(self, pInputOffsetSetting: "InputOffsetSettingField",
def ReqQryOffsetSetting(self, pQryOffsetSetting: "QryOffsetSettingField", nRequestID: int) -> int:
return super(TraderApiPy, self).ReqQryOffsetSetting(pQryOffsetSetting, nRequestID)
+ # 申请短信验证码请求
+ def ReqGenSMSCode(self, pReqGenSMSCode: "ReqGenSMSCodeField", nRequestID: int) -> int:
+ return super(TraderApiPy, self).ReqGenSMSCode(pReqGenSMSCode, nRequestID)
+
+ # 套利确认请求
+ def ReqSpdApply(self, pInputSpdApply: "InputSpdApplyField", nRequestID: int) -> int:
+ return super(TraderApiPy, self).ReqSpdApply(pInputSpdApply, nRequestID)
+
+ # 套利确认撤销请求
+ def ReqSpdApplyAction(self, pInputSpdApplyAction: "InputSpdApplyActionField", nRequestID: int) -> int:
+ return super(TraderApiPy, self).ReqSpdApplyAction(pInputSpdApplyAction, nRequestID)
+
+ # 套利确认查询请求
+ def ReqQrySpdApply(self, pQrySpdApply: "QrySpdApplyField", nRequestID: int) -> int:
+ return super(TraderApiPy, self).ReqQrySpdApply(pQrySpdApply, nRequestID)
+
+ # 套保确认请求
+ def ReqHedgeCfm(self, pInputHedgeCfm: "InputHedgeCfmField", nRequestID: int) -> int:
+ return super(TraderApiPy, self).ReqHedgeCfm(pInputHedgeCfm, nRequestID)
+
+ # 套保确认撤销请求
+ def ReqHedgeCfmAction(self, pInputHedgeCfmAction: "InputHedgeCfmActionField", nRequestID: int) -> int:
+ return super(TraderApiPy, self).ReqHedgeCfmAction(pInputHedgeCfmAction, nRequestID)
+
+ # 套保确认查询请求
+ def ReqQryHedgeCfm(self, pQryHedgeCfm: "QryHedgeCfmField", nRequestID: int) -> int:
+ return super(TraderApiPy, self).ReqQryHedgeCfm(pQryHedgeCfm, nRequestID)
+
def OnFrontConnected(self) -> None:
pass
@@ -833,6 +879,11 @@ def OnHeartBeatWarning(self, nTimeLapse) -> None:
def OnRspAuthenticate(self, pRspAuthenticateField, pRspInfo, nRequestID, bIsLast) -> None:
pass
+ # 该方法在处理私有流之前被调用
+ # @param nSeqNo 即将被处理的私有流的序号
+ def OnRtnPrivateSeqNo(self, nSeqNo) -> None:
+ pass
+
# 登录请求响应
def OnRspUserLogin(self, pRspUserLogin, pRspInfo, nRequestID, bIsLast) -> None:
pass
@@ -941,6 +992,10 @@ def OnRspQryInstrumentMarginRate(self, pInstrumentMarginRate, pRspInfo, nRequest
def OnRspQryInstrumentCommissionRate(self, pInstrumentCommissionRate, pRspInfo, nRequestID, bIsLast) -> None:
pass
+ # 请求查询用户会话响应
+ def OnRspQryUserSession(self, pUserSession, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
# 请求查询交易所响应
def OnRspQryExchange(self, pExchange, pRspInfo, nRequestID, bIsLast) -> None:
pass
@@ -1464,3 +1519,55 @@ def OnErrRtnCancelOffsetSetting(self, pCancelOffsetSetting, pRspInfo) -> None:
# 投资者对冲设置查询响应
def OnRspQryOffsetSetting(self, pOffsetSetting, pRspInfo, nRequestID, bIsLast) -> None:
pass
+
+ # 申请短信验证码响应
+ def OnRspGenSMSCode(self, pRspGenSMSCode, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
+ # 套利确认回复
+ def OnRspSpdApply(self, pInputSpdApply, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
+ # 套利确认撤销回复
+ def OnRspSpdApplyAction(self, pInputSpdApplyAction, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
+ # 套利确认查询回复
+ def OnRspQrySpdApply(self, pSpdApply, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
+ # 套利确认通知
+ def OnRtnSpdApply(self, pSpdApply) -> None:
+ pass
+
+ # 套利申请录入错误回报
+ def OnErrRtnSpdApply(self, pInputSpdApply, pRspInfo) -> None:
+ pass
+
+ # 套利确认撤销通知
+ def OnErrRtnSpdApplyAction(self, pSpdApplyAction, pRspInfo) -> None:
+ pass
+
+ # 套保确认回复
+ def OnRspHedgeCfm(self, pInputHedgeCfm, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
+ # 套保确认撤销回复
+ def OnRspHedgeCfmAction(self, pInputHedgeCfmAction, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
+ # 套保确认查询回复
+ def OnRspQryHedgeCfm(self, pHedgeCfm, pRspInfo, nRequestID, bIsLast) -> None:
+ pass
+
+ # 套保确认通知
+ def OnRtnHedgeCfm(self, pHedgeCfm) -> None:
+ pass
+
+ # 套保额度录入错误回报
+ def OnErrRtnHedgeCfm(self, pInputHedgeCfm, pRspInfo) -> None:
+ pass
+
+ # 套保确认撤销通知
+ def OnErrRtnHedgeCfmAction(self, pHedgeCfmAction, pRspInfo) -> None:
+ pass
diff --git a/ctpwrapper/TraderApi.pyx b/ctpwrapper/TraderApi.pyx
index 9224ccd..c673a9a 100644
--- a/ctpwrapper/TraderApi.pyx
+++ b/ctpwrapper/TraderApi.pyx
@@ -40,9 +40,9 @@ cdef class TraderApiWrapper:
def __dealloc__(self):
self.Release()
- def Create(self, const_char *pszFlowPath):
+ def Create(self, const_char *pszFlowPath, cbool bIsProductionMode):
- self._api = CreateFtdcTraderApi(pszFlowPath)
+ self._api = CreateFtdcTraderApi(pszFlowPath, bIsProductionMode)
if not self._api:
raise MemoryError()
@@ -111,10 +111,10 @@ cdef class TraderApiWrapper:
with nogil:
self._api.RegisterFensUserInfo( address)
- def SubscribePrivateTopic(self, THOST_TE_RESUME_TYPE nResumeType):
+ def SubscribePrivateTopic(self, THOST_TE_RESUME_TYPE nResumeType, int nSeqNo=1):
if self._api is not NULL:
with nogil:
- self._api.SubscribePrivateTopic(nResumeType)
+ self._api.SubscribePrivateTopic(nResumeType, nSeqNo)
#订阅公共流。
#@param nResumeType 公共流重传方式
# THOST_TERT_RESTART:从本交易日开始重传
@@ -158,6 +158,26 @@ cdef class TraderApiWrapper:
result = self._api.SubmitUserSystemInfo( address)
return result
+ # 注册用户终端信息,用于中继服务器多连接模式.用于微信小程序等应用上报信息.
+ def RegisterWechatUserSystemInfo(self, pUserSystemInfo):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pUserSystemInfo)
+ with nogil:
+ result = self._api.RegisterWechatUserSystemInfo( address)
+ return result
+
+ # 上报用户终端信息,用于中继服务器操作员登录模式.用于微信小程序等应用上报信息.
+ def SubmitWechatUserSystemInfo(self, pUserSystemInfo):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pUserSystemInfo)
+ with nogil:
+ result = self._api.SubmitWechatUserSystemInfo( address)
+ return result
+
# 用户登录请求
def ReqUserLogin(self, pReqUserLoginField, int nRequestID):
cdef int result
@@ -499,6 +519,15 @@ cdef class TraderApiWrapper:
with nogil:
result = self._api.ReqQryInstrumentCommissionRate( address, nRequestID)
return result
+ # 请求查询用户会话
+ def ReqQryUserSession(self, pQryUserSession, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._spi is not NULL:
+ address = ctypes.addressof(pQryUserSession)
+ with nogil:
+ result = self._api.ReqQryUserSession( address, nRequestID)
+ return result
# 请求查询交易所
def ReqQryExchange(self, pQryExchange, int nRequestID):
cdef int result
@@ -1247,6 +1276,76 @@ cdef class TraderApiWrapper:
result = self._api.ReqQryOffsetSetting( address, nRequestID)
return result
+ # 申请短信验证码请求
+ def ReqGenSMSCode(self, pReqGenSMSCode, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pReqGenSMSCode)
+ with nogil:
+ result = self._api.ReqGenSMSCode( address, nRequestID)
+ return result
+
+ # 套利确认请求
+ def ReqSpdApply(self, pInputSpdApply, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pInputSpdApply)
+ with nogil:
+ result = self._api.ReqSpdApply( address, nRequestID)
+ return result
+
+ # 套利确认撤销请求
+ def ReqSpdApplyAction(self, pInputSpdApplyAction, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pInputSpdApplyAction)
+ with nogil:
+ result = self._api.ReqSpdApplyAction( address, nRequestID)
+ return result
+
+ # 套利确认查询请求
+ def ReqQrySpdApply(self, pQrySpdApply, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pQrySpdApply)
+ with nogil:
+ result = self._api.ReqQrySpdApply( address, nRequestID)
+ return result
+
+ # 套保确认请求
+ def ReqHedgeCfm(self, pInputHedgeCfm, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pInputHedgeCfm)
+ with nogil:
+ result = self._api.ReqHedgeCfm( address, nRequestID)
+ return result
+
+ # 套保确认撤销请求
+ def ReqHedgeCfmAction(self, pInputHedgeCfmAction, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pInputHedgeCfmAction)
+ with nogil:
+ result = self._api.ReqHedgeCfmAction( address, nRequestID)
+ return result
+
+ # 套保确认查询请求
+ def ReqQryHedgeCfm(self, pQryHedgeCfm, int nRequestID):
+ cdef int result
+ cdef size_t address
+ if self._api is not NULL:
+ address = ctypes.addressof(pQryHedgeCfm)
+ with nogil:
+ result = self._api.ReqQryHedgeCfm( address, nRequestID)
+ return result
+
cdef extern int TraderSpi_OnFrontConnected(self) except -1:
self.OnFrontConnected()
return 0
@@ -1272,6 +1371,10 @@ cdef extern int TraderSpi_OnRspAuthenticate(self,
)
return 0
+cdef extern int TraderSpi_OnRtnPrivateSeqNo(self, int nSeqNo) except -1:
+ self.OnRtnPrivateSeqNo(nSeqNo)
+ return 0
+
cdef extern int TraderSpi_OnRspUserLogin(self,
CThostFtdcRspUserLoginField *pRspUserLogin,
CThostFtdcRspInfoField *pRspInfo,
@@ -1610,6 +1713,19 @@ cdef extern int TraderSpi_OnRspQryInstrumentCommissionRate(self,
)
return 0
+cdef extern int TraderSpi_OnRspQryUserSession(self,
+ CThostFtdcUserSessionField *pUserSession,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspQryUserSession(
+ None if pUserSession is NULL else ApiStructure.UserSessionField.from_address( pUserSession),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
cdef extern int TraderSpi_OnRspQryExchange(self,
CThostFtdcExchangeField *pExchange,
CThostFtdcRspInfoField *pRspInfo,
@@ -3104,4 +3220,158 @@ cdef extern int TraderSpi_OnRspQryOffsetSetting(self,
nRequestID,
bIsLast
)
+ return 0
+
+# 申请短信验证码响应
+cdef extern int TraderSpi_OnRspGenSMSCode(self,
+ CThostFtdcRspGenSMSCodeField *pRspGenSMSCode,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspGenSMSCode(
+ None if pRspGenSMSCode is NULL else ApiStructure.RspGenSMSCodeField.from_address( pRspGenSMSCode),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
+# 套利确认回复
+cdef extern int TraderSpi_OnRspSpdApply(self,
+ CThostFtdcInputSpdApplyField *pInputSpdApply,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspSpdApply(
+ None if pInputSpdApply is NULL else ApiStructure.InputSpdApplyField.from_address( pInputSpdApply),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
+# 套利确认撤销回复
+cdef extern int TraderSpi_OnRspSpdApplyAction(self,
+ CThostFtdcInputSpdApplyActionField *pInputSpdApplyAction,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspSpdApplyAction(
+ None if pInputSpdApplyAction is NULL else ApiStructure.InputSpdApplyActionField.from_address( pInputSpdApplyAction),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
+# 套利确认查询回复
+cdef extern int TraderSpi_OnRspQrySpdApply(self,
+ CThostFtdcSpdApplyField *pSpdApply,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspQrySpdApply(
+ None if pSpdApply is NULL else ApiStructure.SpdApplyField.from_address( pSpdApply),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
+# 套利确认通知
+cdef extern int TraderSpi_OnRtnSpdApply(self,
+ CThostFtdcSpdApplyField *pSpdApply) except -1:
+ self.OnRtnSpdApply(
+ None if pSpdApply is NULL else ApiStructure.SpdApplyField.from_address( pSpdApply)
+ )
+ return 0
+
+# 套利申请录入错误回报
+cdef extern int TraderSpi_OnErrRtnSpdApply(self,
+ CThostFtdcInputSpdApplyField *pInputSpdApply,
+ CThostFtdcRspInfoField *pRspInfo) except -1:
+ self.OnErrRtnSpdApply(
+ None if pInputSpdApply is NULL else ApiStructure.InputSpdApplyField.from_address( pInputSpdApply),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ )
+ return 0
+
+# 套利确认撤销通知
+cdef extern int TraderSpi_OnErrRtnSpdApplyAction(self,
+ CThostFtdcSpdApplyActionField *pSpdApplyAction,
+ CThostFtdcRspInfoField *pRspInfo) except -1:
+ self.OnErrRtnSpdApplyAction(
+ None if pSpdApplyAction is NULL else ApiStructure.SpdApplyActionField.from_address( pSpdApplyAction),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ )
+ return 0
+
+# 套保确认回复
+cdef extern int TraderSpi_OnRspHedgeCfm(self,
+ CThostFtdcInputHedgeCfmField *pInputHedgeCfm,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspHedgeCfm(
+ None if pInputHedgeCfm is NULL else ApiStructure.InputHedgeCfmField.from_address( pInputHedgeCfm),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
+# 套保确认撤销回复
+cdef extern int TraderSpi_OnRspHedgeCfmAction(self,
+ CThostFtdcInputHedgeCfmActionField *pInputHedgeCfmAction,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspHedgeCfmAction(
+ None if pInputHedgeCfmAction is NULL else ApiStructure.InputHedgeCfmActionField.from_address( pInputHedgeCfmAction),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
+# 套保确认查询回复
+cdef extern int TraderSpi_OnRspQryHedgeCfm(self,
+ CThostFtdcHedgeCfmField *pHedgeCfm,
+ CThostFtdcRspInfoField *pRspInfo,
+ int nRequestID,
+ cbool bIsLast) except -1:
+ self.OnRspQryHedgeCfm(
+ None if pHedgeCfm is NULL else ApiStructure.HedgeCfmField.from_address( pHedgeCfm),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ nRequestID,
+ bIsLast
+ )
+ return 0
+
+# 套保确认通知
+cdef extern int TraderSpi_OnRtnHedgeCfm(self,
+ CThostFtdcHedgeCfmField *pHedgeCfm) except -1:
+ self.OnRtnHedgeCfm(
+ None if pHedgeCfm is NULL else ApiStructure.HedgeCfmField.from_address( pHedgeCfm)
+ )
+ return 0
+
+# 套保额度录入错误回报
+cdef extern int TraderSpi_OnErrRtnHedgeCfm(self,
+ CThostFtdcInputHedgeCfmField *pInputHedgeCfm,
+ CThostFtdcRspInfoField *pRspInfo) except -1:
+ self.OnErrRtnHedgeCfm(
+ None if pInputHedgeCfm is NULL else ApiStructure.InputHedgeCfmField.from_address( pInputHedgeCfm),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ )
+ return 0
+
+# 套保确认撤销通知
+cdef extern int TraderSpi_OnErrRtnHedgeCfmAction(self,
+ CThostFtdcHedgeCfmActionField *pHedgeCfmAction,
+ CThostFtdcRspInfoField *pRspInfo) except -1:
+ self.OnErrRtnHedgeCfmAction(
+ None if pHedgeCfmAction is NULL else ApiStructure.HedgeCfmActionField.from_address( pHedgeCfmAction),
+ None if pRspInfo is NULL else ApiStructure.RspInfoField.from_address( pRspInfo),
+ )
return 0
\ No newline at end of file
diff --git a/ctpwrapper/__init__.py b/ctpwrapper/__init__.py
index d7ca207..50ec9cb 100644
--- a/ctpwrapper/__init__.py
+++ b/ctpwrapper/__init__.py
@@ -16,7 +16,7 @@
along with ctpwrapper. If not, see .
"""
-__version__ = "6.7.9"
+__version__ = "6.7.13"
from ctpwrapper.Md import MdApiPy
from ctpwrapper.Trader import TraderApiPy
diff --git a/ctpwrapper/base.py b/ctpwrapper/base.py
index c4ef72b..9ed679b 100644
--- a/ctpwrapper/base.py
+++ b/ctpwrapper/base.py
@@ -36,7 +36,7 @@ def __getattribute__(self, item):
else:
return value
- def _to_bytes(self, value):
+ def _to_bytes(self, value) -> bytes:
"""
:return:
"""
diff --git a/ctpwrapper/cppheader/CTraderAPI.h b/ctpwrapper/cppheader/CTraderAPI.h
index 8545d75..0de56be 100644
--- a/ctpwrapper/cppheader/CTraderAPI.h
+++ b/ctpwrapper/cppheader/CTraderAPI.h
@@ -31,6 +31,8 @@ static inline int TraderSpi_OnHeartBeatWarning(PyObject *, int);
static inline int TraderSpi_OnRspAuthenticate(PyObject *, CThostFtdcRspAuthenticateField *, CThostFtdcRspInfoField *, int, bool);
+static inline int TraderSpi_OnRtnPrivateSeqNo(PyObject *, int);
+
static inline int TraderSpi_OnRspUserLogin(PyObject *, CThostFtdcRspUserLoginField *, CThostFtdcRspInfoField *, int, bool);
static inline int TraderSpi_OnRspUserLogout(PyObject *, CThostFtdcUserLogoutField *, CThostFtdcRspInfoField *, int, bool);
@@ -83,6 +85,8 @@ static inline int TraderSpi_OnRspQryInstrumentMarginRate(PyObject *, CThostFtdcI
static inline int TraderSpi_OnRspQryInstrumentCommissionRate(PyObject *, CThostFtdcInstrumentCommissionRateField *, CThostFtdcRspInfoField *, int, bool);
+static inline int TraderSpi_OnRspQryUserSession(PyObject *, CThostFtdcUserSessionField *, CThostFtdcRspInfoField *, int, bool);
+
static inline int TraderSpi_OnRspQryExchange(PyObject *, CThostFtdcExchangeField *, CThostFtdcRspInfoField *, int, bool);
static inline int TraderSpi_OnRspQryProduct(PyObject *, CThostFtdcProductField *, CThostFtdcRspInfoField *, int, bool);
@@ -387,6 +391,45 @@ static inline int TraderSpi_OnErrRtnCancelOffsetSetting(PyObject *, CThostFtdcCa
///投资者对冲设置查询响应
static inline int TraderSpi_OnRspQryOffsetSetting(PyObject *, CThostFtdcOffsetSettingField *, CThostFtdcRspInfoField *, int, bool);
+///申请短信验证码响应
+static inline int TraderSpi_OnRspGenSMSCode(PyObject *, CThostFtdcRspGenSMSCodeField *, CThostFtdcRspInfoField *, int, bool);
+
+///套利确认回复
+static inline int TraderSpi_OnRspSpdApply(PyObject *, CThostFtdcInputSpdApplyField *, CThostFtdcRspInfoField *, int, bool);
+
+///套利确认撤销回复
+static inline int TraderSpi_OnRspSpdApplyAction(PyObject *, CThostFtdcInputSpdApplyActionField *, CThostFtdcRspInfoField *, int, bool);
+
+///套利确认查询回复
+static inline int TraderSpi_OnRspQrySpdApply(PyObject *, CThostFtdcSpdApplyField *, CThostFtdcRspInfoField *, int, bool);
+
+///套利确认通知
+static inline int TraderSpi_OnRtnSpdApply(PyObject *, CThostFtdcSpdApplyField *);
+
+///套利申请录入错误回报
+static inline int TraderSpi_OnErrRtnSpdApply(PyObject *, CThostFtdcInputSpdApplyField *, CThostFtdcRspInfoField *);
+
+///套利确认撤销通知
+static inline int TraderSpi_OnErrRtnSpdApplyAction(PyObject *, CThostFtdcSpdApplyActionField *, CThostFtdcRspInfoField *);
+
+///套保确认回复
+static inline int TraderSpi_OnRspHedgeCfm(PyObject *, CThostFtdcInputHedgeCfmField *, CThostFtdcRspInfoField *, int, bool);
+
+///套保确认撤销回复
+static inline int TraderSpi_OnRspHedgeCfmAction(PyObject *, CThostFtdcInputHedgeCfmActionField *, CThostFtdcRspInfoField *, int, bool);
+
+///套保确认查询回复
+static inline int TraderSpi_OnRspQryHedgeCfm(PyObject *, CThostFtdcHedgeCfmField *, CThostFtdcRspInfoField *, int, bool);
+
+///套保确认通知
+static inline int TraderSpi_OnRtnHedgeCfm(PyObject *, CThostFtdcHedgeCfmField *);
+
+///套保额度录入错误回报
+static inline int TraderSpi_OnErrRtnHedgeCfm(PyObject *, CThostFtdcInputHedgeCfmField *, CThostFtdcRspInfoField *);
+
+///套保确认撤销通知
+static inline int TraderSpi_OnErrRtnHedgeCfmAction(PyObject *, CThostFtdcHedgeCfmActionField *, CThostFtdcRspInfoField *);
+
#define Python_GIL(func) \
do { \
PyGILState_STATE gil_state = PyGILState_Ensure(); \
@@ -429,6 +472,11 @@ class CTraderSpi : public CThostFtdcTraderSpi {
Python_GIL(TraderSpi_OnRspAuthenticate(self, pRspAuthenticateField, pRspInfo, nRequestID, bIsLast));
};
+ ///该方法在处理私有流之前被调用
+ ///@param nSeqNo 即将被处理的私有流的序号
+ virtual void OnRtnPrivateSeqNo(int nSeqNo) {
+ Python_GIL(TraderSpi_OnRtnPrivateSeqNo(self, nSeqNo));
+ };
///登录请求响应
virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
@@ -575,6 +623,11 @@ class CTraderSpi : public CThostFtdcTraderSpi {
Python_GIL(TraderSpi_OnRspQryInstrumentCommissionRate(self, pInstrumentCommissionRate, pRspInfo, nRequestID, bIsLast));
};
+ ///请求查询用户会话响应
+ virtual void OnRspQryUserSession(CThostFtdcUserSessionField *pUserSession, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspQryUserSession(self, pUserSession, pRspInfo, nRequestID, bIsLast));
+ };
+
///请求查询交易所响应
virtual void OnRspQryExchange(CThostFtdcExchangeField *pExchange, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
Python_GIL(TraderSpi_OnRspQryExchange(self, pExchange, pRspInfo, nRequestID, bIsLast));
@@ -1241,6 +1294,71 @@ class CTraderSpi : public CThostFtdcTraderSpi {
Python_GIL(TraderSpi_OnRspQryOffsetSetting(self, pOffsetSetting, pRspInfo, nRequestID, bIsLast));
};
+ ///申请短信验证码响应
+ virtual void OnRspGenSMSCode(CThostFtdcRspGenSMSCodeField *pRspGenSMSCode, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspGenSMSCode(self, pRspGenSMSCode, pRspInfo, nRequestID, bIsLast));
+ };
+
+ ///套利确认回复
+ virtual void OnRspSpdApply(CThostFtdcInputSpdApplyField *pInputSpdApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspSpdApply(self, pInputSpdApply, pRspInfo, nRequestID, bIsLast));
+ };
+
+ ///套利确认撤销回复
+ virtual void OnRspSpdApplyAction(CThostFtdcInputSpdApplyActionField *pInputSpdApplyAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspSpdApplyAction(self, pInputSpdApplyAction, pRspInfo, nRequestID, bIsLast));
+ };
+
+ ///套利确认查询回复
+ virtual void OnRspQrySpdApply(CThostFtdcSpdApplyField *pSpdApply, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspQrySpdApply(self, pSpdApply, pRspInfo, nRequestID, bIsLast));
+ };
+
+ ///套利确认通知
+ virtual void OnRtnSpdApply(CThostFtdcSpdApplyField *pSpdApply) {
+ Python_GIL(TraderSpi_OnRtnSpdApply(self, pSpdApply));
+ };
+
+ ///套利申请录入错误回报
+ virtual void OnErrRtnSpdApply(CThostFtdcInputSpdApplyField *pInputSpdApply, CThostFtdcRspInfoField *pRspInfo) {
+ Python_GIL(TraderSpi_OnErrRtnSpdApply(self, pInputSpdApply, pRspInfo));
+ };
+
+ ///套利确认撤销通知
+ virtual void OnErrRtnSpdApplyAction(CThostFtdcSpdApplyActionField *pSpdApplyAction, CThostFtdcRspInfoField *pRspInfo) {
+ Python_GIL(TraderSpi_OnErrRtnSpdApplyAction(self, pSpdApplyAction, pRspInfo));
+ };
+
+ ///套保确认回复
+ virtual void OnRspHedgeCfm(CThostFtdcInputHedgeCfmField *pInputHedgeCfm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspHedgeCfm(self, pInputHedgeCfm, pRspInfo, nRequestID, bIsLast));
+ };
+
+ ///套保确认撤销回复
+ virtual void OnRspHedgeCfmAction(CThostFtdcInputHedgeCfmActionField *pInputHedgeCfmAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspHedgeCfmAction(self, pInputHedgeCfmAction, pRspInfo, nRequestID, bIsLast));
+ };
+
+ ///套保确认查询回复
+ virtual void OnRspQryHedgeCfm(CThostFtdcHedgeCfmField *pHedgeCfm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {
+ Python_GIL(TraderSpi_OnRspQryHedgeCfm(self, pHedgeCfm, pRspInfo, nRequestID, bIsLast));
+ };
+
+ ///套保确认通知
+ virtual void OnRtnHedgeCfm(CThostFtdcHedgeCfmField *pHedgeCfm) {
+ Python_GIL(TraderSpi_OnRtnHedgeCfm(self, pHedgeCfm));
+ };
+
+ ///套保额度录入错误回报
+ virtual void OnErrRtnHedgeCfm(CThostFtdcInputHedgeCfmField *pInputHedgeCfm, CThostFtdcRspInfoField *pRspInfo) {
+ Python_GIL(TraderSpi_OnErrRtnHedgeCfm(self, pInputHedgeCfm, pRspInfo));
+ };
+
+ ///套保确认撤销通知
+ virtual void OnErrRtnHedgeCfmAction(CThostFtdcHedgeCfmActionField *pHedgeCfmAction, CThostFtdcRspInfoField *pRspInfo) {
+ Python_GIL(TraderSpi_OnErrRtnHedgeCfmAction(self, pHedgeCfmAction, pRspInfo));
+ };
+
private:
PyObject *self;
diff --git a/ctpwrapper/headers/ThostFtdcUserApiDataType.pxd b/ctpwrapper/headers/ThostFtdcUserApiDataType.pxd
index e8e2a92..99e09bd 100644
--- a/ctpwrapper/headers/ThostFtdcUserApiDataType.pxd
+++ b/ctpwrapper/headers/ThostFtdcUserApiDataType.pxd
@@ -45,6 +45,7 @@ cdef extern from 'ThostFtdcUserApiDataType.h':
ctypedef char TThostFtdcExchangeAbbrType[9]
ctypedef char TThostFtdcExchangeFlagType[2]
ctypedef char TThostFtdcMacAddressType[21]
+ ctypedef char TThostFtdcDeviceTagType[41]
ctypedef char TThostFtdcSystemIDType[21]
ctypedef char TThostFtdcClientLoginRemarkType[151]
ctypedef char TThostFtdcExchangePropertyType
@@ -859,3 +860,10 @@ cdef extern from 'ThostFtdcUserApiDataType.h':
ctypedef char TThostFtdcOffsetTypeType
ctypedef char TThostFtdcSiteType[51]
ctypedef char TThostFtdcNetOperatorType[9]
+ ctypedef char TThostFtdcApplySrcType
+ ctypedef char TThostFtdcReserveInfoType[65]
+ ctypedef char TThostFtdcApplyStatusType
+ ctypedef char TThostFtdcCmbTypeType
+ ctypedef char TThostFtdcSMSCodeType[17]
+ ctypedef char TThostFtdcSMSContentType[129]
+ ctypedef char TThostFtdcSMSPhoneType[17]
diff --git a/ctpwrapper/headers/ThostFtdcUserApiStruct.pxd b/ctpwrapper/headers/ThostFtdcUserApiStruct.pxd
index 0c5f469..0b77646 100644
--- a/ctpwrapper/headers/ThostFtdcUserApiStruct.pxd
+++ b/ctpwrapper/headers/ThostFtdcUserApiStruct.pxd
@@ -16,7 +16,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ctpwrapper. If not, see .
"""
-
from .ThostFtdcUserApiDataType cimport *
@@ -38,6 +37,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcLoginRemarkType LoginRemark
TThostFtdcIPPortType ClientIPPort
TThostFtdcIPAddressType ClientIPAddress
+ TThostFtdcSMSCodeType SMSCode
cdef struct CThostFtdcRspUserLoginField:
TThostFtdcDateType TradingDay
TThostFtdcTimeType LoginTime
@@ -56,6 +56,8 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcTimeType GFEXTime
TThostFtdcDRIdentityIDType LoginDRIdentityID
TThostFtdcDRIdentityIDType UserDRIdentityID
+ TThostFtdcDateTimeType LastLoginTime
+ TThostFtdcReserveInfoType ReserveInfo
cdef struct CThostFtdcUserLogoutField:
TThostFtdcBrokerIDType BrokerID
TThostFtdcUserIDType UserID
@@ -344,6 +346,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcBizTypeType BizType
TThostFtdcMoneyType FrozenSwap
TThostFtdcMoneyType RemainSwap
+ TThostFtdcMoneyType OptionValue
cdef struct CThostFtdcInvestorPositionField:
TThostFtdcOldInstrumentIDType reserve1
TThostFtdcBrokerIDType BrokerID
@@ -395,6 +398,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcVolumeType TasPosition
TThostFtdcMoneyType TasPositionCost
TThostFtdcInstrumentIDType InstrumentID
+ TThostFtdcMoneyType OptionValue
cdef struct CThostFtdcInstrumentMarginRateField:
TThostFtdcOldInstrumentIDType reserve1
TThostFtdcInvestorRangeType InvestorRange
@@ -1058,6 +1062,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcMoneyType SpecProductExchangeMargin
TThostFtdcMoneyType FrozenSwap
TThostFtdcMoneyType RemainSwap
+ TThostFtdcMoneyType OptionValue
cdef struct CThostFtdcSyncingInvestorPositionField:
TThostFtdcOldInstrumentIDType reserve1
TThostFtdcBrokerIDType BrokerID
@@ -2748,6 +2753,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcBankIDType BankID
TThostFtdcBankBrchIDType BankBrchID
TThostFtdcBankNameType BankName
+ TThostFtdcBankIDType csrcBankID
cdef struct CThostFtdcInvestorPositionCombineDetailField:
TThostFtdcDateType TradingDay
TThostFtdcDateType OpenDate
@@ -4516,6 +4522,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcAppIDType ClientAppID
TThostFtdcIPAddressType ClientPublicIP
TThostFtdcClientLoginRemarkType ClientLoginRemark
+ TThostFtdcDeviceTagType MAC
cdef struct CThostFtdcAuthUserIDField:
TThostFtdcBrokerIDType BrokerID
TThostFtdcAppIDType AppID
@@ -4554,6 +4561,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcLoginRemarkType LoginRemark
TThostFtdcIPPortType ClientIPPort
TThostFtdcIPAddressType ClientIPAddress
+ TThostFtdcSMSCodeType SMSCode
TThostFtdcBrokerNameType BrokerName
TThostFtdcAuthCodeType AuthCode
TThostFtdcAppIDType AppID
@@ -4730,6 +4738,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcMoneyType SpecProductExchangeMargin
TThostFtdcMoneyType FrozenSwap
TThostFtdcMoneyType RemainSwap
+ TThostFtdcMoneyType OptionValue
TThostFtdcSequenceNoType SyncDeltaSequenceNo
cdef struct CThostFtdcSyncDeltaInitInvstMarginField:
TThostFtdcBrokerIDType BrokerID
@@ -5548,6 +5557,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcAddrRemarkType Remark
TThostFtdcSiteType Site
TThostFtdcNetOperatorType NetOperator
+ TThostFtdcAddrNameType SysName
cdef struct CThostFtdcQryIpAddrParamField:
TThostFtdcBrokerIDType BrokerID
cdef struct CThostFtdcTGIpAddrParamField:
@@ -5565,6 +5575,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcAddrRemarkType Remark
TThostFtdcSiteType Site
TThostFtdcNetOperatorType NetOperator
+ TThostFtdcAddrNameType SysName
cdef struct CThostFtdcQryTGIpAddrParamField:
TThostFtdcBrokerIDType BrokerID
TThostFtdcUserIDType UserID
@@ -5915,6 +5926,7 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcErrorMsgType StatusMsg
TThostFtdcUserIDType ActiveUserID
TThostFtdcSequenceNoType BrokerOffsetSettingSeq
+ TThostFtdcApplySrcType ApplySrc
cdef struct CThostFtdcCancelOffsetSettingField:
TThostFtdcBrokerIDType BrokerID
TThostFtdcInvestorIDType InvestorID
@@ -5953,6 +5965,242 @@ cdef extern from 'ThostFtdcUserApiStruct.h':
TThostFtdcAppIDType AppID
cdef struct CThostFtdcQryAddrAppIDRelationField:
TThostFtdcBrokerIDType BrokerID
+ cdef struct CThostFtdcWechatUserSystemInfoField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcSystemInfoLenType WechatCltSysInfoLen
+ TThostFtdcClientSystemInfoType WechatCltSysInfo
+ TThostFtdcIPPortType ClientIPPort
+ TThostFtdcTimeType ClientLoginTime
+ TThostFtdcAppIDType ClientAppID
+ TThostFtdcIPAddressType ClientPublicIP
+ TThostFtdcClientLoginRemarkType ClientLoginRemark
+ cdef struct CThostFtdcInvestorReserveInfoField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcReserveInfoType ReserveInfo
+ cdef struct CThostFtdcQryInvestorDepartmentFlatField:
+ TThostFtdcBrokerIDType BrokerID
+ cdef struct CThostFtdcInvestorDepartmentFlatField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcInvestorIDType DepartmentID
+ cdef struct CThostFtdcQryDepartmentUserField:
+ TThostFtdcBrokerIDType BrokerID
+ cdef struct CThostFtdcAppAuthenticationCodeField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcAppIDType AppID
+ TThostFtdcAuthCodeType AuthCode
+ TThostFtdcAuthCodeType PreAuthCode
+ TThostFtdcAppTypeType AppType
+ cdef struct CThostFtdcUserDRIBypassField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcDRIdentityIDType DRIdentityID
+ cdef struct CThostFtdcReqGenSMSCodeField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcSMSPhoneType Mobile
+ cdef struct CThostFtdcRspGenSMSCodeField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcTimeType GenTime
+ cdef struct CThostFtdcSMSVerifyInfoFromSecField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcBrokerAbbrType BrokerAbbr
+ TThostFtdcUserIDType UserID
+ TThostFtdcSMSPhoneType Mobile
+ TThostFtdcSMSCodeType SMSCode
+ TThostFtdcDateType CreateDate
+ TThostFtdcTimeType CreateTime
+ TThostFtdcBoolType IsUsed
+ TThostFtdcDRIdentityIDType FromSec
+ cdef struct CThostFtdcSMSVerifyConfigField:
+ TThostFtdcUserIDType UserID
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcSMSPhoneType Mobile
+ TThostFtdcBoolType UseSMSVerify
+ cdef struct CThostFtdcSMSVerifyInfoField:
+ TThostFtdcTimeType CreateTime
+ TThostFtdcSMSPhoneType Mobile
+ TThostFtdcSMSContentType SMSContent
+ cdef struct CThostFtdcInputSpdApplyField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcInstrumentIDType FirstLegInstrumentID
+ TThostFtdcInstrumentIDType SecondLegInstrumentID
+ TThostFtdcVolumeType Volume
+ TThostFtdcDirectionType Direction
+ TThostFtdcCmbTypeType CmbType
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
+ cdef struct CThostFtdcInputHedgeCfmField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcInstrumentIDType InstrumentID
+ TThostFtdcVolumeType Volume
+ TThostFtdcDirectionType Direction
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
+ cdef struct CThostFtdcSpdApplyField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcInstrumentIDType FirstLegInstrumentID
+ TThostFtdcInstrumentIDType SecondLegInstrumentID
+ TThostFtdcUserIDType UserID
+ TThostFtdcVolumeType Volume
+ TThostFtdcDirectionType Direction
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcFrontIDType FrontID
+ TThostFtdcSessionIDType SessionID
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcUserIDType ActiveUserID
+ TThostFtdcSequenceNoType BrokerOrderSeq
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcApplyStatusType ApplyStatus
+ TThostFtdcSequenceNoType SequenceNo
+ TThostFtdcDateType InsertDate
+ TThostFtdcTimeType InsertTime
+ TThostFtdcTimeType CancelTime
+ TThostFtdcOrderLocalIDType OrderLocalID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcParticipantIDType ParticipantID
+ TThostFtdcClientIDType ClientID
+ TThostFtdcExchangeInstIDType ExchangeInstID
+ TThostFtdcTraderIDType TraderID
+ TThostFtdcInstallIDType InstallID
+ TThostFtdcOrderSubmitStatusType OrderSubmitStatus
+ TThostFtdcSequenceNoType NotifySequence
+ TThostFtdcDateType TradingDay
+ TThostFtdcSettlementIDType SettlementID
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
+ TThostFtdcCmbTypeType CmbType
+ TThostFtdcErrorMsgType StatusMsg
+ cdef struct CThostFtdcHedgeCfmField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcInstrumentIDType InstrumentID
+ TThostFtdcUserIDType UserID
+ TThostFtdcVolumeType Volume
+ TThostFtdcDirectionType Direction
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcFrontIDType FrontID
+ TThostFtdcSessionIDType SessionID
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcUserIDType ActiveUserID
+ TThostFtdcSequenceNoType BrokerOrderSeq
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcApplyStatusType ApplyStatus
+ TThostFtdcSequenceNoType SequenceNo
+ TThostFtdcVolumeType DealVolume
+ TThostFtdcDateType InsertDate
+ TThostFtdcTimeType InsertTime
+ TThostFtdcTimeType CancelTime
+ TThostFtdcDateType ReqDate
+ TThostFtdcOrderLocalIDType OrderLocalID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcParticipantIDType ParticipantID
+ TThostFtdcClientIDType ClientID
+ TThostFtdcExchangeInstIDType ExchangeInstID
+ TThostFtdcTraderIDType TraderID
+ TThostFtdcInstallIDType InstallID
+ TThostFtdcOrderSubmitStatusType OrderSubmitStatus
+ TThostFtdcSequenceNoType NotifySequence
+ TThostFtdcDateType TradingDay
+ TThostFtdcSettlementIDType SettlementID
+ TThostFtdcErrorMsgType StatusMsg
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
+ cdef struct CThostFtdcQrySpdApplyField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcExchangeInstIDType FirstLegInstrumentID
+ TThostFtdcExchangeInstIDType SecondLegInstrumentID
+ cdef struct CThostFtdcQryHedgeCfmField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcInstrumentIDType InstrumentID
+ cdef struct CThostFtdcInputSpdApplyActionField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcFrontIDType FrontID
+ TThostFtdcSessionIDType SessionID
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
+ cdef struct CThostFtdcInputHedgeCfmActionField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcUserIDType UserID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcFrontIDType FrontID
+ TThostFtdcSessionIDType SessionID
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
+ cdef struct CThostFtdcSpdApplyActionField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcDateType ActionDate
+ TThostFtdcTimeType ActionTime
+ TThostFtdcTraderIDType TraderID
+ TThostFtdcInstallIDType InstallID
+ TThostFtdcOrderLocalIDType OrderLocalID
+ TThostFtdcOrderLocalIDType ActionLocalID
+ TThostFtdcParticipantIDType ParticipantID
+ TThostFtdcClientIDType ClientID
+ TThostFtdcOrderActionStatusType OrderActionStatus
+ TThostFtdcUserIDType UserID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcErrorMsgType StatusMsg
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcFrontIDType FrontID
+ TThostFtdcSessionIDType SessionID
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
+ cdef struct CThostFtdcHedgeCfmActionField:
+ TThostFtdcBrokerIDType BrokerID
+ TThostFtdcInvestorIDType InvestorID
+ TThostFtdcDateType ActionDate
+ TThostFtdcTimeType ActionTime
+ TThostFtdcTraderIDType TraderID
+ TThostFtdcInstallIDType InstallID
+ TThostFtdcOrderLocalIDType OrderLocalID
+ TThostFtdcOrderLocalIDType ActionLocalID
+ TThostFtdcParticipantIDType ParticipantID
+ TThostFtdcClientIDType ClientID
+ TThostFtdcOrderActionStatusType OrderActionStatus
+ TThostFtdcUserIDType UserID
+ TThostFtdcExchangeIDType ExchangeID
+ TThostFtdcOrderSysIDType OrderSysID
+ TThostFtdcRequestIDType RequestID
+ TThostFtdcErrorMsgType StatusMsg
+ TThostFtdcOrderRefType OrderRef
+ TThostFtdcFrontIDType FrontID
+ TThostFtdcSessionIDType SessionID
+ TThostFtdcIPAddressType IPAddress
+ TThostFtdcMacAddressType MacAddress
cdef struct CThostFtdcFrontInfoField:
TThostFtdcAddressType FrontAddr
TThostFtdcQueryFreqType QryFreq
diff --git a/ctpwrapper/headers/cMdAPI.pxd b/ctpwrapper/headers/cMdAPI.pxd
index 161fabe..a884928 100644
--- a/ctpwrapper/headers/cMdAPI.pxd
+++ b/ctpwrapper/headers/cMdAPI.pxd
@@ -105,7 +105,7 @@ cdef extern from 'ThostFtdcMdApi.h':
int ReqQryMulticastInstrument(CThostFtdcQryMulticastInstrumentField *pQryMulticastInstrument, int nRequestID) except + nogil
cdef extern from 'ThostFtdcMdApi.h' namespace "CThostFtdcMdApi":
- CMdApi *CreateFtdcMdApi(const_char *pszFlowPath, cbool bIsUsingUdp, cbool bIsMulticast) except + nogil
+ CMdApi *CreateFtdcMdApi(const_char *pszFlowPath, cbool bIsUsingUdp, cbool bIsMulticast, cbool bIsProductionMode) except + nogil
cdef extern from 'CMdAPI.h':
diff --git a/ctpwrapper/headers/cTraderApi.pxd b/ctpwrapper/headers/cTraderApi.pxd
index 13a458a..17c0182 100644
--- a/ctpwrapper/headers/cTraderApi.pxd
+++ b/ctpwrapper/headers/cTraderApi.pxd
@@ -19,6 +19,7 @@ along with ctpwrapper. If not, see .
"""
from cpython cimport PyObject
from libc.string cimport const_char
+from libcpp cimport bool as cbool
from .ThostFtdcUserApiStruct cimport *
@@ -78,7 +79,7 @@ cdef extern from "ThostFtdcTraderApi.h":
# THOST_TERT_RESUME:从上次收到的续传
# THOST_TERT_QUICK:只传送登录后私有流的内容
#@remark 该方法要在Init方法前调用。若不调用则不会收到私有流的数据。
- void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType) except + nogil
+ void SubscribePrivateTopic(THOST_TE_RESUME_TYPE nResumeType,int nSeqNo) except + nogil
#订阅公共流。
#@param nResumeType 公共流重传方式
@@ -99,6 +100,12 @@ cdef extern from "ThostFtdcTraderApi.h":
# 操作员登录后,可以多次调用该接口上报客户信息
int SubmitUserSystemInfo(CThostFtdcUserSystemInfoField *pUserSystemInfo) except + nogil
+ #注册用户终端信息,用于中继服务器多连接模式.用于微信小程序等应用上报信息.
+ int RegisterWechatUserSystemInfo(CThostFtdcWechatUserSystemInfoField *pUserSystemInfo) except + nogil
+
+ #上报用户终端信息,用于中继服务器操作员登录模式.用于微信小程序等应用上报信息.
+ int SubmitWechatUserSystemInfo(CThostFtdcWechatUserSystemInfoField *pUserSystemInfo) except + nogil
+
#用户登录请求
int ReqUserLogin(CThostFtdcReqUserLoginField *pReqUserLoginField, int nRequestID) except + nogil
@@ -205,6 +212,9 @@ cdef extern from "ThostFtdcTraderApi.h":
#请求查询合约手续费率
int ReqQryInstrumentCommissionRate(CThostFtdcQryInstrumentCommissionRateField *pQryInstrumentCommissionRate, int nRequestID) except + nogil
+ #请求查询用户会话
+ int ReqQryUserSession(CThostFtdcQryUserSessionField *pQryUserSession, int nRequestID) except + nogil
+
#请求查询交易所
int ReqQryExchange(CThostFtdcQryExchangeField *pQryExchange, int nRequestID) except + nogil
@@ -448,9 +458,30 @@ cdef extern from "ThostFtdcTraderApi.h":
# 投资者对冲设置查询
int ReqQryOffsetSetting(CThostFtdcQryOffsetSettingField *pQryOffsetSetting, int nRequestID) except + nogil
+ # 申请短信验证码请求
+ int ReqGenSMSCode(CThostFtdcReqGenSMSCodeField *pReqGenSMSCode, int nRequestID) except + nogil
+
+ # 套利确认请求
+ int ReqSpdApply(CThostFtdcInputSpdApplyField *pInputSpdApply, int nRequestID) except + nogil
+
+ # 套利确认撤销请求
+ int ReqSpdApplyAction(CThostFtdcInputSpdApplyActionField *pInputSpdApplyAction, int nRequestID) except + nogil
+
+ # 套利确认查询请求
+ int ReqQrySpdApply(CThostFtdcQrySpdApplyField *pQrySpdApply, int nRequestID) except + nogil
+
+ # 套保确认请求
+ int ReqHedgeCfm(CThostFtdcInputHedgeCfmField *pInputHedgeCfm, int nRequestID) except + nogil
+
+ # 套保确认撤销请求
+ int ReqHedgeCfmAction(CThostFtdcInputHedgeCfmActionField *pInputHedgeCfmAction, int nRequestID) except + nogil
+
+ # 套保确认查询请求
+ int ReqQryHedgeCfm(CThostFtdcQryHedgeCfmField *pQryHedgeCfm, int nRequestID) except + nogil
+
cdef extern from "ThostFtdcTraderApi.h" namespace "CThostFtdcTraderApi":
- CTraderApi *CreateFtdcTraderApi(const_char *pszFlowPath) except + nogil
+ CTraderApi *CreateFtdcTraderApi(const_char *pszFlowPath, cbool bIsProductionMode) except + nogil
cdef extern from "CTraderAPI.h":
cdef cppclass CTraderSpi:
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 3c2ec92..fc359c4 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.10
+FROM python:3.12
RUN pip3 install cython pip setuptools --upgrade
WORKDIR /code
diff --git a/docker/pypy3-Dockerfile b/docker/pypy3-Dockerfile
index 10b6ef4..d59b1a2 100644
--- a/docker/pypy3-Dockerfile
+++ b/docker/pypy3-Dockerfile
@@ -1,4 +1,4 @@
-FROM pypy:3.9
+FROM pypy:3.11
RUN pypy3 -m ensurepip
RUN pip3 install cython pip setuptools --upgrade
WORKDIR /code
diff --git a/generate.py b/generate.py
index 84f9c8f..59b01d4 100644
--- a/generate.py
+++ b/generate.py
@@ -22,7 +22,7 @@ def generate_structure(datatype_dict):
generate_file = os.path.join(GENERATE_PATH, "ThostFtdcUserApiStruct.pxd")
- data_struct_file = codecs.open(generate_file, "w", encoding="utf-8")
+ data_struct_file = open(generate_file, "w", encoding="utf-8")
data_struct_file.write("# encoding:utf-8")
data_struct_file.write("\n" * 2)
@@ -31,14 +31,14 @@ def generate_structure(datatype_dict):
data_struct_file.write("cdef extern from 'ThostFtdcUserApiStruct.h':\n")
- for line in codecs.open(USERAPI_STRUCT_FILE, encoding="utf-8"):
+ for line in open(USERAPI_STRUCT_FILE, encoding="utf-8"):
if line.startswith("struct"):
- result = re.findall("\w+", line)
+ result = re.findall("\\w+", line)
name = result[1]
data_struct_file.write(" cdef struct {name}:\n".format(name=name))
else:
- result = re.findall("\w+", line)
+ result = re.findall("\\w+", line)
if result:
type_name = result[0]
@@ -56,13 +56,13 @@ def generate_datatype():
datatype_dict = OrderedDict()
generate_file = os.path.join(GENERATE_PATH, "ThostFtdcUserApiDataType.pxd")
- data_type_file = codecs.open(generate_file, "w", encoding="utf-8")
+ data_type_file = open(generate_file, "w", encoding="utf-8")
data_type_file.write("# encoding:utf-8")
data_type_file.write("\n" * 2)
data_type_file.write("cdef extern from 'ThostFtdcUserApiDataType.h':\n")
- for line in codecs.open(USERAPI_DATA_FILE, encoding="utf-8"):
+ for line in open(USERAPI_DATA_FILE, encoding="utf-8"):
if line.startswith("enum"):
# special output data
data_type_file.write("""
@@ -76,7 +76,7 @@ def generate_datatype():
if line.startswith("#define"):
pass
elif line.startswith("typedef"):
- result = re.findall("\w+", line)
+ result = re.findall("\\w+", line)
_type = result[1]
name = result[2]
diff --git a/generate_structure.py b/generate_structure.py
index 752bad5..52e6bcc 100644
--- a/generate_structure.py
+++ b/generate_structure.py
@@ -33,10 +33,10 @@ def parse_datatype(self):
"""
处理 UserApiDataType file.
"""
- for line in codecs.open(self.type_file, encoding="utf-8"):
+ for line in open(self.type_file, encoding="utf-8"):
if line.startswith("typedef"):
- result = re.findall("\w+", line)
+ result = re.findall("\\w+", line)
name = result[2]
type_ = result[1]
@@ -60,12 +60,12 @@ def parse_struct(self):
"""
self.parse_datatype()
- for index, line in enumerate(codecs.open(self.struct_file,
+ for index, line in enumerate(open(self.struct_file,
encoding="utf-8")):
doc_line = index
if line.startswith("struct"):
- result = re.findall("\w+", line)
+ result = re.findall("\\w+", line)
name = result[1] # assign the name
self.struct[name] = OrderedDict()
@@ -75,7 +75,7 @@ def parse_struct(self):
self.struct_doc[name] = struct_doc
if line.strip().startswith("TThostFtdc"):
- result = re.findall("\w+", line)
+ result = re.findall("\\w+", line)
field_type = result[0]
field_name = result[1].replace(";", "")
struct_dict = self.struct[name]
@@ -150,7 +150,7 @@ def generate_interface():
structure = parse.struct
struct_doc = parse.struct_doc
# generate python
- py_file = codecs.open(GENERATE_FILE, "w", encoding="utf-8")
+ py_file = open(GENERATE_FILE, "w", encoding="utf-8")
py_file.write('# encoding=utf-8\n')
py_file.write("import ctypes\n")
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..15798df
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,41 @@
+[build-system]
+requires = ["setuptools>=82.0.1", "cython>=3.2.5"]
+build-backend = "setuptools.build_meta"
+
+[project.urls]
+GitHub = "https://github.com/nooperpudd/ctpwrapper"
+[project]
+name = "ctpwrapper"
+version = "6.7.13"
+authors = [
+ {name = "winton", email = "365504029@qq.com"},
+]
+readme = "README.md"
+keywords = ["CTP", "Future", "SHFE", "Shanghai Future Exchange"]
+requires-python = ">=3.10"
+license = "LGPL-3.0-or-later"
+dependencies = [
+ "cython",
+ "setuptools>=82.0.1",
+]
+description = "CTP client v6.7.13"
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "Operating System :: POSIX",
+ "Operating System :: Microsoft",
+ "Operating System :: Microsoft :: Windows",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: 3.14",
+ "Programming Language :: Python :: Implementation",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Programming Language :: Python :: Implementation :: PyPy",
+ "Topic :: Software Development",
+ "Topic :: Software Development :: Libraries"
+]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index d237781..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[metadata]
-requires_dist = cython
-
-[wheel]
-universal = 1
\ No newline at end of file
diff --git a/setup.py b/setup.py
index c4881ff..b5c5c74 100755
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,6 @@
import re
import shutil
import sys
-from distutils.dir_util import copy_tree
from setuptools import setup
from Cython.Build import cythonize, build_ext
@@ -23,7 +22,7 @@ def find_version(*file_paths):
extract directly from the init file
"""
here = os.path.abspath(os.path.dirname(__file__))
- with codecs.open(os.path.join(here, *file_paths), 'r', encoding="utf-8") as f:
+ with open(os.path.join(here, *file_paths), 'r', encoding="utf-8") as f:
version_file = f.read()
# The version line must have the form
@@ -68,7 +67,7 @@ def find_version(*file_paths):
shutil.copy2(header_dir + "/error.xml", project_dir + "/error.xml")
if sys.platform in ["linux", "win32"]:
- copy_tree(lib_dir, project_dir)
+ shutil.copytree(lib_dir, project_dir, dirs_exist_ok=True)
common_args = {
"cython_include_dirs": [cython_headers],
@@ -95,21 +94,10 @@ def find_version(*file_paths):
]
setup(
- name="ctpwrapper",
- version=find_version("ctpwrapper", "__init__.py"),
- description="CTP client v6.7.9",
- long_description=codecs.open("README.md", encoding="utf-8").read(),
- long_description_content_type='text/markdown',
- license="LGPLv3",
- keywords="CTP,Future,SHFE,Shanghai Future Exchange",
- author="Winton Wang",
- author_email="365504029@qq.com",
- url="https://github.com/nooperpudd/ctpwrapper",
include_dirs=[header_dir, cpp_header_dir],
platforms=["win32", "linux"],
packages=["ctpwrapper"],
package_data={"": package_data},
- python_requires=">=3.9",
# cython: binding=True
# binding = true for inspect get callargs
ext_modules=cythonize(ext_modules,
@@ -117,24 +105,4 @@ def find_version(*file_paths):
"binding": True}
),
cmdclass={'build_ext': build_ext},
- classifiers=[
- "Development Status :: 5 - Production/Stable",
- "Intended Audience :: Developers",
- "Operating System :: POSIX",
- "Operating System :: Microsoft",
- "Operating System :: Microsoft :: Windows",
- "Programming Language :: Python",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3 :: Only",
- "Programming Language :: Python :: 3.9",
- "Programming Language :: Python :: 3.10",
- "Programming Language :: Python :: 3.11",
- "Programming Language :: Python :: 3.12",
- "Programming Language :: Python :: 3.13",
- "Programming Language :: Python :: Implementation",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python :: Implementation :: PyPy",
- "Topic :: Software Development",
- "Topic :: Software Development :: Libraries"
- ]
)