Picture an investor who opens the account at the end of every month and wonders, "Should I sell some stocks and buy bonds this month?"
In this part, we apply the rules from Part 2 to
actual price data
.
A backtest calculates "how would this rule have performed if it had been used in the past." Good results do not guarantee the future, so state the assumptions behind the calculation first.
The conditions used in the calculation are as follows.
Item
Setting
Stock asset
SPDR S&P 500 ETF (SPY)
Bond asset
iShares Core U.S. Aggregate Bond ETF (AGG)
Period
September 29, 2003 to November 23, 2026, 5,826 trading days
Prices
Dividend-reinvested adjusted close (adjclose)
Starting capital and weights
100 million won, 60% stocks and 40% bonds
Trading cost
Assumed at 0.1% of the traded amount (actual fees may differ)
Taxes
Excluded from the calculation
Exchange rate
Excluded from the calculation (dollar-based returns)
Prices were downloaded from Yahoo Finance SPY daily data↗ and Yahoo Finance AGG daily data↗ and saved as SPY.csv and AGG.csv.
Each file has date, close, and adjclose columns, and the calculation uses only adjclose.
The script reads SPY.csv and AGG.csv from the current folder, so put both files in the same folder as the script and run it there.
The code below simulates the portfolio for each rule.
It takes a list of check dates, checks on each of those days whether the weight has moved outside the allowed range, and if necessary returns it to the target weight.
rebalance_backtest_us.py
import csvfrom datetime import datedef load_prices(path): # 수정주가(adjclose)를 쓰면 분배금이 재투자된 가격으로 계산됩니다. with open(path, encoding="utf-8") as f: return {row["date"]: float(row["adjclose"]) for row in csv.DictReader(f)}EQUITY = load_prices("SPY.csv") # SPDR S&P 500 ETF (SPY, 주식)BOND = load_prices("AGG.csv") # iShares Core U.S. Aggregate Bond ETF (AGG, 채권)DATES = sorted(set(EQUITY) & set(BOND))def first_days(key): seen, picked = set(), set() for d in DATES: k = key(d) if k not in seen: seen.add(k) picked.add(d) return pickeddef last_days(key): last = {} for d in DATES: last[key(d)] = d return set(last.values())def simulate(check_days, band_pp=None, target=0.6, cost=0.001, principal=100_000_000): eq = principal * target / EQUITY[DATES[0]] bd = principal * (1 - target) / BOND[DATES[0]] peak, mdd, trades, fee = principal, 0.0, 0, 0.0 for d in DATES: total = eq * EQUITY[d] + bd * BOND[d] if d in check_days: w = eq * EQUITY[d] / total outside = abs(w - target) * 100 > band_pp if band_pp is not None else True gap = abs(eq * EQUITY[d] - target * total) if outside and gap > 0.0005 * total: trades += 1 fee += gap * cost total -= gap * cost # 거래비용은 거래금액에 비례해 차감 eq = target * total / EQUITY[d] bd = (1 - target) * total / BOND[d] total = eq * EQUITY[d] + bd * BOND[d] peak = max(peak, total) mdd = min(mdd, total / peak - 1) final = eq * EQUITY[DATES[-1]] + bd * BOND[DATES[-1]] years = (date.fromisoformat(DATES[-1]) - date.fromisoformat(DATES[0])).days / 365.25 return {"final": round(final), "cagr": round(((final / principal) ** (1 / years) - 1) * 100, 2), "mdd": round(mdd * 100, 1), "trades": trades, "fee": round(fee)}if __name__ == "__main__": month_ends = last_days(lambda d: d[:7]) rules = { "보유만": simulate(set()), "연 1회": simulate(first_days(lambda d: d[:4])), "분기 1회": simulate(first_days(lambda d: d[:4] + "Q" + str((int(d[5:7]) - 1) // 3))), "밴드 ±5%p": simulate(month_ends, band_pp=5), "밴드 ±10%p": simulate(month_ends, band_pp=10), } for name, r in rules.items(): print(name, r)
Two lines in the code matter most.
check_days decides
when to check
, and band_pp sets
the threshold for deciding that the weight has drifted outside the range
.
Calendar rules leave out band_pp, so they rebalance on each check day whenever the weight is off target.
However, if the amount to be rebalanced is 0.05% or less of total assets, no trade is made.
Band rules pass band_pp, check at each month-end, and rebalance only when the allowed width is breached.
The results for each rule are summarized in one table.
Rule
Rebalances
Final amount (won)
CAGR
Maximum drawdown (MDD)
Total assumed trading cost (won)
Hold only
0
732,465,483
8.98%
-35.5%
0
Once a year
23
595,851,513
8.01%
-34.0%
192,491
Once a quarter
93
598,535,083
8.04%
-35.0%
372,801
Band ±5pp
14
605,798,441
8.09%
-35.0%
221,136
Band ±10pp
5
626,748,639
8.25%
-36.0%
141,107
Bar chart comparing the CAGR and maximum drawdown of five rebalancing rules applied to the 60/40 portfolio
The table and chart show three things.
Returns
Not rebalancing produced the highest return. The other four rules had CAGRs between 8.01% and 8.25%, all below the 8.98% of holding only.
Drawdown
Maximum drawdown by rule ranged from -34.0% to -36.0%. Rebalancing controls the weights, but
the maximum drawdown for this period did not fall noticeably
. Holding only was -35.5%, and the gap with the other rules was within 1.5 percentage points. Differences by downturn period are covered separately in Part 5.
Number of trades
Quarterly rebalancing had 93 trades and the ±10pp band had 5, a large gap. More trades did not improve the results.
The lower returns were not caused by trading costs.
Even under the most frequent rule (quarterly), total trading costs came to about 372,000 won, roughly 0.06% of the final amount.
The main cause of the return gap is
the trades themselves: selling stocks that had risen and buying bonds that had risen less
.
From September 29, 2003 to November 23, 2026, on an adjusted-price basis SPY rose about 10.9 times and AGG about 2.0 times.
Stocks rose
much more
than bonds in this period, so the cumulative effect of trimming stocks pulled the return down.
👍
It is hard to read this result as a general conclusion that "rebalancing lowers returns."
The strength of stocks in this period is the background to this result.
In a period when stocks were weak, the same rule could have worked in the opposite direction.
The drawdown needs to be read differently.
Holding only produced a maximum drawdown of
-35.5%
, from the October 2007 peak to the March 2009 trough.
Rebalancing once a year was slightly smaller at -34.0%, but a gap of about 1.5 percentage points is hard to call an effect on its own.
The ±10pp band recorded the worst figure, -36.0%.
Checking only at month-end means declines within a month go unaddressed until the next check. That structure may be part of the cause, but this period alone does not allow a firm conclusion.
Only the same calculation over other periods and other assets can give an answer.
This result should be read together with the following limits.
One asset pair, one period
Only one pair of US stocks and US bonds was used. Large declines occurred only a few times, such as in 2008, 2020, and 2022. The sample is too small for strong statistical conclusions.
Trading costs and taxes
Trading costs were assumed at 0.1%, and taxes and exchange rates are left out. For overseas assets measured in won, exchange rates change the results.
Cash-flow rule not included
The cash-flow rule defined in Part 2 is not in this calculation. This series does not backtest it either.
Effect of the choice of check frequency
Changing the frequency or band width changes the results. This table shows only some of the many possible settings.
👍
If you find the best-performing setting in a backtest and apply it in practice, you may end up with a rule that fits only one past period. When choosing a setting, first ask, "Can I actually stick to this rule?"
In the backtest for this period, rebalancing did not raise returns.
Weights were held near target, but the maximum drawdown for this period did not fall noticeably.
By downturn period, the drawdown difference was large in a sharp drop such as 2020, while in 2008 the ±10pp band (-36.0%) was deeper than holding only (-35.5%). Part 5 covers these period differences.
So the claim that "rebalancing is always better" does not hold with this data.
Running the backtest yourself makes clear
on what basis returns and risk should be evaluated
.
In the next part, we will look at how to split rebalancing when you have several accounts.