Xpersona
O

OKX Trade Kit

CLAWHUB · Unverified

Setup, install, and use OKX Agent Trade Kit — the official OKX toolkit for AI-powered trading. Use this skill whenever the user mentions: OKX trading, agent...

62
Rank
84
Safety
1.4k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17171pjtbb9j0vq0knmk2avqx83k868:okx-trade
  1. Install using `clawhub skill install s17171pjtbb9j0vq0knmk2avqx83k868:okx-trade` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/chingchiu169/okx-trade before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-chingchiu169-okx-trade/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

19,757 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: okx-agent-tradekit
description: >
  Setup, install, and use OKX Agent Trade Kit — the official OKX toolkit for AI-powered trading.
  Use this skill whenever the user mentions: OKX trading, agent tradekit, okx-trade-mcp, okx Skills,
  installing OKX on OpenClaw, configuring OKX API keys, trading BTC/ETH/crypto with natural language,
  spot/futures/options/grid bots on OKX, or wants to connect an AI agent to OKX exchange.
  Trigger this skill even if the user just says "想用 OKX 交易" or "幫我裝 OKX" or "OKX MCP".
  Covers: installation (OpenClaw Skills or MCP), API key config, natural language trading commands,
  demo mode setup, and explaining what the toolkit does and how it works.
---

# OKX Agent Trade Kit Skill

OKX Agent Trade Kit 係 OKX 官方出嘅 open-source toolkit,讓 AI agent 直接用自然語言執行交易。

## Overview

三種使用方式:
1. **Skills(OpenClaw 用戶首選)** — `npx skills add okx/agent-skills`,一行搞掂
2. **MCP Server** — 適合 Claude Desktop、Claude Code、Cursor、VS Code
3. **CLI** — terminal 直接落指令,可以 pipe 入 script

---

## 流程判斷

```
用戶係用 OpenClaw?
  ├─ Yes → 用 Skills 安裝方式(最快,一行指令)
  └─ No  → 用 MCP 安裝方式(npm install + setup)

用戶想交易?
  ├─ 先確認有無配置 API key
  ├─ 建議先用 demo 模式測試
  └─ 提醒用 sub-account API key,唔好用 main account
```

---

## 安裝:OpenClaw(Skills 方式)⭐ 推薦

### Step 1 — 安裝 Skills

直接係 **OpenClaw chat 入面** 貼呢句(唔係 terminal):

```
Run `npx skills add okx/agent-skills`, resolve any issues you encounter, then check the BTC price.
```

呢個會自動裝好四個 skills:
| Skill | Package | 功能 | 需要 API Key? |
|-------|---------|------|--------------|
| Market Data | `okx-cex-market` | 實時行情、K 線、資金費率、未平倉量 | ❌ 唔需要 |
| Trading | `okx-cex-trade` | Spot、合約、期權、Algo 訂單、Grid Bot | ✅ 需要 |
| Portfolio | `okx-cex-portfolio` | 餘額、持倉、P&L、帳單、手續費率 | ✅ 需要 |
| Bots | `okx-cex-bot` | Grid Bot(現貨/合約)、DCA 策略 | ✅ 需要 |

### Step 2 — 配置 API Key

打開 **Terminal**,執行:

```bash
mkdir -p ~/.okx && cat > ~/.okx/config.toml << 'EOF'
default_profile = "demo"

[profiles.live]
api_key    = "your-live-api-key"
secret_key = "your-live-secret-key"
passphrase = "your-live-passphrase"

[profiles.demo]
api_key    = "your-demo-api-key"
secret_key = "your-demo-secret-key"
passphrase = "your-demo-passphrase"
demo       = true
EOF
```

之後用文字編輯器開 `~/.okx/config.toml`,填入真實嘅 API credentials。

**去哪攞 API Key?** → https://www.okx.com/account/my-api
- ✅ 建議先攞 **demo key** 試用
- ✅ 用 **sub-account** 嘅 API key,唔好用 main account
- ⚠️ 永遠唔好將 API key 貼入 chat 入面

---

## 安裝:MCP Clients(Claude Desktop / Cursor / VS Code)

詳細步驟見 → [references/mcp-setup.md](references/mcp-setup.md)

---

## 自然語言交易指令示例

裝好之後,可以直接係 AI chat 入面講:

