kraken-twap-execution

Execute large orders as time-weighted slices to reduce market impact.

23 stars

Best use case

kraken-twap-execution is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Execute large orders as time-weighted slices to reduce market impact.

Teams using kraken-twap-execution should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/kraken-official-twap-execution/SKILL.md --create-dirs "https://raw.githubusercontent.com/jiayaoqijia/cryptoskill/main/skills/exchanges/kraken-official-twap-execution/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/kraken-official-twap-execution/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How kraken-twap-execution Compares

Feature / Agentkraken-twap-executionStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Execute large orders as time-weighted slices to reduce market impact.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

```bash
kraken paper init --balance 50000 -o json 2>/dev/null

# 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 paper status -o json 2>/dev/null
```

## Live TWAP Loop

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

```bash
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:

```bash
PRICE=$(kraken ticker BTCUSD -o json 2>/dev/null | jq -r '.[].a[0]')
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:

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

## Tracking Average Fill

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

```bash
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.

Related Skills

Kraken Crypto Skill

23
from jiayaoqijia/cryptoskill

Use the kraken_cli.py wrapper to query your Kraken account.

openclaw_kraken

23
from jiayaoqijia/cryptoskill

Use a Bash CLI to query Kraken Spot and Futures APIs, inspect account state, run guarded trading and funding actions, and work with Kraken websocket payloads using OpenClaw-managed secrets.

kraken-ws-streaming

23
from jiayaoqijia/cryptoskill

Real-time data streaming via WebSocket for spot and futures.

kraken-tax-export

23
from jiayaoqijia/cryptoskill

Export trade history, ledgers, and cost basis data for tax reporting.

kraken-subaccount-ops

23
from jiayaoqijia/cryptoskill

Create and manage subaccounts with inter-account transfers.

kraken-stop-take-profit

23
from jiayaoqijia/cryptoskill

Manage stop-loss and take-profit orders for risk-bounded positions.

kraken-spot-execution

23
from jiayaoqijia/cryptoskill

Execute spot orders with validation, confirmation gates, and post-trade checks.

kraken-shared

23
from jiayaoqijia/cryptoskill

Shared runtime contract for kraken-cli: auth, invocation, parsing, and safety.

kraken-risk-operations

23
from jiayaoqijia/cryptoskill

Operational risk controls for live agent trading sessions.

kraken-rebalancing

23
from jiayaoqijia/cryptoskill

Portfolio rebalancing to maintain target allocations across assets.

kraken-rate-limits

23
from jiayaoqijia/cryptoskill

Understand Kraken API rate limits and adapt agent behavior when limits are hit.

kraken-portfolio-intel

23
from jiayaoqijia/cryptoskill

Portfolio analysis, P&L tracking, trade history, and export reports.