kraken-rebalancing

Portfolio rebalancing to maintain target allocations across assets.

23 stars

Best use case

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

Portfolio rebalancing to maintain target allocations across assets.

Teams using kraken-rebalancing 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-rebalancing/SKILL.md --create-dirs "https://raw.githubusercontent.com/jiayaoqijia/cryptoskill/main/skills/exchanges/kraken-official-rebalancing/SKILL.md"

Manual Installation

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

How kraken-rebalancing Compares

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

Frequently Asked Questions

What does this skill do?

Portfolio rebalancing to maintain target allocations across assets.

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

Use this skill for:
- checking current portfolio allocation vs target weights
- calculating rebalance trades
- executing rebalance orders with minimum trade thresholds
- scheduling periodic rebalance checks

## Define Target Allocation

Example target: 50% BTC, 30% ETH, 20% SOL (by USD value).

The agent maintains these weights and compares against current holdings.

## Read Current Portfolio

1. Get balances:
   ```bash
   kraken balance -o json 2>/dev/null
   ```
2. Get current prices for all held assets:
   ```bash
   kraken ticker BTCUSD ETHUSD SOLUSD -o json 2>/dev/null
   ```
3. Calculate USD value of each holding and total portfolio value.
4. Compute current weights: asset_value / total_value for each.

## Calculate Rebalance Trades

For each asset:
- Target value = total_portfolio * target_weight
- Current value = holdings * current_price
- Delta = target_value - current_value
- If delta > threshold: buy (delta / price) units
- If delta < -threshold: sell (|delta| / price) units

Set a minimum trade threshold (e.g., $50) to avoid placing tiny orders that waste fees.

## Paper Rebalance Test

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

# Initial buys to establish positions
kraken paper buy BTCUSD 0.05 -o json 2>/dev/null
kraken paper buy ETHUSD 1.0 -o json 2>/dev/null
kraken paper buy SOLUSD 10 -o json 2>/dev/null

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

# After price drift, rebalance
# Sell overweight asset, buy underweight asset
kraken paper sell BTCUSD 0.005 -o json 2>/dev/null
kraken paper buy SOLUSD 2 -o json 2>/dev/null

kraken paper status -o json 2>/dev/null
```

## Live Rebalance Execution

1. Calculate all required trades.
2. Present the rebalance plan to the user:
   - Current allocation vs target
   - Proposed trades with estimated fees
3. Validate each order:
   ```bash
   kraken order sell BTCUSD 0.005 --type market --validate -o json 2>/dev/null
   kraken order buy SOLUSD 2 --type market --validate -o json 2>/dev/null
   ```
4. Execute sells first (to free capital), then buys (requires human approval):
   ```bash
   kraken order sell BTCUSD 0.005 --type market -o json 2>/dev/null
   kraken order buy SOLUSD 2 --type market -o json 2>/dev/null
   ```
5. Verify final state:
   ```bash
   kraken balance -o json 2>/dev/null
   ```

## Drift Detection

Periodically compare current weights to targets. Trigger rebalance when any asset drifts beyond a threshold (e.g., 5% absolute drift):

```bash
# Agent checks balance and prices on a schedule
# If |current_weight - target_weight| > 0.05 for any asset → rebalance
```

## Rebalance with Limit Orders

For lower fees, use limit orders instead of market:

```bash
PRICE=$(kraken ticker SOLUSD -o json 2>/dev/null | jq -r '.[].a[0]')
kraken order buy SOLUSD 2 --type limit --price $PRICE -o json 2>/dev/null
```

Check fills before declaring rebalance complete:

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

## Hard Rules

- Never execute rebalance trades without explicit human approval.
- Always present the full rebalance plan (sells and buys) before execution.
- Execute sells before buys to ensure sufficient quote currency.
- Respect minimum order sizes for each pair (check pair info with `kraken pairs`).
- Apply a minimum trade threshold to skip negligible adjustments.

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-twap-execution

23
from jiayaoqijia/cryptoskill

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

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