```
# 行情查詢(唔需要 API key)
What's the BTC price on OKX?
Show BTC-USDT order book
BTC-USDT-SWAP 嘅資金費率係幾多?

# 帳戶(需要 API key)
Show my account balance
我而家有咩持倉?

# 交易(demo 模式,無風險)
Buy 100 USDT of BTC at market on demo
Set a limit buy for 0.01 BTC at 80000 on demo
Place a stop-loss at 84000 for my BTC-USDT-SWAP long

# Grid Bot
Create a BTC grid bot between 80000 and 100000 with 10 grids and 100 USDT
```

---

## 安全提示(每次涉及交易時都要提醒)

1. **永遠唔好** 

_meta.json

{
  "ownerId": "kn73fxzt344xnfbwzcdy80ds9d835j93",
  "slug": "okx-trade",
  "version": "1.0.1",
  "publishedAt": 1775802596783
}

references/mcp-setup.md

# MCP Client Setup(Claude Desktop / Cursor / VS Code / Windsurf)

## Step 1 — Install

```bash
npm install -g @okx_ai/okx-trade-mcp @okx_ai/okx-trade-cli
```

驗證安裝成功(唔需要 API key):
```bash
okx market ticker BTC-USDT
```

## Step 2 — 配置 API Credentials

```bash
okx config init
```

呢個係互動式 wizard,跟住做就係。完成之後會係 `~/.okx/config.toml` 生成設定檔。

或者手動建立 `~/.okx/config.toml`:

```toml
default_profile = "demo"

[profiles.demo]
api_key    = "your-demo-api-key"
secret_key = "your-demo-secret-key"
passphrase = "your-demo-passphrase"
demo       = true

[profiles.live]
api_key    = "your-live-api-key"
secret_key = "your-live-secret-key"
passphrase = "your-live-passphrase"
# 歐洲用戶加: site = "eea"
# 美國用戶加: site = "us"
```

## Step 3 — 連接 AI Client

```bash
okx-trade-mcp setup --client <client>
```

| Client | `<client>` 值 |
|--------|--------------|
| Claude Desktop | `claude-desktop` |
| Claude Code | `claude-code` |
| Cursor | `cursor` |
| VS Code | `vscode` |
| Windsurf | `windsurf` |
| Windsurf | `windsurf` |

## 4 層安全保護

| Layer | 說明 |
|-------|------|
| `--demo` | 模擬資金,零真錢風險 |
| `--read-only` | 只能查數據,禁止下單 |
| Smart Registration | 啟動時驗 API 權限,無權限嘅 tools 唔顯示 |
| Risk Labels | 涉錢 tools 標 `[CAUTION]`,AI 會先確認 |


| 需求 | 指令 |
|------|------|
| 只要行情(唔需要 key) | `okx-trade-mcp --modules market` |
| Demo 模式,全功能 | `okx-trade-mcp --profile demo --modules all` |
| Live,只讀監控 | `okx-trade-mcp --profile live --read-only` |
| Live,只做 Spot | `okx-trade-mcp --profile live --modules market,spot` |
| Live,合約 + 期權 | `okx-trade-mcp --profile live --modules market,swap,option` |

references/tools-reference.md

# OKX Agent Trade Kit — 完整 Tools 參考

共 8 個 module,121 個 tools(以官方 GitHub 為準)。

## market — 行情數據(唔需要 API Key)

| Tool | 說明 |
|------|------|
| `market_get_ticker` | 單個合約 ticker(最新價、24h 量、bid/ask) |
| `market_get_tickers` | 某類型所有 ticker(SPOT/SWAP/FUTURES/OPTION) |
| `market_get_orderbook` | 訂單簿深度 |
| `market_get_candles` | K 線(最近 300 根) |
| `market_get_history_candles` | 歷史 K 線(2 天前,最多 3 個月) |
| `market_get_funding_rate` | 永續合約資金費率 |
| `market_get_funding_rate_history` | 歷史資金費率 |
| `market_get_mark_price` | 標記價格 |
| `market_get_open_interest` | 未平倉量 |
| `market_get_trades` | 最近成交記錄 |

## spot — 現貨交易

