# Trader Rebalance

Rebalancer.

- Repository: https://github.com/Jakeschincariol/trader-skill (1074 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-14
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add Jakeschincariol/trader-skill --skill trader-rebalance -g -a claude-code -y`
Codex: `npx skills add Jakeschincariol/trader-skill --skill trader-rebalance -g -a codex -y`
Cursor: `npx skills add Jakeschincariol/trader-skill --skill trader-rebalance -g -a cursor -y`
Gemini CLI: `npx skills add Jakeschincariol/trader-skill --skill trader-rebalance -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add Jakeschincariol/trader-skill`

## Description

Rebalancer. Brings the portfolio back to its target weights when it drifts: values every holding at current prices, works out each stock's drift from its target in percentage points, trades only the stocks outside a band (default 5 points), keeps the cash buffer and the per-stock cap, skips tiny trades, lists sells before buys, and writes the trades to trader/orders.json as proposals. Use when the user says "rebalance", "my portfolio drifted", "bring it back to the targets", "I added money", "the new 13F changed the weights", "am I overweight", or on a schedule (monthly or quarterly) after /trader-copycat updates the targets.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# trader-rebalance

The Rebalancer keeps the portfolio looking like the plan. Prices move, new
money arrives and a new 13F changes the weights; this skill finds the stocks
that drifted too far and proposes the trades that bring them back. It writes
proposals only: trader-risk checks them and trader-broker asks the user yes
or no for each one.

`${CLAUDE_SKILL_DIR}` below is this skill's folder (where this SKILL.md lives).

```bash
python3 "${CLAUDE_SKILL_DIR}/rebalance.py"                    # the drift table, no files written
python3 "${CLAUDE_SKILL_DIR}/rebalance.py" --band 5 --write   # proposals -> trader/orders.json
python3 "${CLAUDE_SKILL_DIR}/rebalance.py" --sell-untracked   # also sell holdings not in the targets
python3 "${CLAUDE_SKILL_DIR}/rebalance.py" --json
```

## What it reads and writes

| file | what |
| --- | --- |
| `trader/portfolio.json` | cash and positions (shares); same shape as trader-tax's `portfolio.example.json` |
| `trader/prices.json` | a price for every holding and every target (trader-alerts writes it) |
| `trader/targets.json` | the target weights (trader-copycat writes it) |
| `trader/config.json` | cash buffer, cap, min and max order, `rebalance_band_pct` |
| `trader/orders.json` | the proposals it writes with `--write`, sells first |

## How it decides

The rest: https://github.com/Jakeschincariol/trader-skill/blob/HEAD/trader-rebalance/SKILL.md
