trading skills: 文档同步 (单币上限规则/平仓盈亏字段/静默规则/推送模板)

This commit is contained in:
2026-09-25 01:25:13 +08:00
parent c83161d87e
commit f46abb8ca3
111 changed files with 12151 additions and 224 deletions
+25 -2
View File
@@ -2,8 +2,9 @@
name: okx-crypto
description: >
OKX cryptocurrency exchange integration via ccxt. Account balance, positions (spot + contracts),
order management, and price monitoring. Use when user asks about OKX, crypto holdings, BTC/ETH/SOL
prices, or wants to check/manage their exchange account. Requires Mihomo proxy from this server.
order management, and price monitoring. Use when user asks about OKX, crypto holdings, BTC/ETH/SOL prices,
or wants to check/manage their exchange account. Requires Mihomo proxy from this server.
⚠️ contractSize ≠ 1 张 = 1 个币 (ZEC 1 张 = 0.01 ZEC, 推送必须展示名义 $ 而非张数); 查询持仓看 OKX fetch_positions() 不是信号队列; SQLite/API 时间 UTC 必须 +8h 转北京。
trigger:
- okx
- crypto holdings
@@ -483,6 +484,28 @@ max_contracts = int(avail_usdt * 0.95 / margin_per) # 95% buffer
print(f"每张保证金: {margin_per:.2f}, 可开: {max_contracts}张")
```
### ⚠️ CRITICAL: `contractSize` ≠ 1 张 = 1 个币 (2026-09-04 实战, user 原话 "我只能买 0.95 刀的?")
OKX SWAP 合约的"张" = `contractSize` 个币, **不是 1 个币**:
| 合约 | contractSize | 1 张名义 (按 ~$1000 BTC) |
|---|---|---|
| BTC-USDT-SWAP | 0.01 | 0.01 BTC ≈ $1000 |
| ETH-USDT-SWAP | 0.1 | 0.1 ETH ≈ $400 |
| SOL-USDT-SWAP | 1 | 1 SOL ≈ $200 |
| ZEC-USDT-SWAP | 0.01 | 0.01 ZEC ≈ $9.5 |
| SKHYNIX/SPCX-USDT-SWAP | 0.01 | 0.01 个币 |
**示例** (ZEC @ $955, 1 张 @ 10x):
- 1 张 ZEC = 0.01 × $955 = **$9.56 名义** (不是 $955)
- 10x 杠杆 → 保证金 **$0.96** (不是 $95.6)
**铁律**:
- 下单前先 `ex.load_markets()` + `ex.market(symbol)['contractSize']`
- 计算: `名义 = 张数 × contractSize × price`
- 推送展示 **名义 $**, 不要只说"买 X 张" (用户会误解成买 X 个币)
- 用户说"买 X 张" → agent 应自动换算成 "0.Y 币 = $Z 名义" 二次确认
### Pitfalls (continued)
- **`set_margin_mode` error**: OKX returns `params["lever"] should be between 1 and 125` if margin mode is already set. This is **harmless** — the error message is misleading (mentions `lever` even though you're setting margin mode). Safe to catch and ignore. Full error: `okx setMarginMode() params["lever"] should be between 1 and 125`.