How do you organize your ledger files?

2,639 views
Skip to first unread message

Travis Dahlke

unread,
Jun 30, 2014, 7:01:15 PM6/30/14
to ledge...@googlegroups.com
I'm relatively new to ledger. I have a couple months of transactions, and I'm loving the power to see literally all aspects of my finances. I'm wondering, how do you organize your ledger files? Currently I'm just entering all transactions chronologically. Is there a better way? Do you split them up by account? If so, where do you put transfers? Do you have separate files? Curious to see what works for people, and what doesn't.

Craig Earls

unread,
Jun 30, 2014, 11:14:32 PM6/30/14
to ledge...@googlegroups.com
I put everything in one file. For a while I tried keeping accounts separated in different but emacs ledger mode works best with everything combined. 


On Monday, June 30, 2014, Travis Dahlke <dahlke...@gmail.com> wrote:
I'm relatively new to ledger. I have a couple months of transactions, and I'm loving the power to see literally all aspects of my finances. I'm wondering, how do you organize your ledger files? Currently I'm just entering all transactions chronologically. Is there a better way? Do you split them up by account? If so, where do you put transfers? Do you have separate files? Curious to see what works for people, and what doesn't.

--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

Russell Adams

unread,
Jun 30, 2014, 11:23:48 PM6/30/14
to ledge...@googlegroups.com
On Mon, Jun 30, 2014 at 08:14:31PM -0700, Craig Earls wrote:
> I put everything in one file. For a while I tried keeping accounts
> separated in different but emacs ledger mode works best with everything
> combined.

And I'm the opposite. I have each expense report and account I track
in a separate file. If I had a better way to narrow them to matching
transactions (ie: limit to a query) I could put them together more.

That's why Ledger is awesome, it can do it anyway you like.


------------------------------------------------------------------
Russell Adams RLA...@AdamsInfoServ.com

PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/

Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3

Martin Blais

unread,
Jun 30, 2014, 11:39:41 PM6/30/14
to ledger-cli
On Mon, Jun 30, 2014 at 7:01 PM, Travis Dahlke <dahlke...@gmail.com> wrote:
I'm relatively new to ledger. I have a couple months of transactions, and I'm loving the power to see literally all aspects of my finances. I'm wondering, how do you organize your ledger files? Currently I'm just entering all transactions chronologically. Is there a better way? Do you split them up by account? If so, where do you put transfers? Do you have separate files? Curious to see what works for people, and what doesn't.

Great question.

- I use a single file for everything. I like the simplicity of it, and it makes de-duping transactions easier on import (cut-n-paste and i-search within one buffer). It hasn't been problematic so far (though I have to admit, as a software developer, I'm quite adept at editing text files at this point).  

- I use Emacs to edit the file with major mode "org-mode" and minor mode "beancount-mode". This allows me to fold all the sections and unfold only the ones I'm planning to edit. I recommend using some sort of outline mode (in any editor), it's perfect for this application.

- Each org-mode section mostly contains all accounts related to a single real-world account, for instance, for an investment account, I'll have Assets:US:Etrade:Cash, Assets:US:Etrade:GOOG, Assets:US:Etrade:ITOT, ..., Income:US:Etrade:Dividends, Income:US:Etrade:PnL, Expenses:US:Etrade:Commissions, all living in the same section. Basically all the accounts that relate to a single real-world account declared there at the beginning of the section and the transactions follow. Same for taxes: I have a set of accounts for each taxation year, which contains all of the payments and receipts for that tax year. For employment income, all the income events (salary payments, bonuses, stock vesting, etc.) all live in the same section, they're all logically related. I have a big cash section at the bottom that I call "Daybook" which contains all the odd little cash entries that I enter manually and not as a result of an import.

- I define nearly all my accounts with a 3 or 4 level hierarchy, pretty much: Type:Country:Institution:Account. For example, Assets:US:ETrade:Cash, Liabilities:US:Amex:Platinum, Income:US:Google:Salary, etc.. The exception is for expenses, which does away from this hierarchy and is simpler. I lump health-care insurance, copays, deductibles and services (e.g. massage therapy) under a single root account.

