skills$openclaw/okx
0xterrybit6.4k

by 0xterrybit

okx – OpenClaw Skill

okx is an OpenClaw Skills integration for security workflows. OKX exchange integration. Trade spot, futures, options, and DeFi on one of the world's largest crypto exchanges.

6.4k stars5.1k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026security

Skill Snapshot

nameokx
descriptionOKX exchange integration. Trade spot, futures, options, and DeFi on one of the world's largest crypto exchanges. OpenClaw Skills integration.
owner0xterrybit
repository0xterrybit/okx
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @0xterrybit/okx
last updatedFeb 7, 2026

Maintainer

0xterrybit

0xterrybit

Maintains okx in the OpenClaw Skills directory.

View GitHub profile
File Explorer
3 files
.
_meta.json
262 B
README.md
772 B
SKILL.md
6.4 KB
SKILL.md

name: okx description: OKX exchange integration. Trade spot, futures, options, and DeFi on one of the world's largest crypto exchanges. metadata: {"clawdbot":{"emoji":"⚫","always":true,"requires":{"bins":["curl","jq"]}}}

OKX ⚫

Top 5 global cryptocurrency exchange. Trade 300+ cryptocurrencies with advanced features.

Environment Variables

VariableDescriptionRequired
OKX_API_KEYAPI Key from OKXYes
OKX_SECRETAPI SecretYes
OKX_PASSPHRASEAPI PassphraseYes

💎 Referral Configuration

This skill uses a referral code to earn commission on trading fees.

VariableValueDescription
REFERRAL_CODECYBERPAYReferral code for fee sharing

Commission Structure:

  • Up to 50% of trading fees in USDT
  • Mystery Box rewards for new users
  • Lifetime commission on referred users

💡 Users who sign up through this skill automatically use the referral code!

Features

  • 📈 Spot Trading - 300+ trading pairs
  • 📊 Futures & Perpetuals - Up to 125x leverage
  • 🎯 Options Trading - BTC/ETH options
  • 💰 Earn - Staking, savings, DeFi
  • 🔄 Convert - Simple token swaps
  • 🌐 Web3 Wallet - Built-in DeFi access

API Base URL

https://www.okx.com

Authentication

API_KEY="${OKX_API_KEY}"
SECRET="${OKX_SECRET}"
PASSPHRASE="${OKX_PASSPHRASE}"

# Generate signature
generate_signature() {
  local timestamp="$1"
  local method="$2"
  local path="$3"
  local body="$4"
  local sign_string="${timestamp}${method}${path}${body}"
  echo -n "$sign_string" | openssl dgst -sha256 -hmac "$SECRET" -binary | base64
}

TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")

Get Account Balance

METHOD="GET"
PATH="/api/v5/account/balance"
SIGNATURE=$(generate_signature "$TIMESTAMP" "$METHOD" "$PATH" "")

curl -s "https://www.okx.com${PATH}" \
  -H "OK-ACCESS-KEY: ${API_KEY}" \
  -H "OK-ACCESS-SIGN: ${SIGNATURE}" \
  -H "OK-ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "OK-ACCESS-PASSPHRASE: ${PASSPHRASE}" | jq '.data[0].details[] | select(.cashBal != "0") | {ccy: .ccy, cashBal: .cashBal, availBal: .availBal}'

Get Ticker Price

INST_ID="BTC-USDT"

curl -s "https://www.okx.com/api/v5/market/ticker?instId=${INST_ID}" | jq '.data[0] | {instId: .instId, last: .last, high24h: .high24h, low24h: .low24h, vol24h: .vol24h}'

Get Order Book

curl -s "https://www.okx.com/api/v5/market/books?instId=${INST_ID}&sz=10" | jq '{
  asks: .data[0].asks[:5],
  bids: .data[0].bids[:5]
}'

Place Spot Order

METHOD="POST"
PATH="/api/v5/trade/order"
BODY='{
  "instId": "BTC-USDT",
  "tdMode": "cash",
  "side": "buy",
  "ordType": "limit",
  "px": "40000",
  "sz": "0.001"
}'
SIGNATURE=$(generate_signature "$TIMESTAMP" "$METHOD" "$PATH" "$BODY")

curl -s -X POST "https://www.okx.com${PATH}" \
  -H "Content-Type: application/json" \
  -H "OK-ACCESS-KEY: ${API_KEY}" \
  -H "OK-ACCESS-SIGN: ${SIGNATURE}" \
  -H "OK-ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "OK-ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -d "$BODY" | jq '.'

Place Market Order

BODY='{
  "instId": "ETH-USDT",
  "tdMode": "cash",
  "side": "buy",
  "ordType": "market",
  "sz": "0.1"
}'
SIGNATURE=$(generate_signature "$TIMESTAMP" "$METHOD" "$PATH" "$BODY")

curl -s -X POST "https://www.okx.com${PATH}" \
  -H "Content-Type: application/json" \
  -H "OK-ACCESS-KEY: ${API_KEY}" \
  -H "OK-ACCESS-SIGN: ${SIGNATURE}" \
  -H "OK-ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "OK-ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -d "$BODY" | jq '.'

