Agent Skillskrakenfx/kraken-cli › kraken-liquidation-guard

kraken-liquidation-guard

GitHub

用于监控期货保证金比率以预防强制平仓,包含阈值告警、自动减仓、紧急平仓及资金追加等自动化流程。

skills/kraken-liquidation-guard/SKILL.md krakenfx/kraken-cli

Trigger Scenarios

检测到保证金比率接近警戒线 需要执行紧急平仓或减仓操作 进行期货交易期间的持续风控监控

Install

npx skills add krakenfx/kraken-cli --skill kraken-liquidation-guard -g -y
More Options

Use without installing

npx skills use krakenfx/kraken-cli@kraken-liquidation-guard

指定 Agent (Claude Code)

npx skills add krakenfx/kraken-cli --skill kraken-liquidation-guard -a claude-code -g -y

安装 repo 全部 skill

npx skills add krakenfx/kraken-cli --all -g -y

预览 repo 内 skill

npx skills add krakenfx/kraken-cli --list

SKILL.md

Frontmatter
{
    "name": "kraken-liquidation-guard",
    "version": "1.0.0",
    "metadata": {
        "openclaw": {
            "category": "finance"
        },
        "requires": {
            "bins": [
                "kraken"
            ],
            "skills": [
                "kraken-futures-risk"
            ]
        }
    },
    "description": "Prevent futures liquidation through margin monitoring and emergency procedures."
}

kraken-liquidation-guard

Use this skill for:

  • monitoring margin ratio to detect liquidation risk
  • automated position reduction when thresholds are breached
  • emergency flatten procedures
  • proactive margin top-up patterns

Margin Health Check

kraken futures accounts -o json 2>/dev/null

Key fields:

  • equity: total account value
  • initialMargin: margin held for positions
  • maintenanceMargin: minimum margin before liquidation
  • availableFunds: free margin for new positions

Margin ratio = maintenanceMargin / equity. Liquidation approaches as this ratio nears 1.0.

Alert Thresholds

Ratio Status Action
< 0.3 Healthy Normal operation
0.3 - 0.5 Caution Reduce position or add margin
0.5 - 0.7 Warning Reduce position immediately
> 0.7 Critical Emergency flatten

Monitoring Loop

kraken futures ws balances -o json 2>/dev/null | while read -r line; do
  # Parse equity and maintenanceMargin
  # Calculate ratio
  # Alert or act when threshold is breached
done

Or poll periodically:

kraken futures accounts -o json 2>/dev/null

Unwind Queue Check

If a position enters the unwind queue, liquidation is imminent:

kraken futures unwind-queue -o json 2>/dev/null

Any result here requires immediate action.

Emergency Flatten

Cancel all open orders, then close all positions:

# Cancel all orders to free held margin
kraken futures cancel-all --yes -o json 2>/dev/null

# Close each position with reduce-only market orders
kraken futures positions -o json 2>/dev/null
# For each position:
kraken futures order sell PF_XBTUSD <SIZE> --reduce-only -o json 2>/dev/null

Margin Top-Up

Transfer funds from spot wallet to futures to increase margin:

kraken futures transfer 5000 USD -o json 2>/dev/null

Or from main account:

kraken wallet-transfer USD 5000 --from <SPOT_IIBAN> --to <FUTURES_IIBAN> -o json 2>/dev/null

Leverage Reduction

Lower leverage to reduce margin requirements:

kraken futures set-leverage PF_XBTUSD 2 -o json 2>/dev/null

Dead Man's Switch

Always run a dead man's switch during futures sessions:

kraken futures cancel-after 600 -o json 2>/dev/null

If the agent crashes, orders auto-cancel, preventing further margin consumption.

Hard Rules

  • Monitor margin ratio continuously during any futures session.
  • Alert at 0.5 ratio; act at 0.7. Do not wait for the exchange to liquidate.
  • Emergency flatten requires human approval unless the agent operates at autonomy level 4+.
  • Never increase position size when margin ratio is above 0.3.
  • futures set-leverage is flagged dangerous: it changes the margin requirement on open positions, so de-risking with it needs the same human approval as flattening.
  • 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:44

    无版本变更

  • aa32814 2026-07-25 10:28

Same Skill Collection

skills/kraken-alert-patterns/SKILL.md
skills/kraken-autonomy-levels/SKILL.md
skills/kraken-basis-trading/SKILL.md
skills/kraken-dca-strategy/SKILL.md
skills/kraken-earn-staking/SKILL.md
skills/kraken-error-recovery/SKILL.md
skills/kraken-fee-optimization/SKILL.md
skills/kraken-funding-carry/SKILL.md
skills/kraken-funding-ops/SKILL.md
skills/kraken-futures-risk/SKILL.md
skills/kraken-grid-trading/SKILL.md
skills/kraken-lab-experiment/SKILL.md
skills/kraken-market-intel/SKILL.md
skills/kraken-mcp-integration/SKILL.md
skills/kraken-multi-pair/SKILL.md
skills/kraken-order-types/SKILL.md
skills/kraken-paper-strategy/SKILL.md
skills/kraken-paper-to-live/SKILL.md
skills/kraken-playground/SKILL.md
skills/kraken-portfolio-intel/SKILL.md
skills/kraken-rate-limits/SKILL.md
skills/kraken-rebalancing/SKILL.md
skills/kraken-risk-operations/SKILL.md
skills/kraken-setup/SKILL.md
skills/kraken-spot-execution/SKILL.md
skills/kraken-stop-take-profit/SKILL.md
skills/kraken-subaccount-ops/SKILL.md
skills/kraken-tax-export/SKILL.md
skills/kraken-twap-execution/SKILL.md
skills/kraken-ws-streaming/SKILL.md
skills/recipe-basis-trade-entry/SKILL.md
skills/recipe-daily-pnl-report/SKILL.md
skills/recipe-drawdown-circuit-breaker/SKILL.md
skills/recipe-earn-yield-compare/SKILL.md
skills/recipe-emergency-flatten/SKILL.md
skills/recipe-fee-tier-progress/SKILL.md
skills/recipe-funding-rate-scan/SKILL.md
skills/recipe-futures-hedge-spot/SKILL.md
skills/recipe-launch-grid-bot/SKILL.md
skills/recipe-morning-market-brief/SKILL.md
skills/recipe-multi-pair-breakout-watch/SKILL.md
skills/recipe-paper-strategy-backtest/SKILL.md
skills/recipe-playground-dca-triggered/SKILL.md
skills/recipe-playground-dca/SKILL.md
skills/recipe-playground-price-alert/SKILL.md
skills/recipe-playground-rebalance/SKILL.md
skills/recipe-playground-webhook/SKILL.md
skills/recipe-portfolio-snapshot-csv/SKILL.md
skills/recipe-price-level-alerts/SKILL.md

Metadata

Files
0
Version
aa56e59
Hash
69154253
Indexed
2026-07-25 10:28

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 23:17
浙ICP备14020137号-1 $방문자$