@hitrading/ctp-node 4.1.3-rc.1 → 4.1.3

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 (27) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +2 -2
  3. package/README.zh-CN.md +2 -2
  4. package/RELEASING.md +1 -3
  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 +4 -5
  22. package/docs/API.zh-CN.md +3 -3
  23. package/docs/MIGRATION.md +6 -6
  24. package/docs/troubleshooting.md +2 -2
  25. package/docs/troubleshooting.zh-CN.md +2 -2
  26. package/package.json +1 -1
  27. package/prebuilds/win32-x64/@hitrading+ctp-node.node +0 -0
@@ -0,0 +1,58 @@
1
+ int main(void)
2
+ {
3
+ unsigned char aucAesInPutData[273] = { 0 };
4
+
5
+ aucAesInPutData[0] = 1;
6
+ aucAesInPutData[1] = '0';
7
+ aucAesInPutData[2] = 3;
8
+ aucAesInPutData[3] = 4;
9
+ aucAesInPutData[4] = 5;
10
+ aucAesInPutData[5] = 6;
11
+ aucAesInPutData[7] = 9;
12
+
13
+ memcpy(aucAesInPutData + 8, "HDWDWADHAWNO@DHNAOIDAWOD@DADA", strlen("HDWDWADHAWNO@DHNAOIDAWOD@DADA"));
14
+
15
+ int reallen = 8 + strlen("HDWDWADHAWNO@DHNAOIDAWOD@DADA");
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+ unsigned char aucAesEncodeData[273] = { 0 };
24
+ unsigned char aucAeskey[17] = { 0 };
25
+ GetComm128BitsAesKey(aucAeskey);
26
+
27
+ AES_KEY aes;
28
+
29
+ int result = AES_set_encrypt_key(aucAeskey, 128, &aes);//设置加密密钥
30
+ if (result < 0)//如果设置失败,退出
31
+ return -1;
32
+
33
+
34
+ reallen = (16 - reallen % 16) + reallen;
35
+
36
+ for (int i = 0; i < reallen / 16; ++i)
37
+ {
38
+ AES_ecb_encrypt((unsigned char*)(aucAesInPutData + 16 * i), aucAesEncodeData + 16 * i, &aes, AES_ENCRYPT);
39
+ }
40
+
41
+
42
+
43
+ result = AES_set_decrypt_key(aucAeskey, 128, &aes);//设置加密密钥
44
+ if (result < 0)//如果设置失败,退出
45
+ return -1;
46
+ unsigned char aucAesOutData[273] = { 0 };
47
+
48
+ for (int i = 0; i < reallen / 16; ++i)
49
+ {
50
+ AES_ecb_encrypt((unsigned char*)(aucAesEncodeData + 16 * i), aucAesOutData + 16 * i, &aes, AES_DECRYPT);
51
+ }
52
+
53
+
54
+
55
+
56
+
57
+ return 0;
58
+ }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="gb2312"?>
2
+ <!DOCTYPE packageDefine SYSTEM "C:\amake\package.dtd">
3
+ <packageDefine name="CommAesKey" version="1" type="cpp" includedir="." platform="all">
4
+ <parameter/>
5
+ <depend>
6
+ </depend>
7
+ <cppfile>
8
+ <file name="CommAesKey.cpp"/>
9
+ </cppfile>
10
+ <headfile>
11
+ <file name="CommAesKey.h"/>
12
+ </headfile>
13
+ <command/>
14
+ </packageDefine>
@@ -0,0 +1,2 @@
1
+ 通用的aes秘钥 适合简单对称加密场景, 不区分红黄区
2
+ 目前用在 微信小程序采集库 和tradeapi上报数据之间的加密
@@ -8,6 +8,18 @@
8
8
  <data>
9
9
  VUxdF9Vsqsjm2nN6RDpWJxe/ttg=
10
10
  </data>
11
+ <key>Resources/demo.txt</key>
12
+ <data>
13
+ 6rxOq+3qQg1borsuR7Ac321LS+E=
14
+ </data>
15
+ <key>Resources/package.des</key>
16
+ <data>
17
+ jrbZMIOlX3HAhwEAlKH6eoboUTE=
18
+ </data>
19
+ <key>Resources/readme.txt</key>
20
+ <data>
21
+ 87xms+eK0V0empcfgo58JvOJZrc=
22
+ </data>
11
23
  </dict>
12
24
  <key>files2</key>
13
25
  <dict>
@@ -15,21 +27,21 @@
15
27
  <dict>
16
28
  <key>hash2</key>
17
29
  <data>
18
- XOwoHYsnMXiRjCVhgOIQgb+mqapnf7LP1GV5fMix3Yo=
30
+ CUGGj4827GSKJrXca19TmDIRtHKxo44v1+voQZPIqeo=
19
31
  </data>
20
32
  </dict>
21
33
  <key>Headers/ThostFtdcUserApiDataType.h</key>
22
34
  <dict>
23
35
  <key>hash2</key>
24
36
  <data>
25
- jeG/TAar2HshrQ9+4jkob94MKMFWLoH4Xl/HcKjIgww=
37
+ g4JFK88Lt2FgJODNwoC7123C6Ak3xx9PwK3oCcvvY+c=
26
38
  </data>
