Beyond Net Worth: Advanced Wealth Tracking in Beancount (Unrealized Gains, Allocation Drift, Tax Harvesting)

Beyond Net Worth: True Wealth Tracking with Beancount (Unrealized Gains, Asset Allocation, Rebalancing)

Hey everyone,

I’ve been using Beancount for about 3 years now, and for the longest time, I obsessed over one number: my net worth. Every month, I’d run my queries, update my spreadsheet, and watch that number (hopefully) tick upward. It felt good—like I was winning the personal finance game.

But about six months ago, I had a wake-up call. My net worth had grown nicely thanks to a strong market run, but when I dug deeper, I realized my portfolio was completely out of whack. My tech stocks had ballooned to nearly 60% of my holdings (way above my 40% target), my bond allocation had drifted down to almost nothing, and I had no idea how much unrealized gain I was sitting on—or what it would cost me in taxes to rebalance.

Net worth alone doesn’t tell the full story. It’s like judging a car’s health by only looking at the odometer. You need to check the engine, the tire pressure, the oil—all the systems working together.

So I started building out what I call my “wealth health dashboard” in Beancount. Here’s what I track beyond just net worth:

1. Unrealized Gains/Losses: The Hidden Tax Liability

This is huge, especially in 2026. I recently read that navigating elevated unrealized gains has become a central portfolio theme this year, with tax implications that can seriously impact your rebalancing decisions.

In Beancount, I track this by maintaining accurate commodity prices and using custom queries to calculate the difference between current market value and cost basis for each holding:

SELECT 
  account,
  cost(sum(position)) as cost_basis,
  value(sum(position)) as market_value,
  value(sum(position)) - cost(sum(position)) as unrealized_gain
WHERE account ~ 'Assets:Investments'
GROUP BY account

This tells me exactly which positions have significant gains (meaning high tax costs to sell) vs losses (potential tax-loss harvesting opportunities). For tax planning, I add metadata to track acquisition dates and specific lot information.

2. Asset Allocation Drift: The Silent Portfolio Killer

Here’s what I learned: a meaningful drift typically occurs when any asset class moves more than 5% away from its target weight. When markets make big moves (like 2024-2025), portfolios can drift significantly in a short period.

I created a target allocation in a separate file:

2020-01-01 * "Target Allocation"
  Assets:Investments:Target:Stocks   40.00%
  Assets:Investments:Target:Bonds    30.00%
  Assets:Investments:Target:RealEstate 20.00%
  Assets:Investments:Target:Cash     10.00%

Then I run monthly queries comparing my actual allocation to these targets. When I see something drift beyond 5%, I know it’s time to review. Sometimes that means rebalancing, but if the position has huge unrealized gains, I might add new contributions to underweight categories instead.

3. Tax-Loss Harvesting Opportunities

This is where Beancount really shines. With proper cost basis tracking and commodity prices updated regularly, I can identify positions sitting at losses that could offset my capital gains.

The key is respecting the wash sale rule—you can’t buy the same or “substantially identical” security within 30 days of selling at a loss. I’ve read that SEC enforcement has gotten serious about this in 2026, with robo-advisors getting fined for wash sale violations.

My approach:

  • Track each purchase as a separate lot with metadata
  • Flag any position showing unrealized losses
  • Check a 30-day window before and after any planned sale
  • Document everything in transaction comments

The big platforms automate this with AI now, but honestly, I like having full control and transparency with Beancount.

4. Quarterly Reviews: The Rhythm That Works

After experimenting with different frequencies, I settled on quarterly reviews for rebalancing decisions. Monthly felt too reactive to market noise, and annual wasn’t responsive enough. Quarterly hits the sweet spot—it’s the standard recommendation for long-term investors.

During each review, I generate:

  1. Current vs target allocation (pie charts in Fava)
  2. Unrealized gain/loss report
  3. Tax-loss harvesting opportunities
  4. Rebalancing recommendations with tax implications

5. The Fava Dashboard Dream

I’m currently building a custom Fava dashboard that displays all these metrics in one view. The goal is to see at a glance:

  • Net worth trend (yes, still important!)
  • Asset allocation drift heatmap
  • Positions with significant unrealized gains/losses
  • Tax-loss harvesting candidates
  • Projected rebalancing costs

It’s a work in progress, but the plain text foundation of Beancount makes it all possible.

The Real Question: How Are You Tracking This?

I’m curious how others in the community approach wealth tracking beyond simple net worth. Do you:

  • Track unrealized gains actively, or only worry about it at tax time?
  • Have automated drift detection, or review manually?
  • Use Beancount for tax-loss harvesting, or rely on your broker?
  • Have custom queries or plugins you’d recommend?

