A User's view of Hledger

Learning about hledger

Accounting for a mutual fund

I am a fan of hledger because of the great job it does organizing my finances. What I am not is any kind of expert about double entry accounting. As a result, I sometimes have to spend a lot of time thinking about how to accomplish an accounting task, something that is likely old hat to bookkeepers and accountants.

A case in point is my recent decision to track mutual funds in hledger. There is a tutorial on tracking investments at https://hledger.org/investments.html. However, my basic problem is that I don’t think in accounting terms, and while I could apply the advice in the tutorial, I wouldn’t totally understand what was happening. So, I decided to come up with an approach on my own, and that way I would have more insight into the inner workings of whatever I came up with. Yes, it might be an erroneous approach, but if it were, I would have a better chance of seeing where I went wrong. On the other hand, if my method worked, I would understand it more than if I had simply copied someone else’s template.

As a starting point, I chose to track shares rather than dollars. This may sound odd as the reason most people invest in a mutual fund is to increase their wealth, as measured in whatever currency they use. However, my reason for tracking a mutual fund in hledger is to regularly reconcile the account. If I can reconcile an account, I know that the information in it is accurate. On the other hand, if there were any kind of irregularity happening in the account, that would normally come to light during the reconciling.

Turning back to the idea of tracking shares, I can easily see how to reconcile the number of shares in a fund. The value of the shares will fluctuate daily according to the market, but the number of shares will change only when you buy or sell shares. Therefore, as a matter of simplicity, I decided to concern myself with reconciling only the number of shares.

How do I set up a starting balance? Let’s say that I begin the year with exactly 10 shares of the hypothetical Acme Mutual Fund’s BigIndex fund, whose ticker symbol is BGINX. I haven’t entered any prior transactions for this fund, so I need to have a starting balance. In addition, I need to specify a currency. I have already said that it won’t be dollars. I could use the generic “shares,” but that won’t work if I have more than one mutual fund. That is, a share in one fund is not the same as a share in another fund. Instead, I will use the (hypothetical in this case) ticker symbol of BGINX. Here is my starting balance:

2026-01-01 starting balance
    * assets:Acme Mutual Fund:BigIndex  10.0000 BGINX
    equity:start

That’s the relatively simple part. Next week, I will show how I added additional shares via a reinvested dividend.