27
39
  </dict>
28
40
  <key>Headers/ThostFtdcUserApiStruct.h</key>
29
41
  <dict>
30
42
  <key>hash2</key>
31
43
  <data>
32
- E0WAQNGnhA4Om36nesySUQiOWRpOfovob8bEQ0DXibU=
44
+ VrO9rvXwzJ3b9d8xx+CJ+pklJVMSCofxkkFeS+Qua/c=
33
45
  </data>
34
46
  </dict>
35
47
  <key>Resources/Info.plist</key>
@@ -39,6 +51,27 @@
39
51
  WyUVnuil9tugvcHJcCw76ljlp1tONfIfxoKvod2ek+k=
40
52
  </data>
41
53
  </dict>
54
+ <key>Resources/demo.txt</key>
55
+ <dict>
56
+ <key>hash2</key>
57
+ <data>
58
+ Sv/7zVEvIJxPhI6ykmfoynT9luvqXVqastUUyaNWfdg=
59
+ </data>
60
+ </dict>
61
+ <key>Resources/package.des</key>
62
+ <dict>
63
+ <key>hash2</key>
64
+ <data>
65
+ JjdY5xqmxTc+E5YJvqbOVaT+iSdofhuurOan2GO5Eg8=
66
+ </data>
67
+ </dict>
68
+ <key>Resources/readme.txt</key>
69
+ <dict>
70
+ <key>hash2</key>
71
+ <data>
72
+ O9VEXNXxOJY5+eHYiEBPMYxtGDk0l/iJMVZqtSc/sK0=
73
+ </data>
74
+ </dict>
42
75
  </dict>
43
76
  <key>rules</key>
44
77
  <dict>
package/docs/API.md CHANGED
@@ -37,11 +37,10 @@ npm install @hitrading/ctp-node
37
37
 
38
38
  Supported Node.js release lines are `^22.22.2 || ^24.15.0 || >=26.0.0`, matching
39
39
  the bundled node-gyp 13 requirement. Prebuilt binaries ship in the npm package
40
- for win32-x64 and linux-x64. macOS is not supported at the moment: the bundled
41
- CTP macOS frameworks (6.7.7) do not match the 6.7.13 headers, and a build from
42
- them crashes at runtime, so the install-time build stops on macOS with an
43
- explanation. Where no prebuild matches, the addon builds from source on install
44
- (a C++ toolchain + Python are required).
40
+ for win32-x64 and linux-x64. macOS and other platforms build from source on
41
+ install (a C++ toolchain + Python are required; on macOS, the Xcode Command Line
42
+ Tools). The bundled CTP macOS frameworks are the universal 6.7.13 build, the
43
+ same CTP version as the Windows/Linux libraries.
45
44
 
46
45
  ---
47
46
 
