Plain text ledger - donating a portion of your income

I keep track of my personal finances in a plain text format using tools like hledger and Ledger. I also donate 10% of my income to charity, and have two automated transactions in my ledger that keep track of this.

My accounts reference Daswandh, a Sikh practice of giving 10% of earnings away, your accounts may reference Effective Altruism, Tithe, etc.


We create a new liability account that tracks how much we need to give.

The first transaction should match all income postings that you want to be "taxed". It adds 10% of each to our new liability account. These postings need to be virtual (wrapped in brackets) as they will not balance.

= Income
    ; Adding a negative amount (like an income) to a liability increases it
    (Liabilities:Daswandh:To be donated)      *0.10

The second transaction should match all postings that you want to count as satisfying your pledge. It adds the full amount of each posting to the account.

I have some postings that I consider donations, but not charitable in the spirit of my pledge so I specifically target a sub account.

= Expenses:Donations:Charitable
    ; Adding a positive amount to a liability reduces it
    (Liabilities:Daswandh:To be donated)    *1.00


You can now use this new account to see how you're doing with your pledge. You'll need to pass hledger the ‑‑auto flag to make it process automated transactions.

For instance: hledger balancesheet ‑‑auto

Balance Sheet 2021-02-08

                                    ||          2021-02-08 
 Assets                             ||                     
 ...                                ||                     
 Liabilities                        ||                     
 Liabilities:Daswandh:To be donated ||              £19.97 
                                    ||              £19.97 
 Net:                               ||                 ...

How much you've pledged and given in total

You can add two extra accounts to keep tally of how much you've donated and pledged so far.

I treat Daswandh:Pledged like a liability, so it's negative. I treat Daswandh:Donated like an expense, so it's positive.

= Income
    (Daswandh:Pledged)                       *0.10
    (Liabilities:Daswandh:To be donated)     *0.10

= Expenses:Donations:Charitable                  
    (Daswandh:Donated)                       *1.00
    (Liabilities:Daswandh:To be donated)     *1.00

Notice that Pledged + Donated = To be donated, which makes a certain amount of sense.

$ hledger bal --auto "^Daswandh"
           £1,590.00  Daswandh:Donated
          £-1,632.25  Daswandh:Pledged
             £-42.25 [== Liabilities:Daswandh:To be donated]

Ledger vs hledger

I've used hledger's syntax for multiplier above, which unfortunately is mutually incompatible with Ledger's syntax. Simply remove the asterisks for Ledger compatibility.

Ledger processes automated transactions by default so there's no need for an ‑‑auto flag.