Portfolio rebalancing
Portfolio rebalancing is a rule or procedure for adjusting portfolio holdings toward target asset weights or allocations.
Build a Robo-Advisor with Python (From Scratch)
A rule or procedure for deciding when and how portfolio holdings should be traded toward target allocations.
- How it is used
- Automates decisions that keep portfolio exposures near target allocations while accounting for taxes, trading costs, and cash flows.
- How deep it goes
- Develops drift examples, schedule and threshold rules, tax-aware practices, optimization, and backtesting with cvxpy.
- Examples
- Uses a 60/40 stocks-and-bonds portfolio, simulated 30-year weight drift, volatility calculations, and historical backtesting.
- What you can do after
- Build it from scratch by implementing threshold or schedule rules, tax-aware trades, optimization constraints, and a rebalancing backtester.
Read how Build a Robo-Advisor with Python (From Scratch) explains portfolio rebalancing →
Investing for Programmers
Portfolio rebalancing is the process of restoring an investment portfolio to its intended asset weights after market movements change them.
- How it is used
- Maintains intended asset allocation while controlling drift, concentration risk, transaction costs, and possible tax consequences.
- 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 you can do after
- Apply it via Python and pandas to calculate allocation drift, identify threshold breaches, and produce buy-or-sell adjustments.
Read how Investing for Programmers explains portfolio rebalancing →
Related concepts
- periodic rebalancingincludes · Periodic rebalancing is a portfolio-management technique that restores target asset allocations at predefined time intervals.
- threshold-based rebalancingincludes · Threshold-based rebalancing is a portfolio management technique that trades when an asset’s allocation deviates beyond a specified tolerance from its target.
- asset allocationuses · Asset allocation is the distribution of an investment portfolio’s capital among asset classes according to objectives, risk tolerance, and investment constraints.
- backtestingused by · Backtesting is the retrospective evaluation of a strategy, model, or process by applying it to historical data or cases to assess its performance or effects.
- driftaddresses · Drift is a change over time in a system’s behavior, state, data, or configuration relative to a reference or expected baseline.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

