WEEX API
Use:
- -
scripts/weex_contract_api.py for contract - INLINECODE1 for spot
For private endpoints:
CODEBLOCK0
Fast Path
CODEBLOCK1
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:
CODEBLOCK2
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:
CODEBLOCK3
References
- - INLINECODE3
- INLINECODE4 (machine-readable local spot interface definitions)
- INLINECODE5 (human-readable local spot interface definitions)
- INLINECODE6 (machine-readable local interface definitions)
- INLINECODE7 (human-readable local interface definitions)
- INLINECODE8
- INLINECODE9
- INLINECODE10
WEEX API
使用:
- - scripts/weexcontractapi.py 用于合约
- scripts/weexspotapi.py 用于现货
对于私有端点:
bash
export WEEXAPIKEY=...
export WEEXAPISECRET=...
export WEEXAPIPASSPHRASE=...
export WEEXAPIBASE=https://api-contract.weex.com
export WEEX_LOCALE=en-US
快速路径
bash
合约
python3 scripts/weex
contractapi.py list-endpoints --pretty
python3 scripts/weex
contractapi.py ticker --symbol BTCUSDT --pretty
python3 scripts/weex
contractapi.py poll-ticker --symbol BTCUSDT --interval 2 --count 30 --pretty
现货
python3 scripts/weex
spotapi.py list-endpoints --pretty
python3 scripts/weex
spotapi.py ticker --symbol BTCUSDT --pretty
自然语言指令
自然语言由代理层进行解析。
脚本不再从自由文本中提取关键词。
代理必须将用户意图转换为结构化字段,然后调用确定性命令:
bash
合约 V3
python3 scripts/weex
contractapi.py place-order \
--symbol ETHUSDT --side SELL --position-side SHORT --type LIMIT \
--quantity 0.001 --price 10000 --time-in-force GTC --confirm-live --pretty
现货 V3
python3 scripts/weex
spotapi.py place-order \
--symbol ETHUSDT --side BUY --order-type LIMIT \
--quantity 0.001 --price 999 --time-in-force GTC --confirm-live --pretty
安全策略
- - 未携带 --confirm-live 参数时,绝不发送变更请求。
- 默认流程为直接实时执行(无试运行步骤)。
- 如果指令不明确或缺少字段,仅询问缺失的字段。
重新生成 API 定义
本地合约和现货定义基于实时 WEEX V3 文档生成:
bash
python3 scripts/generateweexapi_definitions.py --product all
参考资料
- - references/spot-endpoints.md
- references/spot-api-definitions.json(机器可读的本地现货接口定义)
- references/spot-api-definitions.md(人类可读的本地现货接口定义)
- references/contract-api-definitions.json(机器可读的本地接口定义)
- references/contract-api-definitions.md(人类可读的本地接口定义)
- references/contract-endpoints.md
- references/auth-and-signing.md
- references/websocket.md