The average high-net-worth investor holds half their portfolio in public equities, with significant complexity in private holdings and alternatives. For those of us managing serious portfolios in Beancount, having this detailed visibility feels essential.

Would love to hear your approaches, especially if you’ve built tools or queries that make this easier!

— Fred

This is fantastic, Fred! You’ve really captured something important here that I wish I’d understood earlier in my Beancount journey.

I’ve been using Beancount for over 4 years now, and I can honestly say my approach has evolved from “just track the numbers” to what you’re describing—real wealth health monitoring. When I first migrated from GnuCash, I was just happy to have my transactions in plain text. Net worth was the goal. But like you, I eventually realized that wasn’t enough.

Start Simple, But Know Where You’re Going

For anyone reading this who’s feeling overwhelmed—don’t be! Fred’s talking about advanced territory here, but that doesn’t mean you need to implement everything on day one. I certainly didn’t.

My progression looked like this:

  1. Year 1: Just get transactions in, balance assertions working, basic net worth tracking
  2. Year 2: Add investment tracking with commodity prices, start seeing unrealized gains
  3. Year 3: Build asset allocation queries, realize my portfolio had drifted badly
  4. Year 4: Tax-loss harvesting awareness, cost basis tracking, quarterly review rhythm

The beauty of Beancount is you can layer in complexity as you need it. Start with the foundation, then build up.

Unrealized Gains: The Eye-Opener

I’ll never forget the moment I first ran a proper unrealized gains report. I thought I was doing great with a growing net worth, but I had nearly $80K in unrealized gains concentrated in a handful of tech stocks. When I realized what it would cost me to rebalance (around $20K in federal and state taxes), my whole strategy changed.

Now I track this monthly and plan my rebalancing around tax lots. Like you mentioned, I buy new positions in underweight categories rather than selling winners when possible. It’s not perfect rebalancing, but it’s tax-efficient rebalancing.

For tracking commodity prices, I use a simple Python script that fetches closing prices from Yahoo Finance and updates my prices.bean file. Combined with specific lot tracking (using the {...} cost syntax), Beancount gives me better visibility than my actual brokerage!

Drift Detection with Fava

I love your 5% drift threshold—that’s exactly what I use too. In Fava, I’ve set up custom queries that show my current allocation vs targets side-by-side. The visual comparison makes it obvious when something’s out of whack.

One thing I’d add: consider setting different thresholds for different asset classes. For me, if my cash position drifts 5%, that’s not alarming. But if my real estate allocation (which includes my rental properties) drifts 5%, that’s a much bigger deal because those positions are illiquid and harder to adjust.

The Quarterly Rhythm

Totally agree on quarterly reviews. I tried monthly at first and found myself reacting to noise. Markets can be volatile month-to-month, but quarterly gives you enough data to see real trends without overreacting.

My quarterly review takes about 2 hours now:

  • Run all my reports (allocation, gains/losses, drift analysis)
  • Review in context of market conditions and personal situation
  • Make rebalancing decisions (usually just directing new contributions)
  • Document everything in a journal entry

Having 4+ years of these quarterly snapshots in my Beancount history is incredibly valuable. I can look back and see how my strategy evolved, what decisions I made, and how they played out.

Question for You

How often are you updating commodity prices? Daily? Weekly? I’m doing weekly right now, which feels like enough for quarterly rebalancing decisions, but I’m curious if more frequent updates have changed your behavior at all.

And have you thought about tracking forward-looking metrics, like projected annual returns or dividend income? I’ve been playing with adding those to my dashboard but haven’t quite figured out a clean way to do it in Beancount.

Great post—this is exactly the kind of discussion that makes this community valuable!

— Mike

Fred and Mike, this is an excellent discussion and one I have with my clients constantly. As a CPA who works with serious investors, I can tell you that what you’re describing isn’t just “nice to have”—it’s becoming essential for sound financial management in 2026.

Unrealized Gains: The Central Theme of 2026

Mike, your $80K surprise is exactly what I’m seeing with clients this year. After the strong market performance of 2024-2025, nearly everyone I work with is sitting on elevated unrealized gains. This has become a central portfolio theme going into 2026—not just the gains themselves, but the associated tax liabilities that constrain your rebalancing decisions.

Here’s what many people don’t realize: when you rebalance by selling appreciated assets, you’re triggering capital gains tax. At the federal level, that’s 0%, 15%, or 20% depending on your income, plus potential 3.8% net investment income tax, plus state taxes in many jurisdictions. For high earners in states like California, you could be looking at a combined rate near 33%.

That means if you have $100K in gains to rebalance, you might owe $33K in taxes. Your “rebalancing” just cost you a third of the position’s appreciation. This is why tracking unrealized gains isn’t optional—it’s fundamental to making informed investment decisions.

