Automatic portfolio rebalancing to maintain target allocations.

MITAuto-check passed

Install Rebalancer

skills CLI
$ npx skills add Signal-Execution-Labs/forex-trading-ai-agent --skill rebalancer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Signal-Execution-Labs/forex-trading-ai-agent rebalancer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Signal-Execution-Labs/forex-trading-ai-agent.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/rebalancer .claude/skills/rebalancer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rebalancer
GitHub stars
162
Token cost
~2.2k tokens
SKILL.md length
130 words
Files
2 (incl. scripts)
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

Automatic portfolio rebalancing to maintain target allocations.

  • Works in 4 steps: Sell tax-free lots first (>1 year for… → Harvest losses when selling overweight… → Stay under Freistellungsauftrag if… → …
  • SKILL.md covers Overview, 🤖 AUTO-PILOT MODE, Commands and Workflow
  • Runs Python scripts from its folder; calls python3

What it does

Rebalancer is an agent skill from Signal-Execution-Labs/forex-trading-ai-agent. Automatic portfolio rebalancing to maintain target allocations. Supports threshold and calendar-based triggers.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including scripts (for example `scripts/rebalance_calc.py`).

The repository describes itself as: About AI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading…. The licence is MIT.

Example prompts

  • “/rebalancer”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Sell tax-free lots first (>1 year for crypto in DE)
  2. Harvest losses when selling overweight positions
  3. Stay under Freistellungsauftrag if possible
  4. Consider wash sale rules for immediate rebuy

What it can do on your machine

Read from SKILL.md and the folder at commit b8a6047. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Rebalancer loads about 2.2k tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 130 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from Signal-Execution-Labs/forex-trading-ai-agent at commit b8a6047, republished under its MIT licence (© Signal-Execution-Labs). 130 words, ~2,246 tokens.

Download SKILL.mdSave it as .claude/skills/rebalancer/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
rebalancer
description
Automatic portfolio rebalancing to maintain target allocations. Supports threshold and calendar-based triggers.

Rebalancer

Vollautomatisches Portfolio-Rebalancing für optimale Asset Allocation.

Overview

  • Target Allocation - Ziel-Gewichtungen definieren
  • Drift Detection - Abweichungen erkennen
  • Smart Rebalancing - Steuer- und kostenoptimiert
  • Multi-Asset - Crypto, Aktien, ETFs, Bonds

🤖 AUTO-PILOT MODE

python
# ~/.kit/config/rebalancer.json
{
  "auto_pilot": {
    "enabled": true,
    "trigger": {
      "type": "threshold",  # threshold | calendar | hybrid
      "threshold_pct": 5,   # Rebalance wenn >5% Drift
      "calendar": "quarterly",  # monthly | quarterly | yearly
      "check_interval_hours": 24
    },
    "execution": {
      "mode": "sell_buy",   # sell_buy | buy_only | cashflow
      "min_trade_eur": 50,
      "require_approval": true,  # User muss bestätigen
      "approval_timeout_hours": 24
    },
    "tax_optimization": {
      "avoid_short_term_gains": true,
      "use_tax_loss_harvesting": true,
      "max_annual_gains_eur": 10000
    },
    "notifications": {
      "drift_alert_pct": 3,
      "rebalance_complete": true
    }
  },
  "target_allocation": {
    "crypto": {
      "BTC": 40,
      "ETH": 30,
      "SOL": 15,
      "stablecoins": 15
    },
    "traditional": {
      "stocks_us": 40,
      "stocks_eu": 20,
      "bonds": 25,
      "gold": 10,
      "cash": 5
    }
  }
}

Commands

Check Current Allocation vs Target
bash
python3 -c "
import ccxt
import yfinance as yf

# Target allocation
target = {
    'BTC': 40,
    'ETH': 30,
    'SOL': 15,
    'USDT': 15
}

# Current holdings (from exchange)
holdings = {
    'BTC': 0.5,
    'ETH': 3.0,
    'SOL': 50,
    'USDT': 5000
}

exchange = ccxt.binance()
values = {}
total = 0

# Calculate values
for coin, amount in holdings.items():
    if coin in ['USDT', 'USDC']:
        values[coin] = amount
    else:
        ticker = exchange.fetch_ticker(f'{coin}/USDT')
        values[coin] = amount * ticker['last']
    total += values[coin]

print('⚖️ PORTFOLIO ALLOCATION')
print('=' * 70)
print(f'{\"Asset\":8} {\"Value\":>12} {\"Current\":>10} {\"Target\":>10} {\"Drift\":>10} {\"Status\":>10}')
print('-' * 70)

max_drift = 0
for coin in target:
    current_pct = (values.get(coin, 0) / total * 100) if total > 0 else 0
    target_pct = target[coin]
    drift = current_pct - target_pct
    max_drift = max(max_drift, abs(drift))
    
    if abs(drift) > 5:
        status = '🔴 REBAL'
    elif abs(drift) > 2:
        status = '🟡 Watch'
    else:
        status = '🟢 OK'
    
    print(f'{coin:8} \${values.get(coin, 0):>11,.2f} {current_pct:>9.1f}% {target_pct:>9.1f}% {drift:>+9.1f}% {status:>10}')

print('-' * 70)
print(f'{\"TOTAL\":8} \${total:>11,.2f}')
print()

if max_drift > 5:
    print('⚠️ REBALANCING RECOMMENDED - Max drift exceeds 5%')
else:
    print('✅ Portfolio within tolerance')
"
Calculate Rebalance Trades
bash
python3 -c "
# Current vs Target
current_values = {
    'BTC': 25000,   # 50%
    'ETH': 15000,   # 30%
    'SOL': 5000,    # 10%
    'USDT': 5000    # 10%
}

target_pct = {
    'BTC': 40,
    'ETH': 30,
    'SOL': 15,
    'USDT': 15
}

total = sum(current_values.values())

print('⚖️ REBALANCE CALCULATION')
print('=' * 60)
print(f'Total Portfolio: \${total:,.2f}')
print()
print(f'{\"Asset\":8} {\"Current\":>12} {\"Target\":>12} {\"Action\":>15}')
print('-' * 60)

trades = []

for asset, target in target_pct.items():
    current_val = current_values.get(asset, 0)
    target_val = total * (target / 100)
    diff = target_val - current_val
    
    if abs(diff) > 50:  # Min trade threshold
        action = f'BUY \${diff:,.0f}' if diff > 0 else f'SELL \${-diff:,.0f}'
        trades.append({'asset': asset, 'action': 'buy' if diff > 0 else 'sell', 'amount': abs(diff)})
    else:
        action = '—'
    
    print(f'{asset:8} \${current_val:>11,.2f} \${target_val:>11,.2f} {action:>15}')

print()
print('📋 TRADE ORDERS:')
for t in trades:
    emoji = '🟢' if t['action'] == 'buy' else '🔴'
    print(f\"  {emoji} {t['action'].upper()} \${t['amount']:,.2f} of {t['asset']}\")
"
Tax-Optimized Rebalancing
bash
python3 -c "
from datetime import datetime, timedelta

# Holdings with purchase dates
holdings = [
    {'asset': 'BTC', 'amount': 0.3, 'buy_date': '2025-01-15', 'cost_basis': 35000},
    {'asset': 'BTC', 'amount': 0.2, 'buy_date': '2025-08-01', 'cost_basis': 45000},
    {'asset': 'ETH', 'amount': 2.0, 'buy_date': '2024-12-01', 'cost_basis': 2200},
]

# Need to sell $5000 of BTC for rebalancing
sell_target = 5000
btc_price = 50000

print('⚖️ TAX-OPTIMIZED REBALANCING')
print('=' * 60)
print(f'Need to sell: \${sell_target:,.2f} of BTC')
print()

# Sort lots by tax efficiency
today = datetime.now()
btc_lots = [h for h in holdings if h['asset'] == 'BTC']

for lot in btc_lots:
    buy_date = datetime.fromisoformat(lot['buy_date'])
    holding_days = (today - buy_date).days
    lot['holding_days'] = holding_days
    lot['tax_free'] = holding_days >= 365
    lot['current_value'] = lot['amount'] * btc_price
    lot['gain_pct'] = ((btc_price - lot['cost_basis']) / lot['cost_basis']) * 100

# Strategy: Sell tax-free lots first, then lowest gain lots
btc_lots.sort(key=lambda x: (-x['tax_free'], x['gain_pct']))

print('Lot Selection (tax-optimized):')
print('-' * 60)

remaining = sell_target
for lot in btc_lots:
    if remaining <= 0:
        break
    
    sell_value = min(lot['current_value'], remaining)
    sell_amount = sell_value / btc_price
    
    status = '🟢 TAX-FREE' if lot['tax_free'] else f\"🔴 Taxable ({lot['gain_pct']:+.1f}% gain)\"
    print(f\"  Sell {sell_amount:.4f} BTC from {lot['buy_date']} lot | {status}\")
    
    remaining -= sell_value

print()
print('💡 Tax Impact: Minimal (prioritized tax-free lots)')
"
Multi-Asset Rebalancing
bash
python3 -c "
# Full portfolio: Crypto + Stocks + Bonds
portfolio = {
    'crypto': {
        'BTC': 20000,
        'ETH': 10000,
    },
    'stocks': {
        'VTI': 30000,   # US Total Market
        'VXUS': 15000,  # International
    },
    'bonds': {
        'BND': 15000,   # Total Bond
    },
    'gold': {
        'GLD': 5000,
    },
    'cash': {
        'EUR': 5000,
    }
}

# Target allocation by class
target_class = {
    'crypto': 30,
    'stocks': 45,
    'bonds': 15,
    'gold': 5,
    'cash': 5
}

# Calculate totals
class_values = {cls: sum(assets.values()) for cls, assets in portfolio.items()}
total = sum(class_values.values())

print('⚖️ MULTI-ASSET REBALANCING')
print('=' * 60)
print(f'Total Portfolio: \${total:,.2f}')
print()
print('BY ASSET CLASS:')
print('-' * 60)

for cls, target in target_class.items():
    current_val = class_values.get(cls, 0)
    current_pct = (current_val / total * 100) if total > 0 else 0
    target_val = total * (target / 100)
    diff = target_val - current_val
    
    if abs(diff) > 100:
        action = f'+\${diff:,.0f}' if diff > 0 else f'-\${-diff:,.0f}'
    else:
        action = 'OK'
    
    bar = '█' * int(current_pct / 2)
    print(f'{cls:8} {current_pct:5.1f}% -> {target:5.1f}% | {action:>10} | {bar}')
"
Auto-Pilot: Scheduled Rebalancing
bash
python3 -c "
import json
from datetime import datetime

print('🤖 REBALANCER AUTO-PILOT')
print('=' * 50)
print(f'Check time: {datetime.now().isoformat()}')
print()

# Check triggers
drift_detected = True  # From allocation check
threshold = 5

if drift_detected:
    print('⚠️ DRIFT DETECTED > 5%')
    print()
    print('Proposed trades:')
    print('  🔴 SELL \$2,000 BTC')
    print('  🟢 BUY \$1,500 SOL')
    print('  🟢 BUY \$500 USDT')
    print()
    print('📱 Awaiting user approval...')
    print('   Reply \"APPROVE\" to execute')
    print('   Reply \"SKIP\" to postpone')
    print('   Auto-timeout in 24 hours')
else:
    print('✅ Portfolio within tolerance')
    print('   No rebalancing needed')
"

Workflow

Rebalancing Strategies
StrategyDescriptionBest For
ThresholdRebalance when drift > X%Active traders
CalendarFixed schedule (quarterly)Passive investors
CashflowOnly use new depositsTax-efficient
HybridCalendar + threshold overrideBalanced approach
Execution Modes
ModeDescription
sell_buySell overweight, buy underweight
buy_onlyOnly buy underweight (no selling)
cashflowUse dividends/deposits for buying
Tax Considerations
  1. Sell tax-free lots first (>1 year for crypto in DE)
  2. Harvest losses when selling overweight positions
  3. Stay under Freistellungsauftrag if possible
  4. Consider wash sale rules for immediate rebuy

© Signal-Execution-Labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (scripts) in skills/rebalancer of Signal-Execution-Labs/forex-trading-ai-agent.

  • SKILL.md
  • scripts/rebalance_calc.py

Open the folder on GitHubat commit b8a6047

Compare with similar skills

Rebalancer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Rebalancer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rebalancer this skillSignal-Execution-Labs/forex-trading-ai-agent162—~2.2kAutomated safety check: PassMIT
Trader Portfolioruvnet/ruflo74k—~475Automated safety check: NotesMIT
Portfolioanthropics/claude-for-legal9.6k3 repos~5.3kAutomated safety check: PassApache-2.0
Wiki Maintaineropenclaw/openclaw392k1 repos~462Automated safety check: PassMIT
Asset Allocation and OptimizersHKUDS/Vibe-Trading35k—~2.9kAutomated safety check: PassMIT
Obsidian Vault Maintaineropenclaw/openclaw392k1 repos~262Automated safety check: PassMIT

Similar skills

  • Trader Portfolio

    ruvnet/ruflo

    Optimize portfolio allocation using npx neural-trader mean-variance engine with risk constraints and rebalancing plan

    74k GitHub stars~475 tokensUpdated today
    Auto-check: notes
  • Portfolio

    anthropics/claude-for-legal

    Official

    Track the IP portfolio — registrations, renewals, maintenance fees, and use declarations.

    9.6k GitHub starsUsed in 3 repos~5.3k tokens
    Legal & ComplianceAuto-check passed
  • Wiki Maintainer

    openclaw/openclaw

    Maintain the OpenClaw memory wiki vault with deterministic pages, managed blocks, and source-backed updates.

    392k GitHub starsUsed in 1 repo~462 tokens
    Knowledge ManagementAuto-check passed
  • Explains portfolio theory and the built-in optimizers: mean-variance (MPT), Black-Litterman, risk budgeting and all-weather allocation, plus rebalancing rules and config output.

    35k GitHub stars~2.9k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Obsidian Vault Maintainer

    openclaw/openclaw

    Maintain an Obsidian-friendly memory wiki vault with wikilinks, frontmatter, and official Obsidian CLI awareness.

    392k GitHub starsUsed in 1 repo~262 tokens
    Knowledge ManagementAuto-check passed
  • Openclaw PR Maintainer

    openclaw/openclaw

    Review, triage, repair, or land OpenClaw issues and pull requests with current-source evidence and the native maintainer workflow.

    392k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check passed

More from Signal-Execution-Labs/forex-trading-ai-agent

All 11 skills in this repo
  • Alert System

    Signal-Execution-Labs/forex-trading-ai-agent

    Set price alerts, volume alerts, indicator alerts (RSI/MACD), and news alerts for crypto trading.

    162 GitHub stars~1.6k tokensUpdated 26 days ago
    Auto-check passed
  • Auto Trader

    Signal-Execution-Labs/forex-trading-ai-agent

    Automated trading with strategy execution, risk management, position sizing, and stop-loss/take-profit.

    162 GitHub stars~2.1k tokensUpdated 26 days ago
    Auto-check passed
  • Backtester

    Signal-Execution-Labs/forex-trading-ai-agent

    Backtest trading strategies with historical data. An agent skill from Signal-Execution-Labs/forex-trading-ai-agent.

    162 GitHub stars~2.7k tokensUpdated 26 days ago
    Auto-check passed
  • Defi Connector

    Signal-Execution-Labs/forex-trading-ai-agent

    Connect to DeFi protocols for staking, lending, yield farming, and liquidity provision.

    162 GitHub stars~2.4k tokensUpdated 26 days ago
    Auto-check passed
  • Dividend Manager

    Signal-Execution-Labs/forex-trading-ai-agent

    Track dividends, manage DRIP (reinvestment), forecast income, and optimize dividend portfolio.

    162 GitHub stars~2.1k tokensUpdated 26 days ago
    Auto-check passed
  • Exchange Connector

    Signal-Execution-Labs/forex-trading-ai-agent

    Connect to crypto exchanges (Binance, Kraken, Coinbase, etc.).

    162 GitHub stars~1k tokensUpdated 26 days ago
    Auto-check passed

Questions about Rebalancer

What does Rebalancer do?

Automatic portfolio rebalancing to maintain target allocations. Rebalancer is an agent skill from Signal-Execution-Labs/forex-trading-ai-agent. Automatic portfolio rebalancing to maintain target allocations.

How do I install Rebalancer in Claude Code?

Run `npx skills add Signal-Execution-Labs/forex-trading-ai-agent --skill rebalancer -a claude-code`. Or copy the skill folder (skills/rebalancer in Signal-Execution-Labs/forex-trading-ai-agent) into .claude/skills/rebalancer in your project. Claude Code loads it when a task matches its description.

How do I install Rebalancer in Codex?

Run `npx skills add Signal-Execution-Labs/forex-trading-ai-agent --skill rebalancer -a codex`. Or copy the skill folder (skills/rebalancer in Signal-Execution-Labs/forex-trading-ai-agent) into .agents/skills/rebalancer in your project. Codex loads it when a task matches its description.

Can I use Rebalancer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Signal-Execution-Labs/forex-trading-ai-agent --skill rebalancer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rebalancer, .gemini/skills/rebalancer, .github/skills/rebalancer and .opencode/skills/rebalancer in your project.

What does Rebalancer need to run?

Going by SKILL.md and its folder, Rebalancer needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Rebalancer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Rebalancer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Rebalancer use?

Rebalancer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rebalancer use?

About 2.2k tokens (SKILL.md is roughly 9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Rebalancer?

Skills that share tags, products or a category with Rebalancer: Trader Portfolio (ruvnet/ruflo, 74k stars), Portfolio (anthropics/claude-for-legal, 9.6k stars), Wiki Maintainer (openclaw/openclaw, 392k stars) and Asset Allocation and Optimizers (HKUDS/Vibe-Trading, 35k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rebalancer?

Signal-Execution-Labs (a GitHub organization) maintains it in Signal-Execution-Labs/forex-trading-ai-agent, which has 162 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on September 14, 2026.

Source: Signal-Execution-Labs/forex-trading-ai-agent on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.