okx-trade-cli 1.0.4 → 1.0.7
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 +32 -78
- package/bin/okx.mjs +2 -0
- package/package.json +11 -33
- package/LICENSE +0 -21
- package/dist/index.js +0 -2400
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,104 +1,58 @@
|
|
|
1
1
|
# okx-trade-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> `@okx_retail/okx-trade-cli` 的无 scope alias 包。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
trading, and configuration management.
|
|
7
|
-
|
|
8
|
-
### Install
|
|
5
|
+
## 安装
|
|
9
6
|
|
|
10
7
|
```bash
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### Configure credentials
|
|
15
|
-
|
|
16
|
-
Create `~/.okx/config.toml`:
|
|
17
|
-
|
|
18
|
-
```toml
|
|
19
|
-
default_profile = "demo"
|
|
20
|
-
|
|
21
|
-
[profiles.live]
|
|
22
|
-
api_key = "your-live-api-key"
|
|
23
|
-
secret_key = "your-live-secret-key"
|
|
24
|
-
passphrase = "your-live-passphrase"
|
|
8
|
+
# 无 scope(更简洁)
|
|
9
|
+
npm install okx-trade-cli
|
|
25
10
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
secret_key = "your-demo-secret-key"
|
|
29
|
-
passphrase = "your-demo-passphrase"
|
|
30
|
-
demo = true
|
|
11
|
+
# 带 scope(官方标准写法)
|
|
12
|
+
npm install @okx_retail/okx-trade-cli
|
|
31
13
|
```
|
|
32
14
|
|
|
33
|
-
|
|
15
|
+
两种方式完全等价,安装后暴露相同的可执行命令。
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
okx market ticker BTC-USDT
|
|
37
|
-
okx market orderbook BTC-USDT --sz 5
|
|
38
|
-
okx account balance
|
|
39
|
-
okx spot orders
|
|
40
|
-
okx swap positions
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Examples
|
|
17
|
+
## 提供的命令
|
|
44
18
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
okx
|
|
48
|
-
okx spot place --instId BTC-USDT --side buy --ordType market --sz 100
|
|
49
|
-
okx swap leverage --instId BTC-USDT-SWAP --lever 10 --mgnMode cross
|
|
50
|
-
```
|
|
19
|
+
| 命令 | 对应原包 | 用途 |
|
|
20
|
+
|------|---------|------|
|
|
21
|
+
| `okx` | `@okx_retail/okx-trade-cli` | OKX CLI 工具 |
|
|
51
22
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## 中文
|
|
57
|
-
|
|
58
|
-
OKX 命令行工具,支持行情、账户查询、现货与合约交易,以及配置管理。
|
|
59
|
-
|
|
60
|
-
### 安装
|
|
23
|
+
## 使用示例
|
|
61
24
|
|
|
62
25
|
```bash
|
|
63
|
-
|
|
26
|
+
npx okx market ticker BTC-USDT
|
|
27
|
+
npx okx account balance
|
|
28
|
+
npx okx swap positions
|
|
29
|
+
npx okx --help
|
|
64
30
|
```
|
|
65
31
|
|
|
66
|
-
|
|
32
|
+
所有功能、参数、行为均来自主包,本包不含任何独立逻辑。
|
|
67
33
|
|
|
68
|
-
|
|
34
|
+
---
|
|
69
35
|
|
|
70
|
-
|
|
71
|
-
default_profile = "demo"
|
|
36
|
+
## 版本同步策略
|
|
72
37
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
38
|
+
| 事件 | 操作 |
|
|
39
|
+
|------|------|
|
|
40
|
+
| 主包发布新 patch/minor | 更新本包 `package.json` 中的依赖版本,打 tag 自动发布 |
|
|
41
|
+
| 主包发布新 major | 同上,同时更新本包 major 版本号保持一致 |
|
|
77
42
|
|
|
78
|
-
|
|
79
|
-
api_key = "your-demo-api-key"
|
|
80
|
-
secret_key = "your-demo-secret-key"
|
|
81
|
-
passphrase = "your-demo-passphrase"
|
|
82
|
-
demo = true
|
|
83
|
-
```
|
|
43
|
+
---
|
|
84
44
|
|
|
85
|
-
|
|
45
|
+
## 发布流程
|
|
86
46
|
|
|
87
47
|
```bash
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
okx account balance
|
|
91
|
-
okx spot orders
|
|
92
|
-
okx swap positions
|
|
93
|
-
```
|
|
48
|
+
# 1. 更新依赖版本号
|
|
49
|
+
# "dependencies": { "@okx_retail/okx-trade-cli": "^x.x.x" }
|
|
94
50
|
|
|
95
|
-
|
|
51
|
+
# 2. 同步本包版本号
|
|
52
|
+
npm version patch # 或 minor / major
|
|
96
53
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
okx account balance BTC,ETH
|
|
100
|
-
okx spot place --instId BTC-USDT --side buy --ordType market --sz 100
|
|
101
|
-
okx swap leverage --instId BTC-USDT-SWAP --lever 10 --mgnMode cross
|
|
54
|
+
# 3. 打 tag,CI 自动发布
|
|
55
|
+
git push --follow-tags
|
|
102
56
|
```
|
|
103
57
|
|
|
104
|
-
|
|
58
|
+
> 需要在 GitHub repo Settings → Secrets 中配置 `NPM_TOKEN`。
|
package/bin/okx.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,40 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "okx-trade-cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"main": "dist/index.js",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Alias package for @okx_retail/okx-trade-cli — supports both install methods",
|
|
8
5
|
"bin": {
|
|
9
|
-
"okx": "
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"README.md"
|
|
14
|
-
],
|
|
15
|
-
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
6
|
+
"okx": "bin/okx.mjs"
|
|
17
7
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
8
|
+
"files": ["bin"],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"prepublishOnly": "node -e \"require('fs').chmodSync('bin/okx.mjs',0o755)\""
|
|
20
11
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"trading"
|
|
25
|
-
],
|
|
12
|
+
"engines": { "node": ">=18" },
|
|
13
|
+
"keywords": ["okx", "cli", "trading", "alias"],
|
|
14
|
+
"license": "MIT",
|
|
26
15
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/node": "^25.2.2",
|
|
31
|
-
"tsup": "^8.5.1",
|
|
32
|
-
"typescript": "^5.9.3",
|
|
33
|
-
"@okx-hub/core": "1.0.0"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "tsup",
|
|
37
|
-
"typecheck": "tsc --noEmit",
|
|
38
|
-
"clean": "rm -rf dist"
|
|
16
|
+
"@okx_retail/okx-trade-cli": "^1.0.7"
|
|
39
17
|
}
|
|
40
|
-
}
|
|
18
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 okx-hub
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|