Welcome to the Plain Text Ledger! I’m Yichu Zhou, a machine learning scientist exploring ways to manage personal finances more efficiently. On this site, I’ll share my journey and insights into plain text accounting using Beancount—an easy-to-understand, tech-friendly method of tracking finances using simple text files and version control. Plain text accounting is an alternative to traditional software, offering transparency and flexibility. Join me as I dive into this innovative approach and share what I learn along the way.
From Unit Price to Total Cost: Getting Fractional-Share Cost Basis Right in Beancount
The Problem of Non-integer Shares Open a modern brokerage account and you own fractional shares almost before you mean to. Dividend reinvestment turns a 53.31 USD payout into 0.079 shares of an ETF; dollar-based recurring buys convert a flat 200 USD into whatever slice of a share that happens to buy today; fractional-share trading lets you order half a share outright. Whole-number lots are increasingly the exception, not the rule. This is a bookkeeping problem, not just a trading one, because a fractional lot is not quite the same thing to record as a whole-share one. In Beancount — and in double-entry systems generally — the natural way to record a purchase is to attach a per-share cost to the shares: ten shares at 200 each. That notation is exact when the share count is a whole number, and every tutorial reaches for it, including one I wrote last year. But the moment the share count carries decimals, that same notation quietly records a cost basis that is wrong — off by a few cents per lot, with no error to warn you, and in a way that eventually shows up as a mis-stated capital gain. This post is about why that happens and how to record fractional lots correctly. The fix itself is small — declare the total cost of the lot rather than its per-share price — but it’s worth walking through the reasoning, because it generalizes beyond stocks: whenever three numbers are bound by a single equation, only two of them carry independent information, and getting your books right comes down to writing the right two down. ...
Recording the Whole Paycheck in Beancount
It’s payday. Your checking account goes up by 8,192 USD. You open your ledger, add one line — salary came in, cash went up — and move on with your day. That entry feels complete. It balances, the number matches the deposit, nothing is wrong. And yet you’ve just thrown away most of the information you were actually paid. Because 8,192 USD isn’t your income. It’s what’s left of your income after the government, your retirement account, and your health plan have each taken a slice. Your real paycheck was 16,667 USD. The gap between those two numbers — everything that happened on the way from gross to net — is where nearly all the interesting financial information lives. If the only thing you record is the number that lands in your account, you’ve deleted it. This is the single most common mistake I see people make when they start keeping their own books. It’s worth understanding exactly what you lose, and how little effort it takes to keep it. ...
Recording Self-Submitted Insurance Claims: Why the Original Purchase Is the Part You Can Skip
Here’s a scene from my ledger that happens a few times a year. Over the course of a month, we buy a scattered pile of medical things out of pocket — a doctor’s visit copay, a box of prescribed supplies from the pharmacy, some physical-therapy sessions, a couple of online orders for a brace and a monitor. Nothing gets billed to insurance automatically, because these are the kinds of items you have to submit yourself. So I collect the receipts, fill out the insurer’s claim form, and mail off a bundle totaling something like 260 USD. Weeks later, an Explanation of Benefits shows up. The insurer has approved 138.01 USD — not the full 260 USD — and a check for that amount is on the way. And now I have two small, annoying problems. The first is reconciliation at the item level. The EOB doesn’t say “we reimbursed the brace and the copay but not the pharmacy order.” It shows adjusted, bundled, partially-approved line amounts that don’t map cleanly onto the charges as they hit my credit card. Figuring out which of the eight things I bought actually got covered — and which got denied — is genuinely tedious, and most of the time I don’t actually need the answer. The second problem is worse. That pharmacy charge from six weeks ago? It got imported and auto-categorized as groceries, because the store that filled the prescription also sells groceries and my importer keyed off the merchant name. By the time the check arrives, the original purchase has scattered into three or four categories, half of them wrong, and hunting it down is its own small archaeology project. This post is about how I book the reimbursement anyway — cleanly, in a couple of minutes — without solving either of those problems. ...
Recording Big-Ticket Purchases in Beancount: Asset or Expense?
You sign for a new car, and 30,000 USD leaves your checking account in a single transfer to the dealer. That night you open Beancount to record it, and the entry stalls on what feels less like data entry than a type error. Expense it, and Expenses absorbs 30,000 USD in one month — the income statement now reports that you torched a year’s discretionary budget, when in fact a car worth nearly that much is sitting in the driveway. Capitalize it as an asset instead, and net worth jumps by the sticker price of something that began depreciating the instant it left the lot; leave that number frozen and, three years on, the balance sheet still asserts the car is worth exactly what you paid, long after it’s really worth closer to 15,000 USD. Neither entry reconciles with reality. That mismatch — a value that won’t sit cleanly in either bucket — is the signal worth debugging: the categories aren’t broken, they’re being applied to the wrong kind of thing. ...
Recording Taxes in Beancount
Introduction Tax accounting is one of the most crucial aspects of personal and business bookkeeping, yet it can be intimidating for newcomers to double-entry accounting systems like Beancount. This guide will walk you through the fundamental concepts and practical techniques for accurately recording various types of taxes in your Beancount ledger. ...
Beancount RSU
Introduction Restricted Stock Units (RSUs) are a common part of compensation packages in tech and other industries. They can represent a significant portion of your income—but they also introduce complexity to your personal finances. RSUs vest over time, are subject to income taxes when they vest, and may later be sold, triggering capital gains. If you’re already using Beancount to track your finances, it’s worth bringing your RSUs into the ledger. In this post, we’ll walk through how to record RSUs in Beancount in a way that keeps your records clean, auditable, and tax-ready. ...
Trading Stocks using Beancount
Introduction Tracking your investments can easily become a mess of PDFs, spreadsheets, and inconsistent brokerage exports. If you’re already using Beancount to manage your personal finances, why not bring that same clarity and precision to your stock portfolio? Beancount isn’t just for daily finances—it’s a powerful tool for investment tracking. With its plain-text syntax and double-entry model, it gives you full control over cost basis, dividends, capital gains, and multi-currency holdings—without relying on a brokerage interface. It can easily become a central management tool for your investments. ...
Tracking U.S. Health Expenses with Beancount
Accounting for health-related expenses in the U.S. is slightly different from typical expense tracking because it usually involves insurance. In this post, we’ll walk through how to use Beancount to track your healthcare expenses in the U.S. How Healthcare System Work in US How healthcare system works In its simplest form, the healthcare system typically works as follows: You visit a healthcare provider who delivers medical services to you. The provider submits claims to your insurance company. The insurance company verifies the claims and pays a portion (or all, depending on your coverage). Once the claims are processed, the healthcare provider sends you a bill for the remaining amount. The insurance company also sends you an Explanation of Benefits (EOB), detailing how your medical claims were processed based on your plan. As a patient, there are two important documents you should pay attention to: ...
Principles of Building Chart of Accounts in Beancount
One of the first steps to mastering Beancount is designing a clean, flexible, and future-proof Chart of Accounts (CoA). This structure defines how you categorize your financial life—and ultimately, how useful and insightful your reports will be. In this post, I’ll walk through the principles, pitfalls, and patterns I’ve learned while building my own CoA in Beancount. Principles I have been using Beancount for a few years. Over these years, I changed the CoA many times. I found that the following three high level principles can be a good starting point for designing your accounts structure: ...
Tracking Retirement Accounts in Beancount
Introduction In the United States, retirement accounts are specialized investment vehicles designed to support long-term financial security during post-employment years. These accounts—primarily Individual Retirement Accounts (IRAs) and employer-sponsored plans such as 401(k)s—offer significant tax advantages to incentivize consistent saving. The Internal Revenue Service (IRS) sets and periodically adjusts contribution limits for these accounts to account for inflation. Given their unique regulatory and tax characteristics, retirement accounts differ from standard brokerage or investment accounts. When documenting them in Beancount, a plain-text double-entry accounting system, a structured approach is necessary to track both contributions and IRS-imposed limits. ...