Year-End Loss Harvest Maximizer
Late-year harvesting. Maximizes realized losses through year-end while capping gains to zero.
Net loss available against external gains
Looks at what's down in the portfolio and tells you the most loss you can bank by Dec 31 without a wash-sale violation.
Maximize Σ realized_loss_i for i in lots, subject to: Σ realized_gain_i = 0, no buys in the 30-day pre/post window of any sold-loss ticker (US wash-sale rule), and a tracking-error drift cap after harvest.
The tool solves this on demand against a portfolio snapshot — typically in a single CVXPY call, or a short loop for multi-period tools. Unlike a strategy, there is no daily-rebalance schedule; you re-run when the inputs change.
- Portfolio snapshot dated in November or December
- Recent trade history (for wash-sale lookback)
- Optional: tracking-error drift cap
- Lot-level sell list with realised loss per lot
- Locked-ticker list with lock-expiry date
- Net realised loss available against external gains
$2M tax-aware DI account; snapshot December 5; 18 lots show embedded losses; 6 lots are wash-sale locked from a November trade.
- Eligible loss-bearing lots
- 12 of 18
- Total realisable loss
- $71,400
- TE drift after harvest
- + 14 bp
- Locked names, expires Jan 4
- 12
- Net loss available against external gains
- $71,400
Six lots are unreachable because of the November lock, but the remaining twelve produce a clean $71k of harvestable loss with only 14 bp of TE drift. Numbers are illustrative.
Tracking-error drift cap
The maximum additional tracking error the post-harvest portfolio is allowed to take on. Sets how aggressively the optimizer can rotate out of loss-bearing names before the substitutes start to drift.
After the harvest sells, the optimizer buys correlated substitutes inside the residual budget. The drift cap binds when loss-bearing names cluster in a single sector or factor and the substitutes don't perfectly replace them.
A tight cap (5 bps) preserves the portfolio's index hug but leaves harvestable losses on the table when substitutes are imperfect. A loose cap (100 bps) banks more loss now at the cost of a noisier portfolio for the next 30 days.
A phased realization schedule for moving a portfolio toward a benchmark under a tax budget.
The list of appreciated lots whose donation maximizes capital-gains tax avoided.
Educational calculator. Output is illustrative and is not investment or tax advice.