| Tool | 說明 |
|------|------|
| `spot_place_order` | 下現貨訂單(market/limit/post-only/FOK/IOC) |
| `spot_cancel_order` | 撤單 |
| `spot_amend_order` | 改價/改量 |
| `spot_batch_place_orders` | 批量下單(最多 20 筆) |
| `spot_batch_cancel_orders` | 批量撤單 |
| `spot_get_order` | 查詢單筆訂單 |
| `spot_get_open_orders` | 當前掛單列表 |
| `spot_get_order_history` | 歷史訂單(7 天內) |
| `spot_get_fills` | 成交記錄 |

## swap — 永續合約

| Tool | 說明 |
|------|------|
| `swap_place_order` | 下永續合約訂單 |
| `swap_cancel_order` | 撤單 |
| `swap_close_position` | 一鍵平倉 |
| `swap_get_positions` | 當前持倉 |
| `swap_set_leverage` | 設置槓桿 |
| `swap_get_leverage` | 查詢當前槓桿 |

## futures — 交割合約

| Tool | 說明 |
|------|------|
| `futures_place_order` | 下交割合約訂單 |
| `futures_get_positions` | 持倉查詢 |

## option — 期權

| Tool | 說明 |
|------|------|
| `option_place_order` | 下期權訂單(買/賣 call/put) |
| `option_get_instruments` | 期權鏈 |
| `option_get_greeks` | IV 同 Greeks(delta/gamma/theta/vega) |
| `option_get_positions` | 持倉(含 Greeks) |

## account — 帳戶管理

| Tool | 說明 |
|------|------|
| `account_get_balance` | 交易帳戶餘額 |
| `account_get_asset_balance` | 資金帳戶餘額 |
| `account_get_positions` | 全帳戶持倉 |
| `account_get_bills` | 帳單/流水(7 天) |
| `account_get_fee_rates` | 手續費率 |
| `account_set_leverage` | 設置槓桿 |

## bot — 交易機器人

### Grid Bot
| Tool | 說明 |
|------|------|
| `grid_create_order` | 建立 Grid Bot(現貨/合約/Moon Grid) |
| `grid_stop_order` | 停止 Grid Bot |
| `grid_get_orders` | 查看 Grid Bot 列表 |

### DCA Bot
| Tool | 說明 |
|------|------|
| `dca_create_order` | 建立 DCA(馬丁格爾)策略 |
| `dca_stop_order` | 停止 DCA 策略 |
| `dca_get_orders` | 查看 DCA 策略列表 |

---

最新完整列表:https://github.com/okx/agent-trade-kit

skill-card.md

## Description:

Setup, install, and use OKX Agent Trade Kit for AI-assisted OKX market data, portfolio, trading, and bot workflows.

This skill is ready for commercial/non-commercial use.

## Publisher:

[chingchiu169](https://clawhub.ai/user/chingchiu169)

### License/Terms of Use:

MIT-0

## Use Case:

External users and developers use this skill to install, configure, and operate OKX Agent Trade Kit through OpenClaw or MCP-compatible clients. It supports market data lookup, account review, demo trading, live trading setup, and grid or DCA bot guidance.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill instructs users to install mutable npm packages with npx or npm.

Mitigation: Verify the package source and version before installation, avoid global installation where possible, and review the package before use.

Risk: The skill supports live trading with exchange API credentials.

Mitigation: Start in demo or read-only mode, use a dedicated OKX subaccount, grant only required permissions, and keep withdrawals disabled.

Risk: The skill stores OKX credentials in ~/.okx/config.toml.

Mitigation: Protect the configuration file with restrictive permissions, such as a private directory and 0600 file mode.

## Reference(s):

- [OKX Agent Trade Kit documentation](https://www.okx.com/docs-v5/agent_en/)
- [OKX Agent Trade Kit GitHub repository](https://github.com/okx/agent-trade-kit)
- [MCP Client Setup](references/mcp-setup.md)
- [OKX Agent Trade Kit Tools Reference](references/tools-reference.md)
- [ClawHub skill page](https://clawhub.ai/chingchiu169/skills/okx-trade)

## Skill Output:

**Output Type(s):** [text, markdown, shell commands, configuration, guidance]

**Output Format:** [Markdown with inline shell commands, TOML configuration snippets, tables, and natural-language examples]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [May include trading setup guidance and safety reminders before money-moving actions.]

## Skill Version(s):

1.0.1 (source: server release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to OKX Trade Kit and adjacent AI workflows.