What is the organization of your hledger files?

42 views
Skip to first unread message

Aimuz me

unread,
Jun 15, 2023, 11:39:07 PM6/15/23
to hledger
I have been using hledger to record for a few months, and the way I was using it was a large file. Now I want to ask you all, how do you keep track of your accounts?

I want to reorganize it into multiple files and I did some simple splitting as per https://github.com/simonmichael/hledger/tree/master/examples/templates/basic.

But after splitting, I still record all the books inside one main file.

I changed the main file to 2023-06.journal and made it the first file.

2023-06.journal imports accounts.journal and commodities.journal.

In 2023-06.journal I record all the bills for the month of June.

When it comes to the end of the month I need to add an asserted bill. To ensure that there are no errors in the billing for this month.

After July, I create a new file 2023-07.journal , which is imported into 2023-06.journal by include, to ensure the continuity of the billing.


But should I do another split considering I have a bit too many accounts? Can you guys tell me how you keep track of it? I like to refer to it. Thank you all

Simon Michael

unread,
Jun 16, 2023, 6:00:16 AM6/16/23
to hledger
In my usage, splitting into smaller files hits diminishing returns quite quickly. 

Splitting by "topic" can work, if the topics are mostly disjoint, with not a lot of transactions between them. Eg, separate files for transactions, account declarations, and prices. Or separate files for accounts which don't interact much with the others.

Splitting by time period makes sense if you accumulate enough data. And if you do it, I'd apply it consistently to all the files you already have, eg 2023transactions.journal, 2023accounts.journal, and 2023prices.journal. Otherwise if files have different lifetimes things tend to get muddled.

If splitting by time, I feel yearly is usually the sweet spot. Splitting monthly means the number of files you have to deal with will multiply 12 times as fast. It might be doable with discipline, but try it, I bet you'll find it's not worth it.

To answer your question, I currently keep 5 files per year - YYYY.journal, YYYYaccounts.journal, YYYYprices.journal, two others related to investments - and one more which doesn't need to be per year, future.journal.  

I tend to use (Emacs) editor features to make these long files more navigable, like adding foldable section and month headings.





--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hledger/7621c0cf-13c4-44e1-bdc3-174194978029n%40googlegroups.com.

Aimuz me

unread,
Jun 17, 2023, 5:04:15 AM6/17/23
to hledger
When entering the next year do you go through include the previous year's files?

Dmitry Astapov

unread,
Jun 17, 2023, 7:55:12 AM6/17/23
to hle...@googlegroups.com

Aimuz me

unread,
Jun 17, 2023, 10:15:53 AM6/17/23
to hledger
Thanks for your answer, I'll refer to it

Simon Michael

unread,
Jun 18, 2023, 12:51:41 AM6/18/23
to hledger
I don't include the previous year files - except in a special all.journal file, which I use when I want to report on all history.

I report on just the current year by default, and I add more -f options when I want to include more year(s).  More precisely, I have a shell script which does this (`years N CMD`, can share it if wanted).

To make this work, I begin and end each file with opening and closing transactions as described (still imperfectly) at https://hledger.org/dev/hledger.html#close . See eg https://hledger.org/dev/hledger.html#example-migrate-balances-to-a-new-file .
Reply all
Reply to author
Forward
0 new messages