@hitrading/ctp-node 4.1.2 → 4.1.3-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -1
  3. package/README.zh-CN.md +1 -1
  4. package/binding.gyp +9 -0
  5. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/Headers/ThostFtdcMdApi.h +2 -1
  6. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/Headers/ThostFtdcUserApiDataType.h +170 -7
  7. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/Headers/ThostFtdcUserApiStruct.h +1485 -33
  8. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/Resources/demo.txt +58 -0
  9. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/Resources/package.des +14 -0
  10. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/Resources/readme.txt +2 -0
  11. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/_CodeSignature/CodeResources +36 -3
  12. package/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/thostmduserapi_se +0 -0
  13. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/Headers/ThostFtdcTraderApi.h +121 -7
  14. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/Headers/ThostFtdcUserApiDataType.h +170 -7
  15. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/Headers/ThostFtdcUserApiStruct.h +1485 -33
  16. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/Resources/demo.txt +58 -0
  17. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/Resources/package.des +14 -0
  18. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/Resources/readme.txt +2 -0
  19. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/_CodeSignature/CodeResources +36 -3
  20. package/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/thosttraderapi_se +0 -0
  21. package/docs/API.md +3 -1
  22. package/docs/API.zh-CN.md +2 -1
  23. package/docs/MIGRATION.md +5 -1
  24. package/docs/troubleshooting.md +2 -1
  25. package/docs/troubleshooting.zh-CN.md +2 -1
  26. package/package.json +3 -2
  27. package/prebuilds/win32-x64/@hitrading+ctp-node.node +0 -0
  28. package/scripts/check-macos-sdk.cjs +80 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [4.1.3-rc.2](https://github.com/hitrading/ctp-node/compare/v4.1.3-rc.1...v4.1.3-rc.2) (2026-11-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **macos:** 换上 CTP v6.7.13 MacOS framework,恢复 macOS 构建 ([c1a1950](https://github.com/hitrading/ctp-node/commit/c1a1950c0bd6d57fee99fa64b84c5ca41e0b0f15))
7
+
8
+ ## [4.1.3-rc.1](https://github.com/hitrading/ctp-node/compare/v4.1.2...v4.1.3-rc.1) (2026-11-13)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **macos:** CTP 框架与头文件版本不一致时在构建期中止,不再编出运行时崩溃的插件 ([88de78f](https://github.com/hitrading/ctp-node/commit/88de78f956a12e43082a0bc6eb577694df96e94c))
14
+
1
15
  ## [4.1.2](https://github.com/hitrading/ctp-node/compare/v4.1.1...v4.1.2) (2026-11-13)
2
16
 
3
17
 
package/README.md CHANGED
@@ -41,7 +41,7 @@
41
41
 
42
42
  ## Requirements
43
43
 
44
- Node 22.22.2+ on supported even-numbered release lines (`^22.22.2 || ^24.15.0 || >=26.0.0`). This mirrors the Node.js range required by the bundled `node-gyp`; odd-numbered/EOL releases and Node 24.0–24.14 are not supported. Prebuilt binaries are shipped for **Windows and Linux (x64)** — most users need no compiler there. **macOS (and any other platform) builds from source on install**, which needs a C++ toolchain (macOS: Xcode Command Line Tools; Windows: VS Build Tools; Linux: clang/gcc). The CTP shared libraries are bundled next to the loaded addon and resolved automatically.
44
+ Node 22.22.2+ on supported even-numbered release lines (`^22.22.2 || ^24.15.0 || >=26.0.0`). This mirrors the Node.js range required by the bundled `node-gyp`; odd-numbered/EOL releases and Node 24.0–24.14 are not supported. Prebuilt binaries are shipped for **Windows and Linux (x64)** — most users need no compiler there. **macOS (and any other platform) builds from source on install**, which needs a C++ toolchain (macOS: Xcode Command Line Tools; Windows: VS Build Tools; Linux: clang/gcc). The bundled CTP macOS frameworks are SFIT's universal (arm64 + x86_64) 6.7.13 build, the same CTP version as the Windows/Linux libraries; CI builds and tests macOS on Apple Silicon only. The CTP shared libraries are bundled next to the loaded addon and resolved automatically.
45
45
 
46
46
  ## Install
47
47
 
package/README.zh-CN.md CHANGED
@@ -37,7 +37,7 @@
37
37
 
38
38
  ## 环境要求
39
39
 
40
- 受支持的偶数版本线要求 Node 22.22.2+(`^22.22.2 || ^24.15.0 || >=26.0.0`)。该范围与内置 `node-gyp` 的 Node.js 要求一致;不支持奇数/EOL 版本及 Node 24.0–24.14。**Windows 与 Linux(x64)提供预编译二进制**,这两个平台多数用户无需编译器。**macOS(及其他平台)在安装时从源码构建**,需要 C++ 工具链(macOS:Xcode Command Line Tools;Windows:VS Build Tools;Linux:clang/gcc)。CTP 共享库随插件一起打包在旁并自动解析。
40
+ 受支持的偶数版本线要求 Node 22.22.2+(`^22.22.2 || ^24.15.0 || >=26.0.0`)。该范围与内置 `node-gyp` 的 Node.js 要求一致;不支持奇数/EOL 版本及 Node 24.0–24.14。**Windows 与 Linux(x64)提供预编译二进制**,这两个平台多数用户无需编译器。**macOS(及其他平台)在安装时从源码构建**,需要 C++ 工具链(macOS:Xcode Command Line Tools;Windows:VS Build Tools;Linux:clang/gcc)。随包的 CTP macOS 框架是上期技术的 6.7.13 通用版(arm64 + x86_64),与 Windows/Linux 库是同一 CTP 版本;CI 只在 Apple Silicon 上构建和测试 macOS。CTP 共享库随插件一起打包在旁并自动解析。
41
41
 
42
42
  ## 安装
43
43
 
package/binding.gyp CHANGED
@@ -69,6 +69,15 @@
69
69
  ]
