SuperAPI AI 工具集

recipe-emergency-flatten

部署与运维

查看项目

更新于 10-16 06:52

技能介绍

用途:在行情剧烈反向、怀疑 API 密钥泄露、收盘清仓过夜或智能体行为异常需要硬停止时,尽快撤销全部挂单并关闭所有持仓。这是破坏性工作流,仅在用户明确要求时运行。

前提:已配置认证(CDCX_API_KEY / CDCX_API_SECRET 或 profile);MCP 模式需以 --allow-dangerous 启动服务器(该工作流使用 tier-dangerous 命令);CLI 模式可用 --yes 跳过提示,或逐条确认。

主要步骤:1) cdcx trade cancel-all --yes -o json 撤销全部挂单;2) cdcx trade open-orders -o json 确认无挂单;3) cdcx account positions -o json 列出持仓;4) 对第 3 步每行执行 cdcx trade close-position <INSTRUMENT_NAME> --type MARKET --yes -o json 市价平仓;5) 再次 cdcx account positions -o json 验证已平;6) 单独清理高级订单:cdcx advanced cancel-all --yes -o json 与 cdcx advanced open-orders -o json;7) cdcx account summary -o json 最终钱包检查。

也可用一行命令串联上述撤销、平仓与验证步骤。

限制与注意:cancel-all 不带 instrument 会撤销账户内全部挂单;close-position 是异步的,只返回 ack 而非成交,持仓可能短暂仍存在,需靠第 5 步确认;高级订单(OTO/OTOCO)不会被 trade cancel-all 撤销,须用 advanced cancel-all 单独清理;若不确定当前状态,反复运行 positions 与 open-orders 直到两者为空;若担心 API 访问本身,事后应在 https://crypto.com/exchange/settings/api 轮换 API 密钥。