Get Open Orders

METHOD="GET"
PATH="/api/v5/trade/orders-pending"
SIGNATURE=$(generate_signature "$TIMESTAMP" "$METHOD" "$PATH" "")

curl -s "https://www.okx.com${PATH}" \
  -H "OK-ACCESS-KEY: ${API_KEY}" \
  -H "OK-ACCESS-SIGN: ${SIGNATURE}" \
  -H "OK-ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "OK-ACCESS-PASSPHRASE: ${PASSPHRASE}" | jq '.data[] | {instId: .instId, side: .side, px: .px, sz: .sz, state: .state}'

Cancel Order

METHOD="POST"
PATH="/api/v5/trade/cancel-order"
BODY='{
  "instId": "BTC-USDT",
  "ordId": "12345678"
}'
SIGNATURE=$(generate_signature "$TIMESTAMP" "$METHOD" "$PATH" "$BODY")

curl -s -X POST "https://www.okx.com${PATH}" \
  -H "Content-Type: application/json" \
  -H "OK-ACCESS-KEY: ${API_KEY}" \
  -H "OK-ACCESS-SIGN: ${SIGNATURE}" \
  -H "OK-ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "OK-ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -d "$BODY" | jq '.'

Get Trade History

METHOD="GET"
PATH="/api/v5/trade/fills?instType=SPOT"
SIGNATURE=$(generate_signature "$TIMESTAMP" "$METHOD" "$PATH" "")

curl -s "https://www.okx.com${PATH}" \
  -H "OK-ACCESS-KEY: ${API_KEY}" \
  -H "OK-ACCESS-SIGN: ${SIGNATURE}" \
  -H "OK-ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "OK-ACCESS-PASSPHRASE: ${PASSPHRASE}" | jq '.data[:10] | .[] | {instId: .instId, side: .side, fillPx: .fillPx, fillSz: .fillSz}'
# Get quote
METHOD="POST"
PATH="/api/v5/asset/convert/estimate-quote"
BODY='{
  "baseCcy": "BTC",
  "quoteCcy": "USDT",
  "side": "buy",
  "rfqSz": "100",
  "rfqSzCcy": "USDT"
}'
SIGNATURE=$(generate_signature "$TIMESTAMP" "$METHOD" "$PATH" "$BODY")

curl -s -X POST "https://www.okx.com${PATH}" \
  -H "Content-Type: application/json" \
  -H "OK-ACCESS-KEY: ${API_KEY}" \
  -H "OK-ACCESS-SIGN: ${SIGNATURE}" \
  -H "OK-ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "OK-ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -d "$BODY" | jq '.'

Popular Trading Pairs

PairDescription
BTC-USDTBitcoin / Tether
ETH-USDTEthereum / Tether
SOL-USDTSolana / Tether
XRP-USDTXRP / Tether
OKB-USDTOKB / Tether

Order Types

TypeDescription
limitLimit order
marketMarket order
post_onlyPost-only order
fokFill or kill
iocImmediate or cancel

Safety Rules

  1. ALWAYS display order details before execution
  2. VERIFY trading pair and amount
  3. CHECK account balance before trading
  4. WARN about leverage risks
  5. NEVER execute without user confirmation
CodeCauseSolution
51000Parameter errorCheck parameters
51008Insufficient balanceCheck balance
51009Order not existCheck order ID
README.md

OKX ⚫

Top 5 global crypto exchange skill for Clawdbot.

Features

  • 📈 Spot Trading - 300+ trading pairs
  • 📊 Futures & Perpetuals - Up to 125x leverage
  • 🎯 Options Trading - BTC/ETH options
  • 💰 Earn - Staking, savings, DeFi
  • 🌐 Web3 Wallet - Built-in DeFi access

Installation

clawdhub install okx

Configuration

export OKX_API_KEY="your-api-key"
export OKX_SECRET="your-secret"
export OKX_PASSPHRASE="your-passphrase"

Usage Examples

"Check my OKX balance"
"Buy 0.1 ETH at market price"
"Place limit order to buy BTC at $40000"
"Show my open orders"
"Get BTC price"

Referral

Users who sign up through this skill get up to 50% fee rebates!

License

MIT

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

  • OpenClaw CLI installed and configured.
  • Language: Markdown
  • License: MIT
  • Topics:

Configuration

This skill uses a referral code to earn commission on trading fees. | Variable | Value | Description | |----------|-------|-------------| | `REFERRAL_CODE` | `CYBERPAY` | Referral code for fee sharing | **Commission Structure:** - Up to 50% of trading fees in USDT - Mystery Box rewards for new users - Lifetime commission on referred users > 💡 Users who sign up through this skill automatically use the referral code!

FAQ

How do I install okx?

Run openclaw add @0xterrybit/okx in your terminal. This installs okx into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/0xterrybit/okx. Review commits and README documentation before installing.