Threshold-based: Rebalance when allocation drifts beyond a set percentage
My Current Setup
I target a 70/30 stocks/bonds allocation. I’ve been using a 5% absolute threshold—if stocks drift to 75% or bonds drift to 35%, I rebalance.
Tracking Drift in Beancount
Here’s my query to check current allocation vs target:
SELECT
root(account, 3) AS asset_class,
sum(value(position)) AS current_value
WHERE account ~ 'Assets:Investments'
GROUP BY asset_class
Then I manually calculate the percentages and compare to targets.
The Research
Most studies suggest threshold-based with 5% bands captures most of the benefit while minimizing transaction costs. But calendar-based is simpler to implement and behaviorally easier to maintain.
My Questions
What threshold do you use? 5%? 10%? Relative or absolute?
How often do you check allocation (even if not rebalancing)?
Does anyone have a Beancount query that calculates drift automatically?
Would love to build an automated alert system that tells me when rebalancing is needed.
I use a hybrid approach: check monthly, but only rebalance if drift exceeds 5%.
Why Hybrid Works
Calendar-only: You might rebalance when drift is only 1-2%, wasting transaction costs
Threshold-only: You might go years without checking, missing opportunities
Hybrid: Regular monitoring catches drift early, but you only act when meaningful
My Python Script for Drift Alerts
I run this monthly:
import subprocess
import json
# Run bean-query to get allocation
result = subprocess.run(
['bean-query', 'main.beancount', '-f', 'json',
'SELECT root(account, 4) as class, sum(value(position)) as value '
'WHERE account ~ "Assets:Investments"'],
capture_output=True, text=True
)
# Parse and calculate percentages
data = json.loads(result.stdout)
total = sum(row['value'] for row in data)
for row in data:
pct = row['value'] / total * 100
# Alert if drift > 5%
if abs(pct - target[row['class']]) > 5:
print(f"ALERT: {row['class']} at {pct:.1f}%, target is {target[row['class']]}%")
Transaction Cost Consideration
Remember: every rebalance in a taxable account creates a taxable event. I only rebalance taxable accounts when:
I’m also harvesting losses, OR
Drift exceeds 10%
For tax-advantaged accounts, 5% threshold is fine.