@hitrading/ctp-node 1.0.0 → 1.1.0

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.
package/README.md CHANGED
@@ -39,6 +39,15 @@ Node ≥ 18. Prebuilt binaries are shipped for Windows/Linux/macOS (x64), so mos
39
39
  npm install @hitrading/ctp-node
40
40
  ```
41
41
 
42
+ Works in **TypeScript or JavaScript**, as **ESM (`import`) or CommonJS (`require`)** — the package ships both builds plus `.d.ts` type declarations, so it loads whatever your project's module setting emits:
43
+
44
+ ```ts
45
+ import { Trader, MarketData } from "@hitrading/ctp-node"; // ESM / TypeScript
46
+ ```
47
+ ```js
48
+ const { Trader, MarketData } = require("@hitrading/ctp-node"); // CommonJS
49
+ ```
50
+
42
51
  ## Documentation
43
52
 
44
53
  - **Full API reference** — every TypeScript/JavaScript interface and method, with each parameter's type and meaning, plus usage examples: [English](docs/API.md) · [简体中文](docs/API.zh-CN.md)
@@ -51,7 +60,7 @@ npm install @hitrading/ctp-node
51
60
  ```ts
52
61
  import { MarketData } from "@hitrading/ctp-node";
53
62
 
54
- const md = new MarketData("./flow/md/", "tcp://180.168.146.187:10212");
63
+ const md = new MarketData("./flow/md/", "tcp://182.254.243.31:30012");
55
64
 
56
65
  md.on("front-connected", async () => {
57
66
  await md.login({ brokerId: "9999", userId: "xxxx", password: "xxxx" });
@@ -69,7 +78,7 @@ md.on("rtn-depth-market-data", (tick) => {
69
78
  ```ts
70
79
  import { Trader } from "@hitrading/ctp-node";
71
80
 
72
- const td = new Trader("./flow/td/", "tcp://180.168.146.187:10202");
81
+ const td = new Trader("./flow/td/", "tcp://182.254.243.31:30002");
73
82
 
74
83
  // Pre-trade risk, enforced in C++ on every order:
75
84
  td.riskSet({ maxOrderVolume: 10, maxOrdersPerSec: 20, maxPriceDeviation: 0.02, maxPositionCost: 5_000_000 });
package/README.zh-CN.md CHANGED
@@ -39,6 +39,15 @@ Node ≥ 18。Windows/Linux/macOS(x64)提供预编译二进制,多数用
39
39
  npm install @hitrading/ctp-node
40
40
  ```
41
41
 
42
+ 支持 **TypeScript 或 JavaScript**、**ESM(`import`)或 CommonJS(`require`)**——包内同时发布两种构建产物与 `.d.ts` 类型声明,按你项目的模块设置自动加载对应格式:
43
+
44
+ ```ts
45
+ import { Trader, MarketData } from "@hitrading/ctp-node"; // ESM / TypeScript
46
+ ```
47
+ ```js
48
+ const { Trader, MarketData } = require("@hitrading/ctp-node"); // CommonJS
49
+ ```
50
+
42
51
  ## 文档
43
52
 
44
53
  - **完整 API 参考** —— 每一个 TypeScript/JavaScript 接口和方法,含每个参数的类型与含义,以及用法示例:[English](docs/API.md) · [简体中文](docs/API.zh-CN.md)