Agent Skillskrakenfx/kraken-cli › kraken-twap-execution

kraken-twap-execution

GitHub

将大额订单拆分为时间加权切片执行,以降低市场冲击和滑点。支持模拟与实盘交易,涵盖限价单变体、成交均价追踪及速率限制处理,确保执行过程可控。

skills/kraken-twap-execution/SKILL.md krakenfx/kraken-cli

Trigger Scenarios

需要执行大额交易以减小市场影响 请求 TWAP 算法执行策略

Install

npx skills add krakenfx/kraken-cli --skill kraken-twap-execution -g -y
More Options

Use without installing

npx skills use krakenfx/kraken-cli@kraken-twap-execution

指定 Agent (Claude Code)

npx skills add krakenfx/kraken-cli --skill kraken-twap-execution -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-twap-execution",
    "version": "1.0.0",
    "metadata": {
        "openclaw": {
            "category": "finance"
        },
        "requires": {
            "bins": [
                "kraken"
            ],
            "skills": [
                "kraken-spot-execution"
            ]
        }
    },
    "description": "Execute large orders as time-weighted slices to reduce market impact."
}

kraken-twap-execution

Use this skill for:

  • breaking a large order into smaller time-spaced slices
  • reducing market impact and slippage on size
  • executing over minutes, hours, or days
  • tracking average fill price across slices

Core Concept

Time-Weighted Average Price (TWAP) splits a large order into N equal slices executed at regular intervals. The goal is to achieve an average price close to the time-weighted market average, reducing the impact a single large order would have on the book.

Parameters

  • Total volume: the full amount to buy or sell
  • Slices: number of child orders (e.g., 10)
  • Interval: time between slices (e.g., 60s, 300s)
  • Slice volume: total volume / slices

Paper TWAP Test

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

# Simulate 5 slices of 0.01 BTC each, 60s apart
kraken paper buy BTCUSD 0.01 -o json 2>/dev/null
# wait 60s
kraken paper buy BTCUSD 0.01 -o json 2>/dev/null
# wait 60s
kraken paper buy BTCUSD 0.01 -o json 2>/dev/null
# repeat...

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

Live TWAP Loop

The agent runs this loop externally (the CLI does not have a built-in scheduler):

TOTAL_VOLUME=0.05
SLICES=5
SLICE_VOL=$(echo "scale=8; $TOTAL_VOLUME / $SLICES" | bc)
INTERVAL=60

for i in $(seq 1 $SLICES); do
  kraken order buy BTCUSD $SLICE_VOL --type market -o json 2>/dev/null
  [ $i -lt $SLICES ] && sleep $INTERVAL
done

Limit-Order TWAP Variant

Use limit orders at the current best bid/ask for potentially better fills:

PRICE=$(kraken ticker BTCUSD -o json 2>/dev/null | jq -r '.[].ask_price')
kraken order buy BTCUSD $SLICE_VOL --type limit --price $PRICE -o json 2>/dev/null

Check fill status before the next slice. Cancel unfilled orders and adjust:

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

Tracking Average Fill

After all slices, compute the volume-weighted average price from trade history:

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

Sum (price * volume) for each fill, divide by total volume filled.

Rate Limit Awareness

The CLI does not pre-throttle requests. If a slice submission hits a rate limit, the error includes a suggestion field with tier-specific limits and a docs_url pointing to Kraken's documentation. On rate_limit error, pause the loop, read the suggestion, and adjust the interval before resuming. A 60-second interval between slices is well within budget for all tiers. For shorter intervals, consult the kraken-rate-limits skill for per-tier counter costs and decay rates.

Hard Rules

  • Each live slice requires human approval unless operating at autonomy level 4+.
  • Track cumulative fill volume and stop if total exceeds target (handle partial fills).
  • On error, pause the loop rather than skipping the slice; resume after recovery.
  • Log every slice for post-execution analysis.
  • 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:45
  • aa32814 2026-07-25 10:29

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-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-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
82b4590f
Indexed
2026-07-25 10:29

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