Some months ago in this space I described a system for tracking mutual funds. Specifically, it tracks shares. The system also uses the idea of a cash account. For example, if a dividend is paid, and the dividend is reinvested, it works as follows: The dollar amount goes into a cash account. Then those same dollars are removed from the cash account to purchase shares.
Today, let’s look at a scenario where you own a mutual fund that typically has only two dividends per year. Specifically, they are long term gains and short term gains.
How can you automate the creation of the transactions? One way is to have ELisp paste the basic text of the transactions, which can be filled in with the date, dollar value, and number of shares.
Here is some example ELisp code:
(defun Acme-dividend ()
"Insert text for Acme long term and short term gains."
(interactive)
(insert "\n
2026-XX-XX Acme long term gains
income:Acme:Technology Fund $-
assets:Acme:cash $
2026-XX-XX Long term gains reinvestment | Acme Technology Fund
assets:Acme:cash $-
assets:Acme:ACMET XXX ACMET
2026-XX-XX Acme short term gains
income:Acme:Technology Fund $-
assets:Acme:cash $
2026-XX-XX short term gains reinvestment | Acme Technology Fund
assets:Acme:cash $-
assets:Acme:ACMET XXX ACMET\n"))
Note, though that you don’t need ELisp, or any other code to accomplish this. You can simply have the following text, which you can paste into your plaintext data, and then fill in the missing data:
2026-XX-XX Acme long term gains
income:Acme:Technology Fund $-
assets:Acme:cash $
2026-XX-XX Long term gains reinvestment | Acme Technology Fund
assets:Acme:cash $-
assets:Acme:ACMET XXX ACMET
2026-XX-XX Acme short term gains
income:Acme:Technology Fund $-
assets:Acme:cash $
2026-XX-XX short term gains reinvestment | Acme Technology Fund
assets:Acme:cash $-
assets:Acme:ACMET XXX ACMET\n"))
Again, this works reasonably well for a fund that has just a couple of dividends per year. To repeat, this is for a system that tracks assets of the mutual fund as shares. Yes, income is tracked in dollars, but the assets of the fund are tracked in shares. I don’t believe that this is the standard way to track mutual funds, but it works for me.