Agent Skillskrakenfx/kraken-cli › kraken-dca-strategy

kraken-dca-strategy

GitHub

指导Agent在Kraken交易所执行美元成本平均法(DCA)策略,包括模拟测试、实盘买入、限价单变体及多资产配置,并持续追踪持仓成本与盈亏表现。

skills/kraken-dca-strategy/SKILL.md krakenfx/kraken-cli

Trigger Scenarios

用户希望制定或执行定期定额投资策略 需要回测或模拟DCA策略效果 请求计算和跟踪加密货币的平均持仓成本

Install

npx skills add krakenfx/kraken-cli --skill kraken-dca-strategy -g -y
More Options

Use without installing

npx skills use krakenfx/kraken-cli@kraken-dca-strategy

指定 Agent (Claude Code)

npx skills add krakenfx/kraken-cli --skill kraken-dca-strategy -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-dca-strategy",
    "version": "1.0.0",
    "metadata": {
        "openclaw": {
            "category": "finance"
        },
        "requires": {
            "bins": [
                "kraken"
            ]
        }
    },
    "description": "Dollar cost averaging with scheduled buys and performance tracking."
}

kraken-dca-strategy

Use this skill for:

  • implementing a recurring buy strategy at fixed intervals
  • tracking average cost basis over time
  • comparing DCA performance against lump-sum entry
  • running DCA simulations in paper mode first

Core Concept

Dollar cost averaging buys a fixed dollar amount of an asset at regular intervals regardless of price. This reduces timing risk and smooths entry cost over volatile periods.

Paper DCA Loop (Test First)

Always validate the strategy in paper mode before going live.

The paper buy command takes base-asset volume, not dollar amount. Calculate volume first:

kraken workspace create sandbox --capital 10000 --mode paper --currency USD -o json 2>/dev/null
export KRAKEN_WORKSPACE=sandbox

# Calculate BTC volume for a $100 buy at current price
PRICE=$(kraken ticker BTCUSD -o json 2>/dev/null | jq -r '.[].last_price')
VOLUME=$(echo "scale=8; 100 / $PRICE" | bc)

# Simulate weekly buys
kraken paper buy BTCUSD $VOLUME -o json 2>/dev/null
kraken workspace status -o json 2>/dev/null

# Repeat buy, check status each iteration
kraken paper buy BTCUSD $VOLUME -o json 2>/dev/null
kraken workspace status -o json 2>/dev/null

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

Live DCA Single Buy

Each interval, the agent executes one market buy for the fixed amount:

  1. Check current price:
    kraken ticker BTCUSD -o json 2>/dev/null
    
  2. Calculate volume from dollar amount (e.g., $100 at current price):
    PRICE=$(kraken ticker BTCUSD -o json 2>/dev/null | jq -r '.[].last_price')
    VOLUME=$(echo "scale=8; 100 / $PRICE" | bc)
    
  3. Validate the order:
    kraken order buy BTCUSD $VOLUME --type market --validate -o json 2>/dev/null
    
  4. Execute (requires human approval):
    kraken order buy BTCUSD $VOLUME --type market -o json 2>/dev/null
    
  5. Log the trade for cost basis tracking.

Cost Basis Tracking

After each buy, query trade history to compute running average:

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

The agent should maintain a running total:

  • Total invested (sum of all dollar amounts)
  • Total units acquired (sum of all volumes)
  • Average cost = total invested / total units
  • Current value = total units * current price
  • Unrealized P&L = current value - total invested

Limit-Order DCA Variant

Instead of market buys, place limit orders slightly below the current price for better fills:

PRICE=$(kraken ticker BTCUSD -o json 2>/dev/null | jq -r '.[].bid_price')
LIMIT=$(echo "scale=2; $PRICE * 0.998" | bc)
VOLUME=$(echo "scale=8; 100 / $LIMIT" | bc)
kraken order buy BTCUSD $VOLUME --type limit --price $LIMIT -o json 2>/dev/null

Check fill status at the next interval. Cancel unfilled orders before placing new ones:

kraken open-orders -o json 2>/dev/null
kraken order cancel <UNFILLED_TXID> -o json 2>/dev/null

Multi-Asset DCA

Split a fixed budget across multiple assets (e.g., 60% BTC, 30% ETH, 10% SOL):

# $100 total: $60 BTC, $30 ETH, $10 SOL
# Calculate volumes for each, then place orders sequentially

Scheduling

The CLI does not include a built-in scheduler. Agents should use external scheduling (cron, task scheduler, or the agent's own loop timer) to trigger DCA buys at the chosen interval (daily, weekly, bi-weekly, monthly).

Hard Rules

  • Never execute live DCA buys without explicit human approval for the strategy and per-trade confirmation (unless operating at autonomy level 4+).
  • Always paper-test the DCA loop first.
  • Track cost basis after every buy; do not lose history.
  • Cancel stale limit orders before placing new ones to avoid duplicate exposure.
  • 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

    工作区初始化命令由 paper init 变更为 workspace create sandbox;价格查询字段由 c[0] 改为 last_price;状态查询由 paper status 改为 workspace status。

  • 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-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-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

Metadata

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

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 15:54
浙ICP备14020137号-1 $Гость$