The Capital Gain That Quietly Costs You 22 Extra Points
You bought some shares in November. You sold them in June at a tidy gain. Nice. You pencil in the friendly long-term capital-gains rate — call it 15% — and move on with your life.
Here's the catch: you held that position for about seven months. A year or less, and that gain isn't long-term at all. It's short-term, which means it's taxed at your ordinary income rate — which for a higher earner runs up to 37%.
Same gain. Same stock. The only thing that changed is which side of the one-year line your hold-period fell on. And that line can be the difference between roughly 15% and 37% — about 22 extra points of federal tax on the exact same dollar of profit.
Your ledger knows the dates. It just doesn't know what they mean.
The ledger has the facts. It doesn't have the rules.
If you keep your books in beancount — the plain-text, double-entry tool a lot of us quietly love — you already have something most spreadsheet investors don't: real lot tracking. Every buy is a dated lot with a cost basis. Every sell can be matched back to the lot it came from. It's honest, it's diffable, it lives in a text file, and it does this job beautifully.
But beancount is an accounting tool, not a tax engine — and it isn't trying to be one. It records what happened: you acquired 100 shares on this date at this price, you disposed of them on that date at that price. That's exactly the data you need. What it doesn't do — and shouldn't have to — is decide whether the resulting gain is short-term or long-term, where the one-year cutoff actually falls, or whether the 3.8% Net Investment Income Tax (NIIT) lands on top.
That's a tax-treatment question, not a bookkeeping one. And tax treatment is precisely the part that goes stale, varies by year, and gets a real person a real letter from the IRS when it's wrong.
So we wired the two halves together
We built a small open-source demo that does exactly one thing: it reads your .beancount ledger and tells you what each disposal means for your taxes.
It parses the file, pairs your buys and sells FIFO (first lot in, first lot out), and for each realized gain it works out the hold period and classifies it — short-term or long-term — then applies the correct treatment, including the NIIT where it bites.
Crucially, beancount supplies the lots and cost basis. OpenAccountants supplies the tax rules — the >1-year short-vs-long cutoff, the brackets, the NIIT threshold — and every one of those rules is verified and signed off by a named, licensed accountant. For the US ruleset, that's our US lead, Amir Pelinkovic. Not "the model thinks." A human professional who stands behind the number.
The output looks roughly like this:
GOOG 100 sh bought 2025-11-03 sold 2026-06-12
hold: 221 days → SHORT-TERM (ordinary income)
gain: $4,200 • est. fed tax @ 37%: $1,554
⚠ held 144 more days → long-term: ~$630
That little warning line is the whole point. The ledger couldn't tell you that waiting another few months would roughly halve the tax. The rules can.
No keys, no signup — just point it at your file
This is a reference integration, so we kept it deliberately boring to run. No API keys. No account. Clone it, point it at a ledger, read the output. The demo ships with a sample .beancount file so you can see a short-term gain and a long-term gain side by side before you ever touch your own books.
It's not tax advice and it won't file anything for you — it's a worked example of one clean idea: let the tool that's great at lots do the lots, and let an accountant-verified rules layer do the tax. Two jobs, two specialists, one honest answer.
The thing I want you to take away isn't "beancount is missing something." It isn't. It's that there's a seam between recording money and taxing it, and that seam is exactly where a quiet 22-point mistake hides. Beancount nails its side. We're trying to nail ours, with a named human signature on every rule.
Have a look — openaccountants/beancount-tax-demo — run it against your own ledger and see what your gains actually are. And when you want the same verified tax rules inside your own agent or app, you can connect the OpenAccountants MCP at openaccountants.com. Your dates are already in the file. Let's make them mean the right thing.