skills$openclaw/weex-trading
bowen313377.5kā˜…

by bowen31337

weex-trading – OpenClaw Skill

weex-trading is an OpenClaw Skills integration for ai ml workflows. WEEX Futures exchange integration. Trade USDT-M perpetual futures with up to 125x leverage on WEEX.

7.5k stars8.9k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026ai ml

Skill Snapshot

nameweex-trading
descriptionWEEX Futures exchange integration. Trade USDT-M perpetual futures with up to 125x leverage on WEEX. OpenClaw Skills integration.
ownerbowen31337
repositorybowen31337/weex-trading-skills
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @bowen31337/weex-trading-skills
last updatedFeb 7, 2026

Maintainer

bowen31337

bowen31337

Maintains weex-trading in the OpenClaw Skills directory.

View GitHub profile
File Explorer
7 files
.
references
api_reference.md
5.0 KB
scripts
weex_client.py
10.1 KB
_meta.json
457 B
README.md
8.5 KB
SKILL.md
23.5 KB
SKILL.md

name: weex-trading description: WEEX Futures exchange integration. Trade USDT-M perpetual futures with up to 125x leverage on WEEX. metadata: emoji: "šŸ”µ" category: "trading" tags: ["crypto", "futures", "trading", "weex", "derivatives"] requires: bins: ["curl", "jq", "python3", "openssl"] compatibility: - claude - openai - gemini - llama - mistral - any-agent

WEEX Futures Trading šŸ”µ

Open AI Agent Skill for USDT-margined perpetual futures trading on WEEX exchange. Up to 125x leverage.

Open Agent Skill: This skill is designed to work with any AI agent that supports bash/curl commands, including Claude, GPT, Gemini, LLaMA, Mistral, and other LLM-based agents.

Features

  • šŸ“Š Futures Trading - USDT-M perpetual contracts up to 125x leverage
  • šŸ’° Account Management - Balance, positions, margin settings
  • šŸ“ˆ Market Data - Tickers, order book, candlesticks, funding rates
  • šŸŽÆ Advanced Orders - Trigger orders, TP/SL, conditional orders
  • šŸ¤– AI Integration - Log AI trading decisions
  • šŸ”Œ Universal Compatibility - Works with any AI agent supporting shell commands

Environment Variables

