원클릭으로
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.