360 Secure SkillHub
360 安全技能中心

Weex

封装 WEEX 合约与现货 API 的命令行脚本,支持行情查询、下单、撤单和账户数据获取;自然语言意图由智能体转换为结构化参数后再调用脚本。私有接口需配置 API Key、Secret、Passphrase 等环境变量;修改类请求必须显式加 --confirm-live,默认直接实盘执行,没有 dry-run。

iiiiicooper
iiiiicooper
热度 51.70
最近更新 2026-05-18 12:39:03
分类:自动化依赖:代码执行 / 第三方 API / 读写文件应用场景:API 集成 / 自动化脚本 / 个人理财 / 市场分析

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add weex
Metadata
name
WEEX API
description
Automated trading tool for WEEX API, supporting futures and spot trading, including natural language order placement, order cancellation, order query, market data and account data retrieval.
metadata
{"version":"1.0.0"}

WEEX API

Use:

  • scripts/weex_contract_api.py for contract
  • scripts/weex_spot_api.py for spot

For private endpoints:

export WEEX_API_KEY="..."
export WEEX_API_SECRET="..."
export WEEX_API_PASSPHRASE="..."
export WEEX_API_BASE="https://api-contract.weex.com"
export WEEX_LOCALE="en-US"

Fast Path

# Contract
python3 scripts/weex_contract_api.py list-endpoints --pretty
python3 scripts/weex_contract_api.py ticker --symbol BTCUSDT --pretty
python3 scripts/weex_contract_api.py poll-ticker --symbol BTCUSDT --interval 2 --count 30 --pretty

# Spot
python3 scripts/weex_spot_api.py list-endpoints --pretty
python3 scripts/weex_spot_api.py ticker --symbol BTCUSDT --pretty

Natural Language Order

Natural language is interpreted by the agent layer.
Scripts no longer parse keywords from free text.

The agent must convert user intent into structured fields, then call deterministic commands:

# Contract V3
python3 scripts/weex_contract_api.py place-order \
  --symbol ETHUSDT --side SELL --position-side SHORT --type LIMIT \
  --quantity 0.001 --price 10000 --time-in-force GTC --confirm-live --pretty

# Spot V3
python3 scripts/weex_spot_api.py place-order \
  --symbol ETHUSDT --side BUY --order-type LIMIT \
  --quantity 0.001 --price 999 --time-in-force GTC --confirm-live --pretty

Safety Policy

  • Never send mutating requests without --confirm-live.
  • Default flow is direct live execution (no dry-run step).
  • If instruction is ambiguous or missing fields, ask only for missing fields.

Regenerating API Definitions

Local contract and spot definitions are generated from the live WEEX V3 docs:

python3 scripts/generate_weex_api_definitions.py --product all

References

  • references/spot-endpoints.md
  • references/spot-api-definitions.json (machine-readable local spot interface definitions)
  • references/spot-api-definitions.md (human-readable local spot interface definitions)
  • references/contract-api-definitions.json (machine-readable local interface definitions)
  • references/contract-api-definitions.md (human-readable local interface definitions)
  • references/contract-endpoints.md
  • references/auth-and-signing.md
  • references/websocket.md