liveBook · Manning

Tax heuristic

As explained in Build a Robo-Advisor with Python (From Scratch)

A tax heuristic is a rule of thumb for selecting investment transactions or holdings to improve their tax consequences.

A tax heuristic is a practical rule for choosing trades or tax lots when rebalancing. Instead of always returning exactly to target weights, it can leave small deviations when selling appreciated assets would create a large tax bill. section 13.2.3

Useful tax-lot rules include:

  • Prefer realizing long-term gains over equal-sized short-term gains because the applicable tax rate is lower. section 13.2.3
  • Among short-term gains, prefer selling a newer lot when an older lot is close to becoming long-term. section 13.2.3
  • For losses, prefer realizing a lot that is about to become long-term, because the higher short-term rate increases the tax benefit. section 13.2.3

A simple lot-selection rule

Suppose 35 shares must be sold from four lots. Calculate each lot’s effective rate as percentage gain multiplied by its applicable tax rate, sort lots from lowest to highest, and sell from that order until the required quantity is reached.

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Explains holding-period rules and implements effective-rate sorting, without developing a broader optimization model.
Examples
Uses threshold rebalancing, differently aged ETF lots, effective-rate calculations, and a 35-share sale.
What it assumes
Assumes portfolio targets, tax lots, purchase dates, quantities, prices, and separate short- and long-term rates.
What you can do after
Apply it via Python by calculating lot exposure, ordering lots, and incrementally allocating required sales.
How it connects
Connects portfolio rebalancing with tax lots, short-term gains, long-term gains, and loss realization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.