Tax Lot Tracking: The Foundation

Fred, I’d love to see more detail on your metadata structure for tax lot tracking. Here’s what I recommend to clients using Beancount:

2024-03-15 * "Buy VTSAX"
  Assets:Investments:Brokerage:VTSAX  10 VTSAX {100.00 USD, "lot-2024-03-15", "acquired: 2024-03-15"} @ 100.00 USD
  Assets:Investments:Brokerage:Cash  -1000.00 USD

The key pieces:

  1. Cost basis in the {...} notation
  2. Lot identifier to distinguish multiple purchases
  3. Acquisition date in metadata for wash sale tracking
  4. Clean transaction descriptions for audit trails

When you sell, you can specify exactly which lot you’re selling, giving you precise control over tax consequences. This is especially important for tax-loss harvesting.

Wash Sale Compliance: Take It Seriously

You mentioned SEC enforcement, Fred, and that’s spot-on. In 2026, the SEC has been aggressive about wash sale violations. I saw a case where a robo-advisor was fined because 31% of client accounts had wash sales over a multi-year period, despite marketing claims that their algorithm prevented this.

The wash sale rule is simple but strict: if you sell a security at a loss, you cannot buy the same or “substantially identical” security within 30 days before or after the sale. If you do, the loss is disallowed for tax purposes.

With Beancount, you have full transparency. But you need to be disciplined:

  • Track the 30-day window (before AND after!)
  • Understand “substantially identical” (buying VTSAX and selling VTI likely counts)
  • Document your rationale in transaction comments
  • Keep records forever (the IRS can go back 3-7+ years)

This is where Beancount’s plain text format shines—every decision is documented, timestamped, and auditable.

Asset Allocation: Different Thresholds for Different Investors

Mike’s point about different drift thresholds for different asset classes is excellent. I’d add that your rebalancing tolerance should also depend on your tax situation and life stage.

For clients in high tax brackets with large unrealized gains, I might recommend:

  • Wider tolerance bands (7-10% drift instead of 5%)
  • Tax-loss harvesting to offset any necessary rebalancing sales
  • Using new contributions to rebalance rather than selling
  • Considering charitable donations of appreciated securities (avoid the tax entirely!)

For younger clients in lower brackets or those in tax-advantaged accounts (401k, IRA), rebalancing is much cheaper, so tighter bands make sense.

The Real Risk: Avoiding Rebalancing Because of Taxes

Here’s what worries me: some investors become so tax-averse that they refuse to rebalance at all, letting their portfolios drift into dangerous territory. Yes, taxes are a real cost, but so is portfolio risk.

If your equity allocation has drifted from 60% to 80% because of market gains, you’re taking significantly more risk than you planned. If we hit a market correction, that extra exposure could cost you far more than the taxes you saved by not rebalancing.

The key is thoughtful, tax-aware rebalancing—not tax avoidance at the expense of your financial plan.

Questions for Fred

  1. How are you handling cost basis tracking across multiple brokerages? Do you have a system to reconcile Beancount records against your 1099-B forms?

  2. Have you built any queries to identify tax-loss harvesting opportunities while checking for wash sale conflicts automatically? That would be incredibly valuable.

  3. For projected tax liability, do you run forward-looking estimates of what you’d owe if you executed a full rebalancing? I’m working on a template for this with clients.

Excellent work on this topic. More people need to think beyond simple net worth to true portfolio health and tax efficiency.

— Alice Thompson, CPA

Mike and Alice, thank you both for the incredibly thoughtful responses! This is exactly the kind of discussion I was hoping for.

Responding to Mike: Price Updates and Forward-Looking Metrics

On commodity price frequency: I’m actually updating daily right now using a cron job that runs after market close. I know that might seem excessive for quarterly rebalancing, but I’ve found two benefits:

  1. Real-time portfolio visibility: When I log into Fava any day of the week, I see accurate current values. This satisfies my data obsession without requiring manual work.

  2. Tax-loss harvesting timing: With daily prices, I can spot TLH opportunities the moment they appear, not just when I remember to update prices. In volatile markets, this can make a real difference.

That said, I totally agree that weekly updates would be sufficient for most people’s needs, especially if you’re only reviewing quarterly. Daily is probably overkill unless you’re actively managing tax-loss harvesting.

On forward-looking metrics: Yes! I’ve been experimenting with this. For dividend income, I add metadata to each holding:

2024-01-10 * "Buy VYM (High Dividend ETF)"
  Assets:Investments:Brokerage:VYM  50 VYM {95.00 USD, "dividend_yield: 3.2%"} @ 95.00 USD
  Assets:Investments:Brokerage:Cash  -4750.00 USD

Then I can query total projected annual dividend income by multiplying position values by their yields. It’s not perfectly accurate (yields change), but it gives me a ballpark number.

For projected returns, I’m still figuring it out. I’ve considered adding expected return assumptions to asset class metadata, but that feels like I’m crossing into speculation territory. Would love to hear if anyone has a clean approach for this.

Responding to Alice: Tax Lot Tracking and Cost Basis Reconciliation

Alice, your metadata structure is exactly what I’m using! The lot-YYYY-MM-DD identifier plus acquisition date metadata has been a game-changer. Here’s how I’m handling your three questions:

1. Multi-Brokerage Cost Basis Reconciliation

I track investments across three brokerages (Vanguard, Fidelity, and Interactive Brokers). My process:

Monthly: Import transactions from each brokerage using custom importers. I’ve built Python scripts that parse their CSV/OFX formats and generate Beancount transactions with proper lot tracking.

Tax Season: When I receive 1099-B forms, I run a reconciliation query:

SELECT 
  account,
  year,
  sum(position) as shares_sold,
  cost(sum(position)) as total_cost_basis,
  convert(sum(position), 'USD') as total_proceeds,
  convert(sum(position), 'USD') - cost(sum(position)) as realized_gain_loss
WHERE account ~ 'Assets:Investments' 
  AND year = 2025
GROUP BY account, year

I compare this output to the 1099-B summaries. So far, they’ve matched perfectly (knock on wood), which gives me confidence that my importers are working correctly.

The key is being obsessive about lot tracking from day one. If you don’t specify lots when selling, Beancount (and brokerages) default to FIFO, which might not be tax-optimal.

2. Automated Tax-Loss Harvesting with Wash Sale Checking

This is my current project! I’m building a Python script that:

  1. Queries all positions with unrealized losses > $500 (arbitrary threshold)
  2. For each candidate, checks transaction history for purchases/sales of the same security in the past 30 days
  3. Checks if I hold any “substantially identical” securities (I maintain a manual mapping file for this)
  4. Outputs a report of “safe to harvest” opportunities

The “substantially identical” part is tricky and somewhat subjective. For example:

  • VTSAX and VTI are definitely too similar
  • VTSAX and VFIAX (Total Market vs S&P 500) are probably too similar
  • VTSAX and VXUS (Total US vs Total International) should be fine

I’m erring on the side of caution and flagging anything questionable for manual review. Alice, I’d love your CPA perspective on where to draw those lines!

3. Forward-Looking Tax Liability Estimates

Great question. I run a “what-if rebalancing scenario” analysis quarterly. Here’s my approach:

Step 1: Identify which positions I’d need to sell to rebalance (based on drift analysis)

Step 2: Calculate unrealized gains on those specific positions

Step 3: Apply my marginal tax rates:

  • Federal long-term capital gains: 15% (my bracket)
  • State (WA): 0% (no state income tax, lucky me!)
  • NIIT: 0% (below threshold)
  • Total: 15%

Step 4: Calculate net proceeds after tax

Step 5: Compare scenarios:

  • Scenario A: Sell winners and rebalance fully (higher tax, better allocation)
  • Scenario B: Direct new contributions only (lower tax, slower rebalancing)
  • Scenario C: Partial rebalancing (compromise)

Usually, I end up with Scenario B or C unless drift is extreme. The tax drag of Scenario A is often too high to justify.

The Bigger Picture: Portfolio Health Dashboard

Both of you are validating what I’ve been feeling—this isn’t just hobbyist tinkering, this is proper wealth management. The fact that Beancount gives us this level of transparency and control is remarkable.

My ultimate goal is a Fava extension that displays a “Portfolio Health Score” based on:

  • :white_check_mark: Allocation drift within tolerance
  • :white_check_mark: Unrealized gains under control (or harvesting plan in place)
  • :white_check_mark: Cost basis records match broker statements
  • :white_check_mark: No wash sale violations
  • :white_check_mark: Tax-efficient rebalancing strategy active

Green = healthy portfolio. Yellow = attention needed. Red = urgent rebalancing or tax planning required.

Final Thought: Tax-Aware ≠ Tax-Obsessed

Alice, I really appreciate your point about not becoming so tax-averse that we avoid necessary rebalancing. That’s a real risk. I’ve seen people (including past me) hold concentrated positions way too long because they didn’t want to “pay the tax man.”

Taxes are a cost, but they’re the cost of success—you have gains! The goal isn’t to avoid taxes entirely, it’s to manage them intelligently while staying aligned with your financial plan.

Thanks again for the engagement. I’ll keep building and will share my tax-loss harvesting script once it’s solid!

— Fred