VariableDescriptionRequired
WEEX_API_KEYAPI Key from WEEXYes
WEEX_API_SECRETAPI SecretYes
WEEX_PASSPHRASEAPI PassphraseYes
WEEX_BASE_URLAPI base URLNo (default: https://api-contract.weex.com)

Authentication

API_KEY="${WEEX_API_KEY}"
SECRET="${WEEX_API_SECRET}"
PASSPHRASE="${WEEX_PASSPHRASE}"
BASE_URL="${WEEX_BASE_URL:-https://api-contract.weex.com}"

TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")

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

Market Data Endpoints (No Auth)

Get Server Time

curl -s "${BASE_URL}/capi/v2/market/time" | jq '.'

Get All Contracts Info

curl -s "${BASE_URL}/capi/v2/market/contracts" | jq '.data[] | {symbol: .symbol, baseCoin: .underlying_index, quoteCoin: .quote_currency, contractVal: .contract_val, minLeverage: .minLeverage, maxLeverage: .maxLeverage, tickSize: .tick_size, sizeIncrement: .size_increment}'

Get Single Contract Info

SYMBOL="cmt_btcusdt"

curl -s "${BASE_URL}/capi/v2/market/contracts?symbol=${SYMBOL}" | jq '.data'

Get Ticker Price

SYMBOL="cmt_btcusdt"

curl -s "${BASE_URL}/capi/v2/market/ticker?symbol=${SYMBOL}" | jq '.data | {symbol: .symbol, last: .last, high: .high_24h, low: .low_24h, volume: .volume_24h, markPrice: .markPrice}'

Get All Tickers

curl -s "${BASE_URL}/capi/v2/market/tickers" | jq '.data[] | {symbol: .symbol, last: .last, change: .priceChangePercent, volume: .volume_24h}'

Get Order Book

SYMBOL="cmt_btcusdt"

curl -s "${BASE_URL}/capi/v2/market/depth?symbol=${SYMBOL}&limit=15" | jq '.data | {asks: .asks[:5], bids: .bids[:5]}'

Get Recent Trades

SYMBOL="cmt_btcusdt"
LIMIT="50"

curl -s "${BASE_URL}/capi/v2/market/trades?symbol=${SYMBOL}&limit=${LIMIT}" | jq '.data[] | {time: .time, price: .price, size: .size, side: (if .isBuyerMaker then "sell" else "buy" end)}'

Get Candlestick Data

SYMBOL="cmt_btcusdt"
GRANULARITY="1h"    # 1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w
LIMIT="100"

curl -s "${BASE_URL}/capi/v2/market/candles?symbol=${SYMBOL}&granularity=${GRANULARITY}&limit=${LIMIT}" | jq '.data[] | {timestamp: .[0], open: .[1], high: .[2], low: .[3], close: .[4], volume: .[5]}'

Get Index Price

SYMBOL="cmt_btcusdt"

curl -s "${BASE_URL}/capi/v2/market/index?symbol=${SYMBOL}" | jq '.data | {symbol: .symbol, index: .index, timestamp: .timestamp}'

Get Open Interest

SYMBOL="cmt_btcusdt"

curl -s "${BASE_URL}/capi/v2/market/open_interest?symbol=${SYMBOL}" | jq '.data[] | {symbol: .symbol, openInterest: .base_volume, value: .target_volume}'

Get Current Funding Rate

SYMBOL="cmt_btcusdt"

curl -s "${BASE_URL}/capi/v2/market/currentFundRate?symbol=${SYMBOL}" | jq '.data[] | {symbol: .symbol, rate: .fundingRate, nextSettlement: .timestamp}'

Get Historical Funding Rates

SYMBOL="cmt_btcusdt"
LIMIT="20"

curl -s "${BASE_URL}/capi/v2/market/getHistoryFundRate?symbol=${SYMBOL}&limit=${LIMIT}" | jq '.data[] | {symbol: .symbol, rate: .fundingRate, settleTime: .fundingTime}'

Get Next Funding Time

SYMBOL="cmt_btcusdt"

curl -s "${BASE_URL}/capi/v2/market/funding_time?symbol=${SYMBOL}" | jq '.data | {symbol: .symbol, nextFundingTime: .fundingTime}'

Account Endpoints (Auth Required)

Get Account Assets

PATH_URL="/capi/v2/account/assets"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | {coin: .coinName, available: .available, frozen: .frozen, equity: .equity, unrealizedPnl: .unrealizePnl}'

Get Account List with Settings

PATH_URL="/capi/v2/account/getAccounts"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data'

Get Single Account by Coin

COIN="USDT"

PATH_URL="/capi/v2/account/getAccount?coin=${COIN}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data'

Get User Settings

SYMBOL="cmt_btcusdt"

PATH_URL="/capi/v2/account/settings?symbol=${SYMBOL}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data'

Change Leverage

SYMBOL="cmt_btcusdt"
LEVERAGE="20"
MARGIN_MODE="1"        # 1=Cross, 3=Isolated

PATH_URL="/capi/v2/account/leverage"
BODY="{\"symbol\":\"${SYMBOL}\",\"marginMode\":${MARGIN_MODE},\"longLeverage\":\"${LEVERAGE}\",\"shortLeverage\":\"${LEVERAGE}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Adjust Position Margin (Isolated Only)

POSITION_ID="123456789"      # Isolated position ID
AMOUNT="100"                 # Positive to add, negative to reduce

PATH_URL="/capi/v2/account/adjustMargin"
BODY="{\"coinId\":2,\"isolatedPositionId\":${POSITION_ID},\"collateralAmount\":\"${AMOUNT}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Auto Margin Top-Up (Isolated Only)

POSITION_ID="123456789"      # Isolated position ID
AUTO_APPEND="true"           # true to enable, false to disable

PATH_URL="/capi/v2/account/modifyAutoAppendMargin"
BODY="{\"positionId\":${POSITION_ID},\"autoAppendMargin\":${AUTO_APPEND}}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Get Account Bill History

COIN="USDT"
LIMIT="20"

PATH_URL="/capi/v2/account/bills"
BODY="{\"coin\":\"${COIN}\",\"limit\":${LIMIT}}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.data'

Position Endpoints (Auth Required)

Get All Positions

PATH_URL="/capi/v2/account/position/allPosition"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | select(.size != "0") | {symbol: .symbol, side: .side, size: .size, leverage: .leverage, unrealizedPnl: .unrealizePnl, entryPrice: .avg_cost}'

Get Single Position

SYMBOL="cmt_btcusdt"

PATH_URL="/capi/v2/account/position/singlePosition?symbol=${SYMBOL}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | {symbol: .symbol, side: .side, size: .size, leverage: .leverage, unrealizedPnl: .unrealizePnl, entryPrice: .avg_cost, liquidationPrice: .liq_price}'

Change Margin Mode

SYMBOL="cmt_btcusdt"
MARGIN_MODE="1"        # 1=Cross, 3=Isolated

PATH_URL="/capi/v2/account/position/changeHoldModel"
BODY="{\"symbol\":\"${SYMBOL}\",\"marginMode\":${MARGIN_MODE},\"separatedMode\":1}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Order Endpoints (Auth Required)

Place Market Order

SYMBOL="cmt_btcusdt"
SIZE="10"              # Quantity in contracts
TYPE="1"               # 1=Open Long, 2=Open Short, 3=Close Long, 4=Close Short
CLIENT_OID="order_$(date +%s)"

PATH_URL="/capi/v2/order/placeOrder"
BODY="{\"symbol\":\"${SYMBOL}\",\"client_oid\":\"${CLIENT_OID}\",\"size\":\"${SIZE}\",\"type\":\"${TYPE}\",\"order_type\":\"0\",\"match_price\":\"1\",\"price\":\"0\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Place Limit Order

SYMBOL="cmt_btcusdt"
SIZE="10"
TYPE="1"               # 1=Open Long
PRICE="90000"          # Limit price
ORDER_TYPE="0"         # 0=Normal, 1=Post-only, 2=FOK, 3=IOC
CLIENT_OID="limit_$(date +%s)"

PATH_URL="/capi/v2/order/placeOrder"
BODY="{\"symbol\":\"${SYMBOL}\",\"client_oid\":\"${CLIENT_OID}\",\"size\":\"${SIZE}\",\"type\":\"${TYPE}\",\"order_type\":\"${ORDER_TYPE}\",\"match_price\":\"0\",\"price\":\"${PRICE}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Get Open Orders

PATH_URL="/capi/v2/order/current"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | {orderId: .order_id, symbol: .symbol, side: .type, price: .price, size: .size, status: .status}'

Get Order Details

ORDER_ID="1234567890"

PATH_URL="/capi/v2/order/detail?orderId=${ORDER_ID}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data'

Get Order History

SYMBOL="cmt_btcusdt"
LIMIT="50"

PATH_URL="/capi/v2/order/history?symbol=${SYMBOL}&limit=${LIMIT}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | {orderId: .order_id, symbol: .symbol, side: .type, price: .price, size: .size, filledSize: .filled_qty, status: .status}'

Get Trade Fills

SYMBOL="cmt_btcusdt"
LIMIT="50"

PATH_URL="/capi/v2/order/fills?symbol=${SYMBOL}&limit=${LIMIT}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | {tradeId: .trade_id, orderId: .order_id, symbol: .symbol, price: .price, size: .size, fee: .fee, time: .created_at}'

Cancel Order

ORDER_ID="1234567890"

PATH_URL="/capi/v2/order/cancel_order"
BODY="{\"orderId\":\"${ORDER_ID}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Cancel All Orders

SYMBOL="cmt_btcusdt"    # Optional: omit to cancel all

PATH_URL="/capi/v2/order/cancelAllOrders"
BODY="{\"symbol\":\"${SYMBOL}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Close All Positions

PATH_URL="/capi/v2/order/closePositions"
BODY="{}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Trigger Order Endpoints (Auth Required)

Place Trigger Order (Stop-Loss / Take-Profit)

SYMBOL="cmt_btcusdt"
SIZE="10"
TYPE="1"               # 1=Open Long, 2=Open Short, 3=Close Long, 4=Close Short
TRIGGER_PRICE="95000"  # Price that triggers the order
EXECUTE_PRICE="0"      # 0 for market, or limit price
TRIGGER_TYPE="1"       # 1=Fill price, 2=Mark price, 3=Index price
CLIENT_OID="trigger_$(date +%s)"

PATH_URL="/capi/v2/order/plan_order"
BODY="{\"symbol\":\"${SYMBOL}\",\"client_oid\":\"${CLIENT_OID}\",\"size\":\"${SIZE}\",\"type\":\"${TYPE}\",\"trigger_price\":\"${TRIGGER_PRICE}\",\"execute_price\":\"${EXECUTE_PRICE}\",\"trend_side\":\"1\",\"trigger_type\":\"${TRIGGER_TYPE}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Get Current Trigger Orders

SYMBOL="cmt_btcusdt"

PATH_URL="/capi/v2/order/currentPlan?symbol=${SYMBOL}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | {orderId: .order_id, symbol: .symbol, triggerPrice: .trigger_price, size: .size, type: .type}'

Get Trigger Order History

SYMBOL="cmt_btcusdt"
LIMIT="50"

PATH_URL="/capi/v2/order/historyPlan?symbol=${SYMBOL}&limit=${LIMIT}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "GET" "$PATH_URL" "")

curl -s "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" | jq '.data[] | {orderId: .order_id, symbol: .symbol, triggerPrice: .trigger_price, status: .status}'

Cancel Trigger Order

ORDER_ID="1234567890"

PATH_URL="/capi/v2/order/cancel_plan"
BODY="{\"orderId\":\"${ORDER_ID}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

TP/SL Order Endpoints (Auth Required)

Place TP/SL Order

SYMBOL="cmt_btcusdt"
SIDE="1"               # 1=Long position, 2=Short position
TP_PRICE="100000"      # Take profit trigger price
SL_PRICE="85000"       # Stop loss trigger price
TP_SIZE="10"           # Take profit size (0 for entire position)
SL_SIZE="10"           # Stop loss size (0 for entire position)

PATH_URL="/capi/v2/order/placeTpSlOrder"
BODY="{\"symbol\":\"${SYMBOL}\",\"side\":\"${SIDE}\",\"tp_trigger_price\":\"${TP_PRICE}\",\"sl_trigger_price\":\"${SL_PRICE}\",\"tp_size\":\"${TP_SIZE}\",\"sl_size\":\"${SL_SIZE}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Modify TP/SL Order

SYMBOL="cmt_btcusdt"
SIDE="1"               # 1=Long position, 2=Short position
TP_PRICE="105000"      # New take profit price
SL_PRICE="82000"       # New stop loss price

PATH_URL="/capi/v2/order/modifyTpSlOrder"
BODY="{\"symbol\":\"${SYMBOL}\",\"side\":\"${SIDE}\",\"tp_trigger_price\":\"${TP_PRICE}\",\"sl_trigger_price\":\"${SL_PRICE}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

AI Integration (Auth Required)

Upload AI Trading Log

AI_LOG="Trading decision: Buy BTC based on momentum indicators"
ORDER_ID="1234567890"

PATH_URL="/capi/v2/order/uploadAiLog"
BODY="{\"orderId\":\"${ORDER_ID}\",\"aiLog\":\"${AI_LOG}\"}"
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(generate_signature "POST" "$PATH_URL" "$BODY")

curl -s -X POST "${BASE_URL}${PATH_URL}" \
  -H "ACCESS-KEY: ${API_KEY}" \
  -H "ACCESS-SIGN: ${SIGNATURE}" \
  -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \
  -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \
  -H "Content-Type: application/json" \
  -d "$BODY" | jq '.'

Reference Tables

Order Types

typeDescription
1Open Long (buy to open)
2Open Short (sell to open)
3Close Long (sell to close)
4Close Short (buy to close)

Execution Types

order_typeDescription
0Normal order
1Post-only (maker only)
2FOK (fill or kill)
3IOC (immediate or cancel)

Price Types

match_priceDescription
0Limit order
1Market order

Margin Modes

marginModeDescription
1Cross margin
3Isolated margin
trigger_typeDescription
1Fill price (last trade price)
2Mark price
3Index price

Popular Trading Pairs

PairDescription
cmt_btcusdtBitcoin / USDT
cmt_ethusdtEthereum / USDT
cmt_solusdtSolana / USDT
cmt_xrpusdtXRP / USDT
cmt_dogeusdtDogecoin / USDT
cmt_bnbusdtBNB / USDT

Safety Rules

  1. ALWAYS display order details before execution
  2. VERIFY trading pair and quantity
  3. CHECK account balance before trading
  4. WARN about leverage risks (up to 125x)
  5. NEVER execute without user confirmation
  6. CONFIRM position closure before executing

Error Codes

CodeDescriptionSolution
00000Success-
40001Invalid parameterCheck parameter format
40101Invalid API key/signatureVerify credentials and timestamp
40301IP not whitelistedAdd IP to whitelist
42901Rate limit exceededReduce request frequency
50001Internal errorRetry after delay

Rate Limits

CategoryIP LimitUID Limit
Market Data20 req/secN/A
Account Info10 req/sec10 req/sec
Order Placement10 req/sec10 req/sec

Additional Resources

README.md

WEEX Futures Trading Skill šŸ”µ

An Open AI Agent Skill for trading USDT-margined perpetual futures on WEEX exchange with up to 125x leverage.

Universal Compatibility: This skill works with any AI agent that supports bash/curl commands, including Claude, GPT-4, Gemini, LLaMA, Mistral, and other LLM-based coding assistants.

Features

  • Market Data - Real-time ticker, order book, trades, candlesticks, funding rates
  • Account Management - Check balances, positions, leverage settings
  • Order Operations - Place market/limit orders, cancel orders, close positions
  • Position Management - Open long/short, close positions, adjust margin
  • Trigger Orders - Stop-loss, take-profit, and conditional orders
  • TP/SL Orders - Position-level take-profit and stop-loss
  • AI Integration - Log AI trading decisions to WEEX
  • Python CLI Client - Command-line tool for quick API interactions

Supported AI Agents

AgentStatusNotes
Claude (Anthropic)āœ… Fully SupportedClaude Code, API
GPT-4 (OpenAI)āœ… Fully SupportedChatGPT, API with code interpreter
Gemini (Google)āœ… Fully SupportedGemini Pro, API
LLaMA (Meta)āœ… Fully SupportedWith code execution capability
Mistralāœ… Fully SupportedWith code execution capability
Other LLMsāœ… CompatibleAny agent supporting bash/curl

Installation

As AI Agent Skill

The skill can be loaded by any AI agent that reads markdown-based skill definitions:

# Clone the repository
git clone https://github.com/bowen31337/weex-futures-trading-skill.git

# Or download just the skill file
curl -L -o SKILL.md \
  https://raw.githubusercontent.com/bowen31337/weex-futures-trading-skill/main/weex-trading/SKILL.md

For Claude Code

# Install to Claude Code skills directory
cp SKILL.md ~/.claude/skills/weex-trading.md

For Other AI Agents

Most AI agents can use this skill by:

  1. Loading the SKILL.md file into the conversation context
  2. Or referencing it as a system prompt
  3. Or using your agent's skill/plugin installation mechanism

As Standalone Python Client

git clone https://github.com/bowen31337/weex-futures-trading-skill.git
cd weex-futures-trading-skill
pip install requests

Configuration

Set your WEEX API credentials as environment variables:

export WEEX_API_KEY=your_api_key
export WEEX_API_SECRET=your_api_secret
export WEEX_PASSPHRASE=your_passphrase
export WEEX_BASE_URL=https://api-contract.weex.com  # Optional

Getting API Keys

  1. Log in to your WEEX account at weex.com
  2. Navigate to API Management in account settings
  3. Create a new API key with required permissions:
    • Read - View account info, positions, order history
    • Trade - Place and cancel orders
  4. Save your API Key, API Secret, and Passphrase securely

Usage

Python CLI Client

# Market Data (no authentication required)
python scripts/weex_client.py time                    # Server time
python scripts/weex_client.py ticker cmt_btcusdt      # Get BTC price
python scripts/weex_client.py depth cmt_btcusdt       # Order book
python scripts/weex_client.py funding cmt_btcusdt     # Funding rate

# Account Info (authentication required)
python scripts/weex_client.py assets                  # Account balances
python scripts/weex_client.py positions               # All positions
python scripts/weex_client.py orders                  # Open orders
python scripts/weex_client.py settings                # Leverage settings

# Trading
python scripts/weex_client.py buy cmt_btcusdt 10              # Market buy 10 contracts
python scripts/weex_client.py buy cmt_btcusdt 10 95000        # Limit buy at $95,000
python scripts/weex_client.py sell cmt_btcusdt 10             # Market short 10 contracts
python scripts/weex_client.py close_long cmt_btcusdt 10       # Close long position
python scripts/weex_client.py close_short cmt_btcusdt 10      # Close short position

# Order Management
python scripts/weex_client.py cancel 1234567890       # Cancel order by ID
python scripts/weex_client.py cancel_all              # Cancel all orders
python scripts/weex_client.py close_all               # Close all positions

# Account Settings
python scripts/weex_client.py leverage cmt_btcusdt 20 # Set 20x leverage

With AI Agents

Once loaded as a skill, any compatible AI agent can help you trade on WEEX:

You: What's the current BTC price on WEEX?
Agent: [Fetches ticker data and displays price]

You: Open a long position on BTC with 10 contracts
Agent: [Confirms order details and executes after your approval]

You: Show my current positions
Agent: [Displays all open positions with PnL]

You: Set a stop-loss at $90,000 for my BTC position
Agent: [Creates trigger order for risk management]

The skill provides curl commands that any AI agent with shell access can execute.

API Reference

Order Types

TypeDescription
1Open Long (buy to open)
2Open Short (sell to open)
3Close Long (sell to close)
4Close Short (buy to close)

Execution Types

TypeDescription
0Normal order
1Post-only (maker only)
2FOK (fill or kill)
3IOC (immediate or cancel)

Margin Modes

ModeDescription
1Cross margin
3Isolated margin

Popular Trading Pairs

SymbolDescription
cmt_btcusdtBitcoin / USDT
cmt_ethusdtEthereum / USDT
cmt_solusdtSolana / USDT
cmt_xrpusdtXRP / USDT
cmt_dogeusdtDogecoin / USDT

Rate Limits

CategoryIP LimitUID Limit
Market Data20 req/secN/A
Account Info10 req/sec10 req/sec
Order Operations10 req/sec10 req/sec

Error Codes

CodeDescriptionSolution
40001Invalid parameterCheck parameter format
40101Authentication failedVerify credentials and timestamp
40301IP not whitelistedAdd IP to API whitelist
42901Rate limit exceededReduce request frequency

Safety Notes

  • Always verify order details before confirming trades
  • Check balance before placing orders
  • Understand leverage risks - higher leverage = higher risk
  • Use stop-loss orders to manage risk
  • Start with small positions when testing

Project Structure

weex-trading/
ā”œā”€ā”€ SKILL.md                 # Open AI Agent skill definition (37 API endpoints)
ā”œā”€ā”€ README.md                # This file
ā”œā”€ā”€ scripts/
│   └── weex_client.py       # Python CLI client
└── references/
    └── api_reference.md     # API endpoint quick reference

Skill Coverage

The SKILL.md provides complete coverage of the WEEX Futures API:

CategoryEndpointsDescription
Market Data13Tickers, order book, candles, funding rates
Account8Balances, settings, leverage, margin
Position3View and manage positions
Order9Place, cancel, query orders
Trigger Order4Stop-loss, take-profit triggers
TP/SL2Position-level TP/SL orders
AI Integration1Log AI trading decisions
Total38100% API coverage

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Commit changes (git commit -m 'Add new feature')
  4. Push to branch (git push origin feature/new-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE for details.

What is an Open Agent Skill?

An Open Agent Skill is a markdown-based skill definition that can be used by any AI agent with code execution capabilities. Unlike proprietary plugin formats, open agent skills:

  • šŸ“– Human-readable - Written in Markdown with embedded code blocks
  • šŸ”Œ Universal - Work with any AI agent (Claude, GPT, Gemini, LLaMA, etc.)
  • šŸ› ļø Self-contained - Include all necessary code snippets and documentation
  • šŸ”’ Transparent - Users can inspect exactly what commands will be executed
  • šŸ¤ Shareable - Easy to distribute, fork, and contribute to

Links

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:

FAQ

How do I install weex-trading?

Run openclaw add @bowen31337/weex-trading-skills in your terminal. This installs weex-trading 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/bowen31337/weex-trading-skills. Review commits and README documentation before installing.