A User's view of Hledger

Learning about hledger

Mutual funds part 3: money market funds

This is part of a series showing how this non-accountant decided to track mutual fund accounts in hledger. The goal was to come up with something that I could understand, even if I made mistakes along the way.

This time, the subject is money market funds. And the question is do I treat a money market fund the same as I do other mutual funds, or treat them differently?

Since, a money market fund is a kind of mutual fund, I don’t have to do anything different. With mutual funds, I create a unique symbol for the shares. For example, for a non-money market fund, in a previous column I gave the example of using BGINX to track shares of the hypothetical Acme Mutual Fund’s BigIndex fund. For example:

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

And I could do something similar to the above with a money market fund. However, there is at least one key difference between money market funds and other mutual funds. Specifically, money market funds, as a rule, maintain a value of one dollar per share. Stock and bond mutual funds, on the other hand, have share prices that fluctuate from day to day.

With the above in mind, the other approach to tracking money market funds is skip the step of creating a currency symbol for the money market fund. Instead, just use the dollar sign.

For some history on this, I note that the vast majority of U.S. money market funds have maintained a consistent value of one dollar per share. There have been a few exceptions. If you are interested in reading about money market funds whose share price fell below one dollar, here is the Wikipedia article on it: https://en.wikipedia.org/wiki/Money_market_fund#Breaking_the_buck.

Since the odds seemed in my favor that my money market fund would maintain its dollar per share value, I decided to use dollars as the currency. Therefore, a deposit into the money market fund could look like this:

2026-03-12 deposit to money market fund
    assets:Acme Mutual Fund:Money Market   $10.00
    assets:checking                       -$10.00

When the fund pays a dividend, here is how I would record it:

2026-03-12 money market fund dividend
    income:dividends:Acme Mutual Fund:Money Market   -$1.00
    assets:Acme Mutual Fund:Money Market              $1.00

The disadvantage of my approach is that if ACME Money Market Fund fails to maintain its share value, I will have an accounting problem since I ignored the share price in my approach.

The advantage of my approach is that I have fewer transactions to enter. For a non-money market mutual fund, I enter two transactions, such as:

2026-01-30 dividend received | Acme Mutual Fund:BigIndex
    income:Acme Mutual Fund:BigIndex          -$1.00
    assets:Acme Mutual Fund:cash               $1.00

2026-01-30 dividend reinvested | Acme Mutual Fund:BigIndex
    assets:Acme Mutual Fund:cash              -$1.00
    assets:Acme Mutual Fund:BigIndex            0.1000 BGINX

With my approach, I accomplish the same thing with one transaction:

2026-03-12 money market fund dividend
    income:dividends:Acme Mutual Fund:Money Market   -$1.00
    assets:Acme Mutual Fund:Money Market              $1.00

In short, even though the odds, historically speaking, or on my side, I am taking a gamble. If my money market fund maintains its value, I win. If it fails to maintain its value, I lose in two ways. First, I will have to find a way to record this loss in hledger. Second, I will have lost some money, rubbing salt into my wound.

Further Refining git/magit workflow

Last month in this column I wrote about using vc-auto-commit to improve my git/magit workflow. I now have an additional tweak.

By way of background, I noticed that after I finished updating an hledger file, I would do three steps: run ledger-mode-clean-buffer, save the file, and run vc-auto-commit. Since this is all done in Emacs, it’s easy to combine those three commands into one. However, I wanted to include some error checking, so that the commands won’t run on a non-hledger file, for example. So, with the help of my Emacs mentor Protesilaos Stavrou, I came up with the following for my Emacs init file:

(use-package vc-auto-commit
  :ensure t
  :config
  (defun rob-ledger-clean-save-vc-commit ()
    "Clean buffer, save, and commit in git."
    (interactive)
    (if (and
         (derived-mode-p 'ledger-mode)
         buffer-file-name)
        (progn
          (ledger-mode-clean-buffer)
          (save-buffer)
          (call-interactively #'vc-auto-commit))
      (user-error "Check if in ledger-mode, if saved file exists, if under git version control."))))

Comments: the above code first loads and configures vc-auto-commit. Then it checks if I am in ledger-mode AND the buffer is associated with a file (as opposed to a buffer that had never been saved).

If both the above are true, it cleans the buffer, saves it, and runs vc-auto-commit.

I will note that I don’t have any long-term results to report, since I just started using this, but so far so good.