本文へ移動
cccskills
無料GitHub で公開

trader-rebalance

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.

日本語の概要は準備中です。原文の説明を表示しています。

実行スコア 未検証

インストール方法を見る

含まれるファイル(2)

  • SKILL.md5.1 KB
  • rebalance.py14.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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

  • Account value = cash + every holding at its price.
  • Targets: the weights renormalised over the stock sleeve (account minus the cash buffer), with no stock above max_position_pct of the account. The excess is shared out, the same way trader-budget does it, so a capped stock is not bought back over the cap every month.
  • Drift = current percent of the account minus target percent.
  • Band: only stocks drifting MORE than the band trade (default 5 points). A trade takes the stock all the way back to its target. A small band means more trades; a wide band means fewer.
  • Sells first, then buys. Buys only spend cash above the buffer; if there is not enough, all buys are scaled down by the same share.
  • Trades under min_order_usd are skipped. A trade over max_order_usd is cut to the max with a note to run again after it fills.
  • Untracked holdings (not in the targets) are left alone and listed, unless the user asks to sell them with --sell-untracked.

Steps

  1. Refresh prices: trader-alerts alerts.py quote --holdings --write.
  2. Run rebalance.py and show the drift table in plain words: which stocks are over or under, by how many points, and what it would trade.
  3. Before any sell, run trader-tax (lots.py sell TICKER SHARES) and show what the sale would realize. Selling a winner can mean a tax bill.
  4. If the user wants the trades: rebalance.py --write, then /trader-risk, then /trader-broker, one yes per order.

Example: the reel's portfolio

The copy portfolio bought on 2026-10-13 (AAPL $1,250 capped, AXP $1,119, GOOGL $823, KO $708, BAC $600, $500 cash), valued at that day's closes, sits on its targets: every drift is under 0.1 point, so rebalance.py says "Nothing is outside the band" and exits 1. If the user adds $2,000 of cash, the account is $7,000 and the cap becomes $1,750. AAPL is now 7.1 points under its target and AXP 6.4, both outside the 5-point band, so it proposes buying $499 of AAPL and $446 of AXP. GOOGL, KO and BAC are under target too, but inside the band, so they wait. Add $5,000 instead and all five are outside the band: five buys that leave the $1,000 buffer in cash.

What it never does

It never places an order, never trades inside the band to chase small differences, never sells holdings outside the targets unless asked, and never says a rebalance will improve returns.

Safety

  • Education and tooling, not financial advice. A rebalance follows the user's own targets, not a forecast.
  • Paper trading by default ("paper": true). Going live is the user's own decision, in their own config.
  • Nothing in this pack places an order except trader-broker, and only when all three hold: trader-risk passed that exact order today, the user typed an explicit yes for that one order in the chat, and the user clicked Allow once on Claude's own card because the order tool is set to "Needs approval" (Customize > Connectors > tool permissions). Never set an order tool to "Always allow".
  • No options, margin, short selling or leverage unless the config allows it and the user confirms.
  • Broker keys live in environment variables or the Claude Desktop config, never in the chat.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Price Alerts. Rings when a price target, a stop or the opening bell hits: above / below / stop rules, percent moves from the previous close, and the NYSE opening bell, each ringing once so you are not spammed. Knows NYSE hours with the 2026 and 2027 holidays and 1:00 p.m. early closes, fetches free delayed quotes (Yahoo chart JSON, Stooq CSV) one ticker at a time, and writes trader/prices.json for the other skills. Use when the user says "alert me when", "tell me if AAPL hits", "set a stop", "price target", "watch my stocks", "is the market open", "when does the market open", "get me prices", or to refresh prices before sizing, risk or tax.

日本語の概要は準備中です。原文の説明を表示しています。

Jakeschincariol/trader-skill5172026年10月15日 更新

The Earnings Analyst. Reads a company's reported numbers straight from SEC EDGAR (XBRL company facts from its 10-Qs and 10-Ks, plus the latest earnings 8-K and its press release) and sums up what changed: revenue, gross, operating and net margins, net income and diluted EPS, quarter by quarter, each against the same quarter a year earlier, with the trailing twelve months. Writes a metrics file the screener reads. Use when the user says "how did Apple's earnings look", "analyze the earnings", "what changed this quarter", "is revenue growing", "check the 10-Q", "compare margins", or "run the analyst on my holdings".

日本語の概要は準備中です。原文の説明を表示しています。

Jakeschincariol/trader-skill5172026年10月15日 更新

Order Executor. Places APPROVED orders through your brokerage connector, one at a time, and never without your explicit yes. Shows each order as a plain ticket plus the exact JSON for Alpaca's place_stock_order, records your yes word for word, then Claude's own Allow once / Deny card asks again. Covers setting up Alpaca's official MCP server in Claude Desktop (paper trading by default, keys in env vars, never in chat), the Interactive Brokers connector (orders go to your IBKR account for your approval), and setting order tools to "Needs approval". Use when the user says "place the orders", "buy it", "execute", "send it to my broker", "connect Alpaca", "connect Interactive Brokers", "set up paper trading", or after /trader-risk passes.

日本語の概要は準備中です。原文の説明を表示しています。

Jakeschincariol/trader-skill5172026年10月15日 更新

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.

日本語の概要は準備中です。原文の説明を表示しています。

Jakeschincariol/trader-skill5172026年10月15日 更新

The Reverse Engineer. Reads a famous investor's public SEC filings (the quarterly 13F-HR, plus Form 4 if you want the insider trades) and rebuilds their portfolio as weights you can copy: every position, its share of the fund, what they bought, added, trimmed and sold since the last quarter, with tickers matched to every CUSIP. Then it writes trader/targets.json so the budget skill can size it to your money. Use when the user says "copy Buffett", "copy Berkshire", "what does Ackman own", "reverse engineer this investor", "show me their 13F", "what did they buy last quarter", "copy the top 5", or names any fund or famous investor.

日本語の概要は準備中です。原文の説明を表示しています。

Jakeschincariol/trader-skill5172026年10月15日 更新

The News Monitor. Watches breaking market news and SEC filings for the stocks you hold (or are about to copy): Yahoo Finance headlines per ticker and each company's 8-K filings on SEC EDGAR (earnings, CEO changes, deals, restatements, bankruptcy). Shows only what is new since the last check, newest first, flags what touches your positions and why it matters, and never repeats an item. Use when the user says "any news on my stocks", "what's happening with Apple", "monitor the news", "watch my portfolio", "did anything break", "check the 8-Ks", or "morning briefing".

日本語の概要は準備中です。原文の説明を表示しています。

Jakeschincariol/trader-skill5172026年10月15日 更新

Jakeschincariol のスキルをすべて見る

このスキルの問題を報告する