recipe-emergency-flatten
GitHub用于紧急情况下取消所有挂单并平仓现货及期货头寸,以快速降低风险。包含调用CLI命令、验证状态及余额检查步骤,注意滑点风险及自动确认权限。
Trigger Scenarios
Install
npx skills add krakenfx/kraken-cli --skill recipe-emergency-flatten -g -y
SKILL.md
Frontmatter
{
"name": "recipe-emergency-flatten",
"version": "1.0.0",
"metadata": {
"openclaw": {
"domain": "risk",
"category": "recipe"
},
"requires": {
"bins": [
"kraken"
],
"skills": [
"kraken-risk-operations",
"kraken-liquidation-guard"
]
}
},
"description": "Cancel all orders and close all positions in an emergency."
}
Emergency Flatten
PREREQUISITE: Load the following skills to execute this recipe:
kraken-risk-operations,kraken-liquidation-guard
Immediately cancel all orders and close all positions across spot and futures.
CAUTION: This closes everything at market prices. Slippage may be significant. The
--yesflag skips confirmation prompts and is only appropriate at autonomy level 4+ (seekraken-autonomy-levels). At lower levels, omit--yesand confirm each cancel with the user.
Steps
- Cancel all spot orders (dangerous):
kraken order cancel-all --yes -o json 2>/dev/null - Cancel all futures orders (dangerous):
kraken futures cancel-all --yes -o json 2>/dev/null - Check spot positions:
kraken positions -o json 2>/dev/null - Close each spot margin position with a market order (requires human approval)
- Check futures positions and extract sizes:
kraken futures positions -o json 2>/dev/null(parse each position'ssizeandsidefields) - Close each futures position with reduce-only market orders (use
sellfor longs,buyfor shorts): e.g.,kraken futures order sell PF_XBTUSD 1 --reduce-only -o json 2>/dev/null - Verify no open orders remain:
kraken open-orders -o json 2>/dev/null - Verify no futures orders remain:
kraken futures open-orders -o json 2>/dev/null - Verify all positions closed:
kraken futures positions -o json 2>/dev/null - Check final balances:
kraken balance -o json 2>/dev/null
If you hit a mismatch between what you are trying to do and the CLI's interface or responses — including a mismatch between this skill and the installed CLI version's contract — feel free to submit feedback with kraken feedback.
Version History
- aa56e59 Current 2026-08-20 04:46
- aa32814 2026-07-25 10:29


