ワンクリックで
bitmex-recipe-emergency-flatten
Cancel all orders and close all positions immediately.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Cancel all orders and close all positions immediately.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Price, funding, liquidation, and balance alerts using polling and WebSocket on bitmex-cli.
Autonomy progression for bitmex-cli agents: from read-only market data to autonomous fund management.
Delta-neutral basis trading between BitMEX perpetuals and fixed-date futures: entry, monitoring, and exit.
Dollar cost averaging on bitmex-cli: testnet-first, fixed qty per interval, limit orders, and position cap enforcement.
Error category handling, duplicate order prevention, retry logic, and partial fill management for bitmex-cli.
Minimize trading fees on bitmex-cli: maker vs taker, post-only orders, commission tiers, and fee audit.
| name | bitmex-recipe-emergency-flatten |
| description | Cancel all orders and close all positions immediately. |
Use this when you need to exit all exposure as fast as possible — runaway loss, infra failure, or unexpected news. This workflow cancels every open order first, then closes each open position at market.
BITMEX_API_KEY and BITMEX_API_SECRET must be set.Before starting any risky automated operation, arm a dead man's switch so positions close automatically if your process dies:
bitmex order cancel-after 60000 -o json
This instructs BitMEX to cancel all orders if no heartbeat is received within 60 seconds. Renew it regularly in your loop.
bitmex order cancel-all --yes -o json
Verify the cancellation count in the response count field.
bitmex position list -o json \
| jq '[.[] | select(.currentQty != 0) | {symbol, currentQty, avgEntryPrice, unrealisedPnl}]'
Repeat for every symbol returned above:
bitmex order close-position XBTUSD -o json
bitmex order close-position ETHUSD -o json
close-position sends a market order for the full open quantity on that symbol.
bitmex position list -o json \
| jq '[.[] | select(.currentQty != 0)] | length'
Expected result: 0. If non-zero, the market order may still be in-flight — re-check after a few seconds and repeat step 3 for any remaining symbols.
--testnet first so it executes in under 10 seconds when needed.