返回顶部
o

okx-proOKX专业版

完整 OKX 交易所集成,U本位/币本位合约,杠杆交易,止盈止损,仓位管理

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
230
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

okx-pro

OKX Pro 🟧

专业 OKX 交易所交易技能 - 全球领先的加密货币合约交易所。

🚀 快速开始

设置凭证

保存至 ~/.openclaw/credentials/okx.json:
json
{
apiKey: YOURAPIKEY,
secretKey: YOURSECRETKEY,
passphrase: YOUR_PASSPHRASE
}

环境变量(备选)

bash export OKXAPIKEY=yourapikey export OKXSECRET=yoursecret_key export OKXPASSPHRASE=yourpassphrase

📖 技术文档 | Technical Documentation

中文文档

1. 概述

OKX Pro 是一个完整的 OKX 交易所集成技能,支持:

  • - 现货交易 (Spot Trading)
  • 合约交易 (Futures Trading)
  • U本位合约 / 币本位合约
  • 杠杆交易 (Leverage Trading)
  • 止盈止损 (Take Profit / Stop Loss)
  • 仓位管理 (Position Management)

2. API 版本

本技能使用 OKX V5 API:

  • - 基础URL: https://www.okx.com
  • 所有请求需要签名认证

3. 支持的交易对

交易对说明
BTC-USDTBTC 现货
ETH-USDT
ETH 现货 | | BTC-USDT-SWAP | BTC U本位永续合约 | | ETH-USDT-SWAP | ETH U本位永续合约 | | BTC-USD-SWAP | BTC 币本位永续合约 |

4. 交易参数

参数说明示例
instId交易对IDBTC-USDT-SWAP
tdMode
仓位模式 | cross(全仓) / isolated(逐仓) | | side | 交易方向 | buy / sell | | ordType | 订单类型 | market / limit / conditional | | sz | 数量 | 0.001 | | px | 价格 | 50000 | | SL | 止损 | slTriggerPx | | TP | 止盈 | tpTriggerPx |

5. 订单类型详解

市价单 (Market Order)

立即以市场价成交 json {instId:BTC-USDT-SWAP,tdMode:cross,side:buy,ordType:market,sz:0.001}

限价单 (Limit Order)

指定价格成交 json {instId:BTC-USDT-SWAP,tdMode:cross,side:buy,ordType:limit,sz:0.001,px:50000}

条件单 (Conditional Order)

止盈止损订单 json { instId: BTC-USDT-SWAP, tdMode: cross, side: sell, ordType: conditional, sz: 0.001, slTriggerPx: 45000, slOrdPx: -1 }

6. 止盈止损详解

  • - slTriggerPx: 止损触发价格
  • slOrdPx: 止损订单价格 (-1 = 市价)
  • tpTriggerPx: 止盈触发价格
  • tpOrdPx: 止盈订单价格

7. 仓位管理

操作API
查询仓位GET /api/v5/position/positions
设置杠杆
POST /api/v5/account/set-leverage | | 追加保证金 | POST /api/v5/account/increase-margin | | 减少保证金 | POST /api/v5/account/decrease-margin |

8. 风险控制

⚠️ 安全规则:

  1. 1. 杠杆不超过10x(新手建议2-3x)
  2. 始终设置止损
  3. 大额订单先确认
  4. 测试网验证后再实盘



English Documentation

1. Overview

OKX Pro provides complete OKX exchange integration:

  • - Spot Trading
  • Futures Trading (U-Margin / Coin-Margin)
  • Leverage Trading
  • Take Profit / Stop Loss
  • Position Management

2. API Version

Uses OKX V5 API:

  • - Base URL: https://www.okx.com
  • All requests require signature authentication

3. Supported Trading Pairs

PairDescription
BTC-USDTBTC Spot
ETH-USDT
ETH Spot | | BTC-USDT-SWAP | BTC USDT-Margin Perpetual | | ETH-USDT-SWAP | ETH USDT-Margin Perpetual |

4. Trading Parameters

ParameterDescriptionExample
instIdInstrument IDBTC-USDT-SWAP
tdMode
Trade Mode | cross / isolated | | side | Order Side | buy / sell | | ordType | Order Type | market / limit / conditional | | sz | Size | 0.001 | | px | Price | 50000 |

5. Order Types

Market Order

Execute immediately at market price json {instId:BTC-USDT-SWAP,tdMode:cross,side:buy,ordType:market,sz:0.001}

Limit Order

Execute at specified price json {instId:BTC-USDT-SWAP,tdMode:cross,side:buy,ordType:limit,sz:0.001,px:50000}

Conditional Order

Stop loss / Take profit orders json { instId: BTC-USDT-SWAP, tdMode: cross, side: sell, ordType: conditional, sz: 0.001, slTriggerPx: 45000, slOrdPx: -1 }

6. Stop Loss / Take Profit

  • - slTriggerPx: Stop loss trigger price
  • slOrdPx: Stop loss order price (-1 = market)
  • tpTriggerPx: Take profit trigger price
  • tpOrdPx: Take profit order price

7. Position Management

OperationAPI
Get PositionsGET /api/v5/position/positions
Set Leverage
POST /api/v5/account/set-leverage | | Increase Margin | POST /api/v5/account/increase-margin | | Decrease Margin | POST /api/v5/account/decrease-margin |

8. Risk Control

⚠️ Safety Rules:

  1. 1. Leverage max 10x (beginners: 2-3x)
  2. Always set stop loss
  3. Confirm large orders
  4. Test on demo trading first



🔐 签名辅助工具

bash

生成 OKX 签名的函数


okx_sign() {
local method=$1
local request_path=$2
local body=$3
local timestamp=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)
local message=${timestamp}${method}${request_path}${body}
local signature=$(echo -n $message | openssl dgst -sha256 -hmac $OKX_SECRET | cut -d -f2)
echo $signature
}

okx_request() {
local method=$1
local endpoint=$2
local body=$3
local timestamp=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)
local signature=$(okx_sign $method $endpoint $body)

curl -s -X $method https://www.okx.com$endpoint \
-H Content-Type: application/json \
-H OKX-ACCESS-KEY: $OKXAPIKEY \
-H OKX-ACCESS-SIGN: $signature \
-H OKX-ACCESS-TIMESTAMP: $timestamp \
-H OKX-ACCESS-PASSPHRASE: $OKX_PASSPHRASE \
-d $body
}

📊 基础查询

查询余额

bash okx_request GET /api/v5/account/balance

获取当前价格

bash curl -s https://www.okx.com/api/v5/market/ticker?instId=BTC-USDT | jq .data[0]

获取所有仓位

bash okx_request GET /api/v5/position/positions

⚡ 合约交易

开多仓(买入)

bash INST_ID=BTC-USDT-SWAP SZ=0.001 TD_MODE=cross

okxrequest POST /api/v5/trade/order {\instId\:\$INSTID\,\tdMode

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 okx-pro-1776201842 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 okx-pro-1776201842 技能

通过命令行安装

skillhub install okx-pro-1776201842

下载

⬇ 下载 okx-pro v1.1.0(免费)

文件大小: 3.82 KB | 发布时间: 2026-4-17 15:34

v1.1.0 最新 2026-4-17 15:34
Version 1.1.0 introduces major documentation improvements.

- Added detailed bilingual (Chinese/English) technical documentation, including trading parameters, order types, risk controls, and position management.
- Clarified supported trading pairs and API operations in both languages.
- Existing quick start instructions and signature helpers are preserved and reorganized for clarity.
- No changes to core commands or logic, documentation only.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部