- I don't have a rule for de-duping, that is, if a transaction has both sides living in two different sections, I don't have a systematic principle by which I decide which side I'll leave it on, I just go by feel. For example, I "tend" to leave payments to my credit card in the section for the checking account it comes out of, so the credit card section pretty much only has expenses. (This doesn't matter too much, BTW, if you look at the registers via reporting, you don't care much where the stuff is. Beancount doesn't care about declaration ordering at all; I think Ledger has some subtleties related ordering (discussed on this mailing list), so those may have an influence on how you decide to set yourself up.)

- To import, I use LedgerHub and cut-n-paste the imported transactions manually. It provides a fairly high level of automation, but occasionally a new type of entry shows up and I have to hack a bit of code to automate the import. Works without hacking 95% of the time.

- For filing PDF statements and such, I use LedgerHub to automatically identify and move the files to a hierarchy that mirrors my account hierarchy, and check that in to a Mercurial repository. Beancount points to this stash of documents and serves them in the web interface. This provides a clear and natural destination for each document. I scan a lot of stuff. (I strongly prefer Mercurial to Git for many reasons, but I'm thinking about switching it to a Git repo for this documents archive for the single reason that moving large data files in Git is free, whereas in Mercurial it increases the size of its repo. Making changes to your account organization means you want to mirror the change in the documents archive and thus move directories, this has happened a number of times.) At the moment, my document archive stores a separate hierarchy for each year, but I'm questioning the wisdom of doing this... I think I'm going to merge it all under a single one soon, for simplicity's sake.

- I don't "close" years by inserting end-of-year summarizing transactions; I believe that this is a job the software should be able to handle for you, I should be able to bring up a balance sheet at any date and period, that automatically transfers net-income to its equity. As such, I have no motivation to split by file. Others on this list use closing entries to make each year fully contained for various reasons. Beancount is fast enough on my 8 years of data that it doesn't matter to reparse the entire thing every time, so load speed isn't a motivator for me to split it either.

Note that you should not worry too much about getting it right the first time... I've come to this way of doing things by changing the organization of my file many times and it's not difficult if you know how to manipulate text. That's part of the beauty of using text files, you can always change your mind later on. 

Finally: the above works for me, I'm not claiming that it's the one way to set yourself up. Find what works best for you.

I'm planning to cover this in a lot more detail in the Beancount cookbook:

Cheers, very interested to hear how others do it too,

Stefano Zacchiroli

unread,
Jul 1, 2014, 2:29:18 AM7/1/14
to ledge...@googlegroups.com
On Mon, Jun 30, 2014 at 10:23:45PM -0500, Russell Adams wrote:
> And I'm the opposite. I have each expense report and account I track
> in a separate file. If I had a better way to narrow them to matching
> transactions (ie: limit to a query) I could put them together more.

And how do you deal with transfers across accounts?
Do you use explicit Transfer:* accounts or what?

I'm currently using one ledger file per account---actually, one ledger
file per *institution*, keeping together all the accounts (checking,
savings, etc.) that the same institution gives me. But I'm leaning
toward switching back to a single file.

Part of the reason is the transfer problem, which is annoying. Another
is that many tools in the ledger ecosystem seem to still have an
implicit assumption that all transactions are in a single file and do
not follow include directives.

Finally, one of the original reasons for me to have one file per
institution was to ease cross-checking if my ledger files had all
banking transactions and vice-versa. But in practice the vice-versa is
never true, because in ledger you always have more transactions than in
the bank (e.g. petty cash), so that specific use case is moot.

Cheers.
--
Stefano Zacchiroli . . . . . . . za...@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Former Debian Project Leader . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

Simon Michael

unread,
Jul 1, 2014, 8:05:08 PM7/1/14
to ledge...@googlegroups.com
I'm another one who's tried multiple files (one for personal, one for
business, one for each client) but returned to keeping everything in one
file as far as possible. But, I do split by year, partly for performance
and partly to get more useful reports by default. At the beginning of
https://twitter.com/LedgerTips you can see some details of my files and
aliases.



Jim Robinson

unread,
Jul 2, 2014, 8:15:13 AM7/2/14
to ledge...@googlegroups.com
You say "for performance reasons," does that mean you close out
the accounts each year?  I also split my transactions out by year,
but I maintain a top level ledger.dat that lists an "!include ..."  for
aliases, automatic txns, and for each year.

Jim

Simon Michael

unread,
Jul 2, 2014, 9:04:36 AM7/2/14
to ledge...@googlegroups.com
On 7/2/14 5:15 AM, Jim Robinson wrote:
> You say "for performance reasons," does that mean you close out
> the accounts each year? I also split my transactions out by year,
> but I maintain a top level ledger.dat that lists an "!include ..." for
> aliases, automatic txns, and for each year.

Yes, similar here.

> My journal files: ENTITY[-YYYY].journal. general-2014.journal is
> current LEDGER_FILE (default). CSV & rules files are dot-named to hide them
>
> Each year sets asset/liability opening balances at start & closes to
> zero at end, so works alone or combined. all.journal includes all years

I use hledger, which isn't as optimised as Ledger, so reports are
noticeably slower when processing all years from 2007. But even without
this, I'd still split by year for less clutter when editing and to avoid
having to always add date options to reports.

Red Street

unread,
Jul 2, 2014, 11:20:31 PM7/2/14
to ledge...@googlegroups.com
I have a separate file for each actual account. Importantly, my file and directory structure mirror my account hierarchy exactly.

To make life easy:
1) I use vim, and use a single account file (created by running 'ledger accounts') from which account auto-completes are made, which is essential.
2) Also, I have a bunch of small homegrown scripts to quickly edit the file I want. eg (in zsh):
function reg {grep -i $1 ~/ledger/accounts/**/*.ldg}
function ld  {vim ~/ledger/accounts/**/*$1*.ldg}
The first one greps through all account files. The second edits a file when you specify any part of the filename. So I don't have to think about things much when working.

