rea-tool-design
MOmorluto/rea486k近 7 天新增 8,943 个 star
Budget Manager. Sizes every position to your budget before anything is bought: keeps a cash buffer, caps any one stock (the excess is shared out to the others), drops slices under your minimum order, rounds so every dollar is used, supports fractional or whole shares, and writes the proposed buy orders to trader/orders.json in the exact shape of Alpaca's place_stock_order (notional as a string). Nothing is placed. Use when the user says "I have $5,000", "size my trades", "how much of each should I buy", "manage my budget", "split my money", "keep 10% in cash", "no stock over 25%", "set my rules", or after /trader-copycat writes targets.
The Budget Manager turns "copy this portfolio" into "buy exactly this much of each", inside rules the user sets once. 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}/size.py" # trader/targets.json + trader/config.json
python3 "${CLAUDE_SKILL_DIR}/size.py" --budget 5000 --write # write trader/orders.json
python3 "${CLAUDE_SKILL_DIR}/size.py" --whole-shares --prices trader/prices.json
python3 "${CLAUDE_SKILL_DIR}/size.py" --weights AAPL=22.04,AXP=17.14,GOOGL=12.62 --json
| file | what |
|---|---|
trader/config.json | the rules (start from config.example.json in this folder) |
trader/targets.json | the weights to copy, written by trader-copycat (targets.example.json here) |
trader/prices.json | only for whole shares or share counts (trader-alerts writes it) |
trader/orders.json | the proposed buy orders it writes with --write |
If trader/config.json does not exist, copy config.example.json into
trader/config.json and ask the user for each value in plain words:
python3 "${CLAUDE_SKILL_DIR}/size.py" --write
The maths, in order: the cash buffer comes off the top; the weights are renormalised to 100 over the stocks that are left; any stock over the cap is pinned at the cap and its excess is shared over the others by weight, again until nobody is over; a slice under the minimum order is dropped and its weight shared out; amounts are rounded to whole dollars and the rounding dollar goes to the biggest stock that is not capped, so nothing is left idle by accident. Money that truly cannot be invested (every stock at its cap, or whole shares that do not divide evenly) is shown as "left idle".
Show the table: ticker, weight, dollars, which stock hit the cap, the cash
buffer and what is left idle. Say where the weights came from and how old
they are (a 13F is up to 45 days old when it is filed). Then hand over to
/trader-risk.
Berkshire Hathaway's Q2 2026 13F (filed 2026-08-14), top five: Apple 22.04%, American Express 17.14%, Alphabet 12.62%, Coca-Cola 10.86%, Bank of America 9.20%. Renormalised over those five: 30.67 / 23.85 / 17.56 / 15.11 / 12.80. A $5,000 budget, a 10% cash buffer and a 25% cap:
| stock | dollars | |
|---|---|---|
| AAPL | $1,250 | capped at 25% |
| AXP | $1,119 | |
| GOOGL | $823 | |
| KO | $708 | |
| BAC | $600 | |
| cash buffer | $500 | |
| left idle | $0 |
The first order it writes is
{"symbol": "AAPL", "side": "buy", "notional": "1250", "type": "market", "time_in_force": "day"}.
Keep the weights to two decimals or more: weights already rounded to one
decimal (30.7 / 23.9 / ...) can move a slice by a dollar.
trader/prices.json; never invent a price.It never places, approves or schedules an order, never raises a limit on its own, and never sizes options, margin or short positions.
"paper": true). Going live is the user's own decision, in their own config.MOmorluto/rea486k近 7 天新增 8,943 个 star
MAmattpocock/skills337k近 7 天新增 4,978 个 star
AFaffaan-m/ECC315k近 7 天新增 4,381 个 star
NEnextlevelbuilder/ui-ux-pro-max-skill157k近 7 天新增 3,225 个 star
NEnextlevelbuilder/ui-ux-pro-max-skill157k近 7 天新增 3,225 个 star
THthedotmack/claude-mem121k近 7 天新增 1,626 个 star