@okx_ai/okx-trade-cli 1.0.8
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/LICENSE +21 -0
- package/README.md +104 -0
- package/dist/index.js +2580 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OKX
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# okx-trade-cli
|
|
2
|
+
|
|
3
|
+
## English
|
|
4
|
+
|
|
5
|
+
Command line tool for OKX. Supports market data, account queries, spot and swap
|
|
6
|
+
trading, and configuration management.
|
|
7
|
+
|
|
8
|
+
### Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @okx_ai/okx-trade-cli
|
|
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"
|
|
25
|
+
|
|
26
|
+
[profiles.demo]
|
|
27
|
+
api_key = "your-demo-api-key"
|
|
28
|
+
secret_key = "your-demo-secret-key"
|
|
29
|
+
passphrase = "your-demo-passphrase"
|
|
30
|
+
demo = true
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Quick usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
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
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
okx market candles BTC-USDT --bar 1H --limit 10
|
|
47
|
+
okx account balance BTC,ETH
|
|
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
|
+
```
|
|
51
|
+
|
|
52
|
+
For more details, see the repository README.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 中文
|
|
57
|
+
|
|
58
|
+
OKX 命令行工具,支持行情、账户查询、现货与合约交易,以及配置管理。
|
|
59
|
+
|
|
60
|
+
### 安装
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install -g @okx_ai/okx-trade-cli
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 配置凭证
|
|
67
|
+
|
|
68
|
+
创建 `~/.okx/config.toml`:
|
|
69
|
+
|
|
70
|
+
```toml
|
|
71
|
+
default_profile = "demo"
|
|
72
|
+
|
|
73
|
+
[profiles.live]
|
|
74
|
+
api_key = "your-live-api-key"
|
|
75
|
+
secret_key = "your-live-secret-key"
|
|
76
|
+
passphrase = "your-live-passphrase"
|
|
77
|
+
|
|
78
|
+
[profiles.demo]
|
|
79
|
+
api_key = "your-demo-api-key"
|
|
80
|
+
secret_key = "your-demo-secret-key"
|
|
81
|
+
passphrase = "your-demo-passphrase"
|
|
82
|
+
demo = true
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 快速使用
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
okx market ticker BTC-USDT
|
|
89
|
+
okx market orderbook BTC-USDT --sz 5
|
|
90
|
+
okx account balance
|
|
91
|
+
okx spot orders
|
|
92
|
+
okx swap positions
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 示例
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
okx market candles BTC-USDT --bar 1H --limit 10
|
|
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
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
更多说明请参考仓库根目录 README。
|