I think it's important to organize them based on your workflow and how you think about accounting. For me, I chose this for two strong reasons: first, my natural thinking is centered around the accounts and the account hierarchy, and second, I use a system to download and append transactions to my master files which works great with this organization. In addition, this organization works quite well with a versioning system (I use git).

As I move into managing many more accounts for two people, I might revisit this, and consider moving up one or two levels of abstraction - i.e, use one file for all bank accounts, one file for all credit cards, etc.

Craig Earls

unread,
Jul 2, 2014, 11:45:21 PM7/2/14
to ledge...@googlegroups.com
The principle reason I stopped using multiple files was because
transfers between accounts in two separate files can drive you insane.

Red Street

unread,
Jul 3, 2014, 12:19:11 AM7/3/14
to ledge...@googlegroups.com
Ah, yes, I forgot to mention this: I rarely transfer between two accounts any more, because it's a pain in general. I just use intermediate accounts which should always balance out to zero like this:

2013-1-1 Credit card payment
   Assets:Bank:Checking
   Zero Sum:Transfers

2013:1-3 Web payment received
   Liabilities: Chase Visa
   Zero Sum:Transfers

Zero Sum:Transfers should balance out to zero.

This is much easier because my setup around ledger simply downloads these transactions and automatically classified them as Zero Sum transactions. This way, my downloads correspond exactly with the statements from the institutions as well (as opposed to having to delete one transaction and keeping one). In addition, ACH transactions take 2-3 days, and doing it this way accurately reflects the amount of money in your accounts at any time. The small downside is, if you have many cards and many bank accounts, it's not easy to ask questions like "how much did I transfer from bank X to card Y in 2013?". But such an analysis is generally unlikely
Reply all
Reply to author
Forward
0 new messages