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. ...

Published: 2026-07-16 · Last updated: 2026-07-19 · 13 min · 2663 words · Yichu Zhou

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. ...

Published: 2026-07-09 · Last updated: 2026-07-11 · 10 min · 2103 words · Yichu Zhou