Dev
Rebalancing tracker for a three-fund ETF portfolio (from broker CSV exports)
The brief
We hold a simple long-term portfolio of three ETFs (a US stock index fund, an intermediate Treasury fund and a gold fund) with fixed target weights. We want a small tool that tells us when the portfolio has drifted far enough to rebalance, without logging into anything. Deliver a Python command-line tool (in a GitHub repo we create for you) that: 1. Reads positions from the broker's CSV export (we share a sample with fake numbers after hiring) and current prices from a free public source, with a manual override. 2. Shows each holding's current weight against its target, and the drift. 3. Flags when any holding is outside a rebalance band we set (for example 5 percentage points), and lists the trades that would bring the portfolio back to target, rounded to whole shares, with an option to rebalance using new cash only. 4. Writes a dated one-page report (markdown or HTML). 5. Has tests for the drift and trade calculations with hand-checked examples. Rules: the tool calculates and reports; it never connects to a brokerage or places trades. No recommendations about what to hold, and no broker credentials anywhere.
Acceptance criteria
1) Correct weights, drift and band flags on the hand-checked examples. 2) Suggested trades bring the sample portfolio back within the band, in whole shares. 3) A new-cash-only option. 4) A dated one-page report. 5) No brokerage connection or credentials anywhere; tests pass.