Portfolio Rebalance Calculator Formula

Understand the math behind the portfolio rebalance calculator. Each variable explained with a worked example.

Formulas Used

Stocks: Buy/Sell

stocks_trade = total_value * (target_stocks - stocks_pct) / 100

Bonds: Buy/Sell

bonds_trade = total_value * (target_bonds - bonds_pct) / 100

Cash: Add/Remove

cash_trade = total_value * (target_cash - cash_pct) / 100

Total Rebalance Volume

total_trades = abs(total_value * (target_stocks - stocks_pct) / 100) + abs(total_value * (target_bonds - bonds_pct) / 100) + abs(total_value * (target_cash - cash_pct) / 100)

Variables

VariableDescriptionDefault
total_valueTotal Portfolio Value(USD)100000
stocks_pctCurrent Stock Allocation(%)70
bonds_pctCurrent Bond Allocation(%)25
cash_pctCurrent Cash Allocation(%)5
target_stocksTarget Stock Allocation(%)60
target_bondsTarget Bond Allocation(%)30
target_cashTarget Cash Allocation(%)10

How It Works

Portfolio Rebalancing

Rebalancing restores your portfolio to its target allocation after market movements cause drift.

Why Rebalance?

  • Maintains your intended risk level
  • Forces you to sell high and buy low
  • Prevents overconcentration in one asset class
  • How to Rebalance

    Trade Amount = Portfolio Value x (Target% - Current%) / 100

    Positive values mean buy; negative values mean sell.

    When to Rebalance

  • Calendar-based: quarterly, semi-annually, or annually
  • Threshold-based: when any allocation drifts 5%+ from target
  • Worked Example

    $100,000 portfolio: 70% stocks, 25% bonds, 5% cash. Target: 60/30/10.

    total_value = 100000stocks_pct = 70bonds_pct = 25cash_pct = 5target_stocks = 60target_bonds = 30target_cash = 10
    1. 01Stocks: sell $100,000 x (60% - 70%) = -$10,000
    2. 02Bonds: buy $100,000 x (30% - 25%) = +$5,000
    3. 03Cash: add $100,000 x (10% - 5%) = +$5,000
    4. 04Total volume = $10,000 + $5,000 + $5,000 = $20,000

    Ready to run the numbers?

    Open Portfolio Rebalance Calculator