70
70
  }],
71
71
  ["OS=='mac'", {
72
+ # The vendored frameworks must be the same CTP version as ctpsdk/*.h and
73
+ # the Windows/Linux libraries: a mismatched build still links (node-gyp
74
+ # uses -undefined dynamic_lookup on macOS) but segfaults at runtime. The
75
+ # check prints nothing when the versions match and otherwise fails
76
+ # configure with an explanation. gyp expands only the condition branch
77
+ # that applies, so it never runs on Windows/Linux.
78
+ "variables": {
79
+ "ctp_macos_sdk_check": "<!(node scripts/check-macos-sdk.cjs)"
80
+ },
72
81
  "include_dirs": [
73
82
  "<(module_root_dir)/ctpsdk/macos/thostmduserapi_se.framework/Versions/A/Headers",
74
83
  "<(module_root_dir)/ctpsdk/macos/thosttraderapi_se.framework/Versions/A/Headers"
@@ -82,9 +82,10 @@ class MD_API_EXPORT CThostFtdcMdApi
82
82
  public:
83
83
  ///创建MdApi
84
84
  ///@param pszFlowPath 存贮订阅信息文件的目录,默认为当前目录
85
+ ///@param bIsProductionVersion true:使用生产版本的API false:使用用测评版本API
85
86
  ///@return 创建出的UserApi
86
87
  ///modify for udp marketdata
87
- static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false);
88
+ static CThostFtdcMdApi *CreateFtdcMdApi(const char *pszFlowPath = "", const bool bIsUsingUdp=false, const bool bIsMulticast=false, bool bIsProductionMode=true);
88
89
 
89
90
  ///获取API的版本信息
90
91
  ///@retrun 获取到的版本号
@@ -3,8 +3,8 @@
3
3
  ///@company 上海期货信息技术有限公司
4
4
  ///@file ThostFtdcUserApiDataType.h
5
5
  ///@brief 定义了客户端接口使用的业务数据类型
6
- ///@history
7
- ///20060106 赵鸿昊 创建该文件
6
+ ///@history
7
+ ///20060106 赵鸿昊 创建该文件
8
8
  /////////////////////////////////////////////////////////////////////////
9
9
 
10
10
  #ifndef THOST_FTDCDATATYPE_H
@@ -12,10 +12,11 @@
12
12
 
13
13
  enum THOST_TE_RESUME_TYPE
14
14
  {
15
- THOST_TERT_RESTART = 0,
16
- THOST_TERT_RESUME,
17
- THOST_TERT_QUICK,
18
- THOST_TERT_NONE
15
+ THOST_TERT_RESTART = 0,
16
+ THOST_TERT_RESUME,
17
+ THOST_TERT_QUICK,
18
+ THOST_TERT_NONE,
19
+ THOST_TERT_RESUME_FROM_SEQ_NO
19
20
  };
20
21
 
21
22
  /////////////////////////////////////////////////////////////////////////
@@ -128,6 +129,11 @@ typedef char TThostFtdcExchangeFlagType[2];
128
129
  /////////////////////////////////////////////////////////////////////////
129
130
  typedef char TThostFtdcMacAddressType[21];
130
131
 
132
+ /////////////////////////////////////////////////////////////////////////
133
+ ///TFtdcDeviceTagType是一个客户端机器标识,可填MAC或UUID类型
134
+ /////////////////////////////////////////////////////////////////////////
135
+ typedef char TThostFtdcDeviceTagType[41];
136
+
131
137
  /////////////////////////////////////////////////////////////////////////
132
138
  ///TFtdcSystemIDType是一个系统编号类型
133
139
  /////////////////////////////////////////////////////////////////////////
@@ -547,6 +553,8 @@ typedef char TThostFtdcFunctionCodeType;
547
553
  #define THOST_FTDC_BFC_FBSign 'W'
548
554
  ///银期签约解约
549
555
  #define THOST_FTDC_BFC_FBAccount 'X'
556
+ ///接收短信验证码
557
+ #define THOST_FTDC_BFC_RcvSMSCode 'Y'
550
558
 
551
559
  typedef char TThostFtdcBrokerFunctionCodeType;
552
560
 
@@ -1551,6 +1559,18 @@ typedef char TThostFtdcSystemParamIDType;
1551
1559
  #define THOST_FTDC_TPID_PasswordPeriod 'V'
1552
1560
  ///历史密码重复限制次数
1553
1561
  #define THOST_FTDC_TPID_PwdHistoryCmp 'X'
1562
+ ///转账是否验证预留银行账户
1563
+ #define THOST_FTDC_TPID_TranferChkProperty 'i'
1564
+ ///非交易时间异常报单校验参数
1565
+ #define THOST_FTDC_TPID_TradeChkPhase 'j'
1566
+ ///其他异常报单校验参数(价格和手数)
1567
+ #define THOST_FTDC_TPID_TradeChkPriceVol 'k'
1568
+ ///卖出垂直价差组合新算法
1569
+ #define THOST_FTDC_TPID_NewBESMarginAlgo 'l'
1570
+ ///大商所期货组合平仓冻结算法
1571
+ #define THOST_FTDC_TPID_IsDceFutCloseFrozen 'm'
1572
+ ///是否启用短信验证
1573
+ #define THOST_FTDC_TPID_UseSMSVerify 'n'
1554
1574
 
1555
1575
  typedef char TThostFtdcTradeParamIDType;
1556
1576
 
@@ -6919,7 +6939,7 @@ typedef double TThostFtdcDeltaType;
6919
6939
  typedef int TThostFtdcSpreadIdType;
6920
6940
 
6921
6941
  /////////////////////////////////////////////////////////////////////////
6922
- ///TFtdcPortfolioType是一个新型组保算法类型
6942
+ ///TFtdcPortfolioType是一个组保算法类型
6923
6943
  /////////////////////////////////////////////////////////////////////////
6924
6944
  ///不使用新型组保算法
6925
6945
  #define THOST_FTDC_EPF_None '0'
@@ -7095,7 +7115,150 @@ typedef char TThostFtdcProdChangeFlagType;
7095
7115
  #define THOST_FTDC_PRS_UserUpd '2'
7096
7116
  ///来源于超户修改,很可能来自主席同步数据
7097
7117
  #define THOST_FTDC_PRS_SuperUserUpd '3'
7118
+ ///来源于次席同步的修改
7119
+ #define THOST_FTDC_PRS_SecUpd '4'
7098
7120
 
7099
7121
  typedef char TThostFtdcPwdRcdSrcType;
7100
7122
 
7123
+ /////////////////////////////////////////////////////////////////////////
7124
+ ///TFtdcAddrSrvModeType是一个地址服务类型类型
7125
+ /////////////////////////////////////////////////////////////////////////
7126
+ ///交易地址
7127
+ #define THOST_FTDC_ASM_Trade '0'
7128
+ ///行情地址
7129
+ #define THOST_FTDC_ASM_MarketData '1'
7130
+ ///其他
7131
+ #define THOST_FTDC_ASM_Other '2'
7132
+
7133
+ typedef char TThostFtdcAddrSrvModeType;
7134
+
7135
+ /////////////////////////////////////////////////////////////////////////
7136
+ ///TFtdcAddrVerType是一个地址版本类型
7137
+ /////////////////////////////////////////////////////////////////////////
7138
+ ///IPV4
7139
+ #define THOST_FTDC_ADV_V4 '0'
7140
+ ///IPV6
7141
+ #define THOST_FTDC_ADV_V6 '1'
7142
+
7143
+ typedef char TThostFtdcAddrVerType;
7144
+
7145
+ /////////////////////////////////////////////////////////////////////////
7146
+ ///TFtdcAddrRemarkType是一个地址备注类型
7147
+ /////////////////////////////////////////////////////////////////////////
7148
+ typedef char TThostFtdcAddrRemarkType[161];
7149
+
7150
+ /////////////////////////////////////////////////////////////////////////
7151
+ ///TFtdcAddrNameType是一个地址名称类型
7152
+ /////////////////////////////////////////////////////////////////////////
7153
+ typedef char TThostFtdcAddrNameType[65];
7154
+
7155
+ /////////////////////////////////////////////////////////////////////////
7156
+ ///TFtdcIpAddrType是一个服务地址IP类型
7157
+ /////////////////////////////////////////////////////////////////////////
7158
+ typedef char TThostFtdcIpAddrType[129];
7159
+
7160
+ /////////////////////////////////////////////////////////////////////////
7161
+ ///TFtdcTGSessionQryStatusType是一个TGATE会话查询状态类型
7162
+ /////////////////////////////////////////////////////////////////////////
7163
+ ///查询状态空闲
7164
+ #define THOST_FTDC_TGQS_QryIdle '1'
7165
+ ///查询状态频繁
7166
+ #define THOST_FTDC_TGQS_QryBusy '2'
7167
+
7168
+ typedef char TThostFtdcTGSessionQryStatusType;
7169
+
7170
+ /////////////////////////////////////////////////////////////////////////
7171
+ ///TFtdcOffsetTypeType是一个对冲类型类型
7172
+ /////////////////////////////////////////////////////////////////////////
7173
+ ///期权对冲
7174
+ #define THOST_FTDC_OT_OPT_OFFSET '0'
7175
+ ///期货对冲
7176
+ #define THOST_FTDC_OT_FUT_OFFSET '1'
7177
+ ///行权后期货对冲
7178
+ #define THOST_FTDC_OT_EXEC_OFFSET '2'
7179
+ ///履约后期货对冲
7180
+ #define THOST_FTDC_OT_PERFORM_OFFSET '3'
7181
+
7182
+ typedef char TThostFtdcOffsetTypeType;
7183
+
7184
+ /////////////////////////////////////////////////////////////////////////
7185
+ ///TFtdcSiteType是一个站点类型
7186
+ /////////////////////////////////////////////////////////////////////////
7187
+ typedef char TThostFtdcSiteType[51];
7188
+
7189
+ /////////////////////////////////////////////////////////////////////////
7190
+ ///TFtdcNetOperatorType是一个网络运营商类型
7191
+ /////////////////////////////////////////////////////////////////////////
7192
+ typedef char TThostFtdcNetOperatorType[9];
7193
+
7194
+ /////////////////////////////////////////////////////////////////////////
7195
+ ///TFtdcApplySrcType是一个申请来源类型
7196
+ /////////////////////////////////////////////////////////////////////////
7197
+ ///交易
7198
+ #define THOST_FTDC_AS_Trade '0'
7199
+ ///会服
7200
+ #define THOST_FTDC_AS_Member '1'
7201
+
7202
+ typedef char TThostFtdcApplySrcType;
7203
+
7204
+ /////////////////////////////////////////////////////////////////////////
7205
+ ///TFtdcReserveInfoType是一个预留信息类型
7206
+ /////////////////////////////////////////////////////////////////////////
7207
+ typedef char TThostFtdcReserveInfoType[65];
7208
+
7209
+ /////////////////////////////////////////////////////////////////////////
7210
+ ///TFtdcApplyStatusType是一个套利套保申请状态类型
7211
+ /////////////////////////////////////////////////////////////////////////
7212
+ ///未知
7213
+ #define THOST_FTDC_AS2_Unknown 'a'
7214
+ ///已撤销
7215
+ #define THOST_FTDC_AS2_Canceled '0'
7216
+ ///已挂起
7217
+ #define THOST_FTDC_AS2_Suspended '1'
7218
+ ///申请成功
7219
+ #define THOST_FTDC_AS2_Accepted '3'
7220
+
7221
+ typedef char TThostFtdcApplyStatusType;
7222
+
7223
+ /////////////////////////////////////////////////////////////////////////
7224
+ ///TFtdcCmbTypeType是一个组合定单类型,0类型
7225
+ /////////////////////////////////////////////////////////////////////////
7226
+ ///SPZ
7227
+ #define THOST_FTDC_ZCECT_SPZ '0'
7228
+ ///SPD
7229
+ #define THOST_FTDC_ZCECT_SPD '1'
7230
+ ///IPS
7231
+ #define THOST_FTDC_ZCECT_IPS '2'
7232
+ ///BUL
7233
+ #define THOST_FTDC_ZCECT_BUL '3'
7234
+ ///BER
7235
+ #define THOST_FTDC_ZCECT_BER '4'
7236
+ ///BLT
7237
+ #define THOST_FTDC_ZCECT_BLT '5'
7238
+ ///BRT
7239
+ #define THOST_FTDC_ZCECT_BRT '6'
7240
+ ///STD
7241
+ #define THOST_FTDC_ZCECT_STD '7'
7242
+ ///STG
7243
+ #define THOST_FTDC_ZCECT_STG '8'
7244
+ ///PRT
7245
+ #define THOST_FTDC_ZCECT_PRT '9'
7246
+
7247
+ typedef char TThostFtdcCmbTypeType;
7248
+
7249
+ /////////////////////////////////////////////////////////////////////////
7250
+ ///TFtdcSMSCodeType是一个短信验证码类型
7251
+ /////////////////////////////////////////////////////////////////////////
7252
+ typedef char TThostFtdcSMSCodeType[17];
7253
+
7254
+ /////////////////////////////////////////////////////////////////////////
7255
+ ///TFtdcSMSContentType是一个短信内容类型
7256
+ /////////////////////////////////////////////////////////////////////////
7257
+ typedef char TThostFtdcSMSContentType[129];
7258
+
7259
+ /////////////////////////////////////////////////////////////////////////
7260
+ ///TFtdcSMSPhoneType是一个手机号类型
7261
+ /////////////////////////////////////////////////////////////////////////
7262
+ typedef char TThostFtdcSMSPhoneType[17];
7263
+
7101
7264
  #endif