Tooluck logoTooluck
SKILL.md

trader-rebalance

Agent skill fromJakeschincariol/trader-skill

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.

How to install trader-rebalance

install trader-rebalance
# install the trader-skill pack with the skills CLI
npx skills add Jakeschincariol/trader-skill

# or add only this skill to Claude Code: copy the folder

trader-rebalance/

# into

~/.claude/skills/trader-rebalance/ (all projects)

.claude/skills/trader-rebalance/ (one project)

trader-rebalance/SKILL.md

MITFull file
1# trader-rebalance
2
3The Rebalancer keeps the portfolio looking like the plan. Prices move, new
4money arrives and a new 13F changes the weights; this skill finds the stocks
5that drifted too far and proposes the trades that bring them back. It writes
6proposals only: trader-risk checks them and trader-broker asks the user yes
7or no for each one.
8
9`${CLAUDE_SKILL_DIR}` below is this skill's folder (where this SKILL.md lives).
10
11```bash
12python3 "${CLAUDE_SKILL_DIR}/rebalance.py" # the drift table, no files written
13python3 "${CLAUDE_SKILL_DIR}/rebalance.py" --band 5 --write # proposals -> trader/orders.json
14python3 "${CLAUDE_SKILL_DIR}/rebalance.py" --sell-untracked # also sell holdings not in the targets
15python3 "${CLAUDE_SKILL_DIR}/rebalance.py" --json
16```
17
18## What it reads and writes
19
20| file | what |
21| --- | --- |
22| `trader/portfolio.json` | cash and positions (shares); same shape as trader-tax's `portfolio.example.json` |
23| `trader/prices.json` | a price for every holding and every target (trader-alerts writes it) |
24| `trader/targets.json` | the target weights (trader-copycat writes it) |
25| `trader/config.json` | cash buffer, cap, min and max order, `rebalance_band_pct` |
26| `trader/orders.json` | the proposals it writes with `--write`, sells first |
27
28## How it decides
29
30- **Account value** = cash + every holding at its price.
31- **Targets**: the weights renormalised over the stock sleeve (account minus
32…

Excerpt shown under the repository's MIT license.

More skills in trader-skill

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates