liveBook · Manning

Portfolio rebalancing

As explained in Investing for Programmers

Portfolio rebalancing is the process of restoring an investment portfolio to its intended asset weights after market movements change them.

Portfolio rebalancing restores intended asset weights after market movements cause allocation drift. It limits concentration risk and keeps decisions aligned with the original strategy. section 7.6.3

Choose a trigger and account for implementation costs:

  • Periodic rebalancing acts at predefined intervals, such as quarterly. section 7.6.3
  • Threshold-based rebalancing acts only when an asset deviates beyond a limit, such as ±5%. section 7.6.3
  • A hybrid approach combines scheduled reviews with deviation thresholds, while limiting unnecessary transaction costs and possible tax consequences. section 7.6.3

A Python rebalancing workflow

Represent target weights and current dollar values as dictionaries. Compute total value and current allocations, subtract target weights to find deviations, filter deviations beyond the threshold, and calculate target value minus current value. A positive adjustment means Buy; a negative adjustment means Sell. A pandas DataFrame can then show current value, target value, adjustment, and action. The supplied example produces large sales of AAPL, WMT, GOOGL, and BRK-B and purchases of PFE and NVDA, illustrating why allocation rules should be checked for unintended de-diversification. section 7.6.3

target_allocation = {
"AAPL":        0.016804,
"WMT":        0.007427,
"GOOGL":        0.015956,
"KO":        0.142700,
"PFE":        0.193730,
"BRK-B":        0.009315,
"NVDA":        0.614068
}

Inspect the target allocation used by the calculation, including the unusually large NVDA weight that drives the example’s concentration risk. section 7.6.3

How Investing for Programmers covers it

How deep it goes
Defines three trigger strategies and demonstrates threshold calculations, adjustments, and actions, but does not develop tax or execution automation.
Examples
Uses Python dictionaries, a 5% threshold, ticker allocations, adjustment calculations, a pandas DataFrame, and a rebalancing-actions table.
What it assumes
Assumes basic portfolio weights and dollar values, while teaching the rebalancing calculation and trigger choices from those inputs.
What you can do after
Apply it via Python and pandas to calculate allocation drift, identify threshold breaches, and produce buy-or-sell adjustments.
How it connects
Connects asset allocation, concentration risk, transaction costs, tax consequences, and Markowitz efficient portfolios.

Also explained in

Compare how 2 books explain portfolio rebalancing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Investing for Programmers. The section links point to the parts of the book it draws on.