Hledger: multi bank approach

Hello,

still discovering PTA and hledger. I started small with my own personal accounts. It works nicely.

I did the same for my mutual account (the ones I share with my wife). Now, I am looking for the best way to merge both together and do the accounting for both accounts. How would you take the approach ? M y goal is to do the work once and for all in one shot, have a more precise view of our expenses and see how we can optimize our investements.

I have defined a simple way to import all transactions from our different banks but I do not know how to track all the operations from a single file.

Here is my account hierarchy:

passifs

dépenses

fixes

variables

revenus

salaires

remboursements

equity

ouverture/fermeture

actifs

dépôt

CC

LivretA

PEA

PEG

AV

titres

PEA

PEG

AV

actifs ; type

A

I use the same for our mutual account.

So what is the problem that you are struggling with? :slight_smile:

It is typically beneficial to mirror real-world accounts in your hledger accounts, so assuming that you have your own bank account, and your wife has one, and you also have a mutual one, and for complexity’s sake lets assume that you also have savings accounts. So you can create:

assets:cash:the bank:you
assets:cash:the bank:wife
assets:cash:the bank:mutual
assets:savings:the bank:you
assets:savings:the bank:wife
assets:savings:the bank:mutual

Now you can see:

  • how much cash you have (balance assets:cash)
  • how much savings you have (balance assets:savings)
  • how much money you have in the bank (balance “the bank”)

Then you spend money on groceries (and record this as money going to expenses:groceries ) or on rent (money going to expenses:rent). Now you can:

  • see how much you spent on groceries (balance expenses:groceries)
  • see how much each of you spent individually (balance expenses:groceries –related)

If you have a reporting need which is not satisfied with this arrangement, you tweak it (like, maybe you want your hierarchy be assets:the bank:{cash, savings} instead).

Does this resonate with what you’ve tried so far? What did not work?

3 Likes

Makes sense.

Let’s go then ! :slight_smile:

1 Like

I have been using something very similar but chose to structure it this way:

assets:me:banks:bankname:checking
assets:me:banks:bankname:savings
assets:wife:banks:bankname:checking
assets:wife:banks:bankname:savings
assets:joint:banks:bankname:checking

This way I can query what we each have:

hledger balancesheet -2

Or only in the checking accounts:

hledger balancesheet -2 checking

The reason I use “banks” is that I also separate investment accounts, as in:

assets:me:investments:brokername:accountname

I would rather have the account name or type as the last part because I could filter it as above. I figured if I wanted to get fancier I could also tag the accounts with account types but I have seen no need to do this yet.

Am I missing something?

To @Xavier , I am using a single file for all transactions (bank and investments). I previously has it separate but found it a chore when trying to transact “across” files. A single file for everything has worked better for me.

BTW: I have learned from your post @adept about the “--related” option. Handy!

This (@someguy's) is very close to my naming; additionally I try to give the leaf accounts (corresponding to real world bank accounts) uniquifying prefixes. So eg the personal checking is ...:pchecking, the business checking is ...:bchecking, etc. Unique memorable leaf names are super handy for searching and querying.

my approach with multiple banks is also similar: assets:bank:{checking, saving}:bank name:currency

Well, your workflow was my inspiration if I remember correctly :slight_smile: