Skills

Trader Rebalance

Rebalancer.

Install

npx skills add Jakeschincariol/trader-skill --skill trader-rebalance -g -a claude-code -y
Category
Engineering
Updated
21d ago
License
MIT
Context cost
Lightabout 1,132 tokens
Runs scripts
Yes, review before use

What it does

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.

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

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

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

How it decides

Read the whole SKILL.md on GitHub

More in Engineering