Agent Skills › krakenfx/kraken-cli › kraken-error-recovery

kraken-error-recovery

GitHub

处理Kraken交易订单失败、网络错误及重复提交的安全恢复机制。通过分类解析错误类型,利用Client Order ID实现幂等性检查,防止因网络波动导致的重复下单,并提供速率限制和局部成交的恢复策略。

skills/kraken-error-recovery/SKILL.md krakenfx/kraken-cli

触发场景

订单提交失败需要重试 遭遇网络错误或连接中断 疑似重复订单需去重验证 API返回速率限制或认证错误

安装

npx skills add krakenfx/kraken-cli --skill kraken-error-recovery -g -y
更多选项

不安装直接使用

npx skills use krakenfx/kraken-cli@kraken-error-recovery

指定 Agent (Claude Code)

npx skills add krakenfx/kraken-cli --skill kraken-error-recovery -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-error-recovery",
    "version": "1.0.0",
    "metadata": {
        "openclaw": {
            "category": "finance"
        },
        "requires": {
            "bins": [
                "kraken"
            ],
            "skills": [
                "kraken-shared"
            ]
        }
    },
    "description": "Handle order failures, network errors, and duplicate submissions safely."
}

kraken-error-recovery

Use this skill for:

  • recovering from failed order submissions
  • preventing duplicate orders after network errors
  • handling partial fills and stuck states
  • building resilient agent loops

Error Categories

Parse the .error field from the JSON response:

Category Meaning Recovery
auth Credentials invalid or expired Re-authenticate, do not retry
rate_limit Too many requests Read suggestion and docs_url fields, adapt strategy
network Connection failed, or the response was lost after sending (verify_first: true) Retry with backoff; with verify_first, see Duplicate Order Prevention
validation Invalid request parameters Fix inputs, do not retry unchanged
api Exchange-side rejection Inspect error message, adjust request

Duplicate Order Prevention

After a network error during order submission ("verify_first": true), the order may or may not have reached the exchange. Check before resubmitting:

kraken open-orders -o json 2>/dev/null

If the order appears in open-orders, do not resubmit. If absent:

kraken trades-history -o json 2>/dev/null

If the order filled immediately, it appears in trades. Only resubmit if the order is absent from both.

Client Order ID for Idempotency

Use --cl-ord-id to tag orders with a unique identifier:

kraken order buy BTCUSD 0.001 --type limit --price 50000 --cl-ord-id "dca-2024-01-15-001" -o json 2>/dev/null

If the submission fails, query by client order ID to check if it reached the exchange:

kraken open-orders --cl-ord-id "dca-2024-01-15-001" -o json 2>/dev/null

Cancel by client order ID if needed:

kraken order cancel --cl-ord-id "dca-2024-01-15-001" -o json 2>/dev/null

Network Error Recovery Pattern

1. Submit order (capture exit code and response)
2. If exit code != 0 and error == "network":
   a. Wait 2 seconds
   b. Check open-orders for the order (by cl-ord-id or recent orders)
   c. If found → order succeeded, proceed
   d. If not found → check trades-history
   e. If in trades → order filled, proceed
   f. If absent from both → safe to retry
3. Retry with same cl-ord-id

Rate Limit Recovery

The CLI returns rate limit errors immediately with no internal retry. The error includes actionable fields for the agent to decide next steps.

On rate_limit error:

  1. Read the suggestion field for specific guidance on what limit was hit and how to adapt.
  2. Read the docs_url field for the relevant Kraken documentation.
  3. Decide whether to retry (and when), reduce request frequency, or switch to WebSocket streaming for real-time data.
  4. Resume with a single test call before continuing the loop.
# { "error": "rate_limit", "suggestion": "...", "docs_url": "...", "retryable": true }
kraken status -o json 2>/dev/null

If status succeeds, the rate limit has cleared.

Partial Fill Handling

Limit orders may partially fill. Check order status:

kraken query-orders <TXID> -o json 2>/dev/null

The result is keyed by txid. Fields: volume (requested volume), volume_executed (filled volume), status (open, closed, canceled, expired, ...). query-orders, open-orders and closed-orders publish the same order shape.

If partially filled and the remaining volume is needed, amend or place a new order for the remaining amount.

Stuck Order Resolution

An order stuck in open state that should have filled or been canceled:

  1. Check the order:
    kraken query-orders <TXID> -o json 2>/dev/null
    
  2. If still open, cancel:
    kraken order cancel <TXID> -o json 2>/dev/null
    
  3. Verify cancellation:
    kraken open-orders -o json 2>/dev/null
    

Hard Rules

  • Never blind-retry an order after a network error; always check state first.
  • Resubmitting, amending or cancelling a live order needs the same explicit user approval as the original order, unless the agent runs at autonomy level 4+.
  • Use --cl-ord-id for all orders in automated loops.
  • On auth errors, stop all activity and re-authenticate.
  • Log every error and recovery action for post-session audit.
  • 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.

版本历史

  • 671cdd7 当前 2026-11-03 05:46

    细化了网络错误的定义以涵盖响应丢失场景;增强了速率限制恢复流程,增加状态检查步骤;补充了部分成交处理的说明。

  • aa56e59 2026-08-20 04:44
  • aa32814 2026-07-25 10:28

同 Skill 集合

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-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-liquidation-guard/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

元信息

文件数
0
版本
671cdd7
Hash
865597b9
收录时间
2026-07-25 10:28

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-17 21:01
浙ICP备14020137号-1