package/docs/API.zh-CN.md CHANGED
@@ -34,9 +34,9 @@ npm install @hitrading/ctp-node
34
34
  ```
35
35
 
36
36
  支持的 Node.js 版本线为 `^22.22.2 || ^24.15.0 || >=26.0.0`,与内置 node-gyp 13 的要求一致。
37
- npm 包提供 win32-x64 与 linux-x64 预编译二进制。目前不支持 macOS:随包的 CTP macOS 框架(6.7.7)
38
- 与 6.7.13 头文件不匹配,由它编出的插件运行时会崩溃,所以在 macOS 上安装时的构建会中止并给出说明。
39
- 没有匹配的预编译件时,安装时从源码编译,需要 C++ 工具链与 Python。
37
+ npm 包提供 win32-x64 与 linux-x64 预编译二进制;macOS 及其他平台在安装时从源码编译,需要
38
+ C++ 工具链与 Python(macOS 上为 Xcode Command Line Tools)。随包的 CTP macOS 框架是 6.7.13 通用版,
39
+ 与 Windows/Linux 库是同一 CTP 版本。
40
40
 
41
41
  ---
42
42
 
package/docs/MIGRATION.md CHANGED
@@ -48,11 +48,11 @@ and margin schedule for an instrument have arrived (call `session()` or the
48
48
 
49
49
  ## Platform / toolchain
50
50
 
51
- - **macOS** is no longer shipped as a prebuild (Windows and Linux prebuilds are
52
- unchanged), and building it from source does not work either: the bundled
53
- CTP macOS frameworks are 6.7.7, while the headers and Windows/Linux libraries
54
- have been 6.7.13 since 1.2.0, so a macOS source build linked but crashed at
55
- runtime. The macOS build now stops at configure time with an explanation;
56
- macOS stays unsupported until a matching CTP Mac SDK is bundled.
51
+ - **macOS** is no longer shipped as a prebuild — it builds from source on
52
+ install (Windows and Linux prebuilds are unchanged). Use a release that
53
+ bundles the 6.7.13 Mac frameworks (4.1.3-rc.2 or later): from 1.2.0 the
54
+ bundled CTP macOS frameworks were still 6.7.7 under the 6.7.13 headers, so a
55
+ macOS source build linked but crashed at runtime (4.1.3-rc.1 refused to build
56
+ instead).
57
57
  - **Node `engines`** is restricted to the range required by `node-gyp` 13
58
58
  (`^22.22.2 || ^24.15.0 || >=26.0.0`); Node 20 and older 22 lines are excluded.
@@ -218,8 +218,8 @@ CTP reconnects on its own — re-run your handshake **in place** on every
218
218
  | `LNK1104: cannot open file ... ctp.node` | a wedged/zombie `node` process still holds the addon | find and `taskkill /F` the stray node process, then rebuild. |
219
219
  | `fatal error LNK1103: 调试信息损坏` | stale/corrupt build object (e.g. interrupted/parallel build) | `npx node-gyp rebuild` (clean rebuild). |
220
220
  | `MODULE_NOT_FOUND: node-addon-api` on a consumer install | source build with the build deps missing | fixed — `node-addon-api`/`node-gyp` are runtime `dependencies`; on an unshipped platform a C++ toolchain + Python are still required. |
221
- | macOS install fails: `ctp-node: refusing to build on macOS - CTP SDK version mismatch` | the bundled CTP macOS frameworks (6.7.7) are older than the 6.7.13 headers and Windows/Linux libraries; a build from them links (`-undefined dynamic_lookup`) but segfaults on the first API call, so `binding.gyp` stops it | macOS is not supported at the moment; use a Windows or Linux x64 host. (An older version that did build on macOS crashes at runtime for the same reason.) |
222
- | `.node` won't load on linux arm64 | no prebuild for that platform | it builds from source on install; ensure a toolchain is present. |
221
+ | macOS: segfault on the first API call (e.g. creating `MarketData`), or install stops with `ctp-node: refusing to build on macOS - CTP SDK version mismatch` | 1.2.0 through 4.1.3-rc.1 bundled CTP 6.7.7 macOS frameworks under the 6.7.13 headers; the build links (`-undefined dynamic_lookup`) but the factory functions and vtables don't match (4.1.3-rc.1 refuses to build instead) | upgrade to a release that bundles the 6.7.13 Mac frameworks (4.1.3-rc.2 or later) and reinstall so the addon is rebuilt. |
222
+ | `.node` won't load on macOS / linux arm64 | no prebuild for that platform | it builds from source on install; ensure a toolchain is present (macOS: Xcode Command Line Tools). |
223
223
  | C4819 codepage warning during build | Chinese comments in `.cc` under a GBK code page | harmless; ignore. |
224
224
 
225
225
  ---
@@ -183,8 +183,8 @@ npm run bench:fullmarket
183
183
  | `LNK1104: cannot open file ... ctp.node` | 一个卡死/僵尸 `node` 进程还占着该插件 | 找到并 `taskkill /F` 掉游离的 node 进程,再重新构建。 |
184
184
  | `fatal error LNK1103: 调试信息损坏` | 陈旧/损坏的构建产物(如被中断/并行构建) | `npx node-gyp rebuild`(干净重建)。 |
185
185
  | 使用方安装时 `MODULE_NOT_FOUND: node-addon-api` | 源码构建但缺构建依赖 | 已修复——`node-addon-api`/`node-gyp` 是运行时 `dependencies`;在未预编译的平台上仍需 C++ 工具链 + Python。 |
186
- | macOS 安装失败:`ctp-node: refusing to build on macOS - CTP SDK version mismatch` | 随包的 CTP macOS 框架(6.7.7)比 6.7.13 头文件和 Windows/Linux 库旧;由它编出的插件能链接(`-undefined dynamic_lookup`),但首次调用 API 就段错误,所以 `binding.gyp` 直接中止构建 | 目前不支持 macOS;请使用 Windows 或 Linux x64 主机。(旧版本若在 macOS 上编译成功,运行时同样会因此崩溃。) |
187
- | linux arm64 上 `.node` 加载失败 | 该平台无预编译 | 安装时从源码构建;确保有工具链。 |
186
+ | macOS:首次调用 API(如创建 `MarketData`)就段错误,或安装时报 `ctp-node: refusing to build on macOS - CTP SDK version mismatch` | 1.2.0 至 4.1.3-rc.1 随包的是 CTP 6.7.7 macOS 框架,头文件却是 6.7.13;能链接(`-undefined dynamic_lookup`),但工厂函数和虚表对不上(4.1.3-rc.1 改为直接中止构建) | 升级到带 6.7.13 Mac 框架的版本(4.1.3-rc.2 及以后)并重新安装,让插件重新编译。 |
187
+ | macOS / linux arm64 上 `.node` 加载失败 | 该平台无预编译 | 安装时从源码构建;确保有工具链(macOS:Xcode Command Line Tools)。 |
188
188
  | 构建时 C4819 代码页警告 | GBK 代码页下 `.cc` 里的中文注释 | 无害;忽略。 |
189
189
 
190
190
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitrading/ctp-node",
3
- "version": "4.1.3-rc.1",
3
+ "version": "4.1.3",
4
4
  "description": "High-performance, type-safe CTP (Chinese futures) binding for Node.js",
5
5
  "keywords": [
6
6
  "ctp",