
Ledger, a powerful CLI accounting tool - mercurial
http://www.ledger-cli.org/
======
bkuhn
I'm President of the Software Freedom Conservancy, a 501(c)(3) non-profit
charity that provides a home for Open Source and Free Software projects.

We've used Ledger-CLI since around mid-2008. We currently have 137,677 lines
of ASCII Ledger-CLI data. We're thus likely the largest Ledger data set in
real-world operations on the planet.

We switched to Ledger-CLI simply because it was the only Free Software
accounting tool that had the flexibility to handle the complex area of non-
profit accounting called "fiscal sponsorship", which is the primary purpose of
our organization.

However, the fact is, I keep the books myself because Ledger-CLI gives you an
excellent set of books that only a hacker could love. That said, our
accountants after a few annual audits that were painful, this year absolutely
love our reporting and find our audit a breeze (see the contrib/ area of
Ledger-CLI's repository for the scripts we use for reporting).

Our biggest challenge now is that we are growing and need a programmer who can
use Emacs, the command line, and revision control systems to keep our books
isn't scalable. We need a better UI for both data entry and reporting to make
this work.

As such, Conservancy last year started raising funds to build a better
accounting system for non-profit organizations on top of ledger:
[https://sfconservancy.org/campaign/](https://sfconservancy.org/campaign/)

It's slow going, but I recently announced that I'll be spending 50% of my time
on the project, and we hope we'll get more donations as time goes on. We're
focused on what non-profit orgs need first, but long term, we'd like to build
an accounting application that will "last". We did a survey of all the known
Open Source and Free Software accounting applications, and frankly we found
them all lacking for various reasons: either they try to do too much and fail
to get the accounting done right, or they are just poorly designed:
[http://npoacct.sfconservancy.org/ExistingProjects/](http://npoacct.sfconservancy.org/ExistingProjects/)

~~~
kinleyd
I'll be keen to see the nature of UI and reporting tools that emerge from this
exercise.

I currently use TurboCash, which is a Windows-based accounting solution that
works well for me, but I am keen to move away from Windows entirely and on
that front Ledger is currently top on my list.

------
thu
Ledger inspired hledger, written in Haskell:
[http://hledger.org/](http://hledger.org/)

~~~
616c
Also noting hledger has a cooler web interface, whereas others built projects
with a ledger backend. Ledger is CLI only.

[http://hledger.org/manual#web](http://hledger.org/manual#web)

~~~
mercurial
Well, the more the merrier. Apart from the web interface, it doesn't seem to
be quite as full-featured (eg, no typed metadata), but I may try out one of
these days.

I'd like to note that ledger's manual is second to none. More documentation
like this, please.

~~~
smichael
hledger author here. It is a bit less featureful than Ledger, partly by
necessity (it's younger, I'm slower) and partly by design. My priorities are
slightly different from John's.

That said, hledger does have features Ledger doesn't (aside from being a
haskell project, which I see as a significant long-term feature). Some of
hledger's experiments have found their way back into Ledger, also.

Also by design, hledger is very compatible with a subset of Ledger, so that
you can keep journal files that work with both.

~~~
mercurial
As I said above, I welcome more software like this, it's a very nice trend (I
noticed Python and Perl implementations as well).

------
jimktrains2
[https://github.com/jimktrains/freebooks](https://github.com/jimktrains/freebooks)
is something I started working on a while ago. It stores everything inside git
commits and signs each transaction. My goal was/is to make it distributed such
that my wife and I can enter transactions separately and then merge them at
some later point.

~~~
ac2u
blockchain? :)

~~~
jimktrains2
No reason you couldn't use a block chain. freebooks is designed for a handful
of trusted users, so I thought git was a better choice.

------
kingnight
The reasons why I tried and failed with ledger:

\- I never quite understood how to 'start' the ledger balance. Should I start
on the first of the year when my account was at $56 or today when it's at $76
... where does this $ come from?

but probably more this:

\- I found it super laborious to enter transactions. I guess I grew up post-
checkbook but when I'm not near my computer for a few days and have a
pocketful (or not) of transactions to enter, I would get behind and then just
give up. Even with logging into my bank account to cheat.

\- Investments man. How does one track dividends, buy/selling in a text file.
I probably need to take a finance class... :)

~~~
tucosan
> \- I found it super laborious to enter transactions. I guess I grew up post-
> checkbook but when I'm not near my computer for a few days and have a
> pocketful (or not) of transactions to enter, I would get behind and then
> just give up. Even with logging into my bank account to cheat.

I had the exact same gripes with ledger. Although there are means to pull csv-
data from most banks, one still would have to categorize the entries on each
import into ledger.

There is
[https://github.com/cantino/reckon](https://github.com/cantino/reckon) which
claims to solve this by automatically sorting entries into the correct
accounts by means of Bayesian learning. Sadly the machine learning worked
unreliably with my data - I would still have to manually sort many of the
recurring and previously "tagged" entries into the proper account each time
they came up in the csv-file.

~~~
smichael
This is perceived as a big problem by many people. Here are some current
options:

CSV:

You download CSV data from your bank (manually, probably). Then you convert it
to ledger journal format using one of a number of tools: CSV2Ledger, reckon,
Ledger, hledger (both have CSV support built in by now), or something you
write yourself. This data is "single-entry" and doesn't know about your chart
of accounts, so you augment and translate it into more useful general journal
entries. There are several approaches being explored:

\- rule-based - you set up rules, matching patterns in the description, which
assign accounts and balancing postings. Eg: CSV2Ledger, hledger (currently; eg
[http://hledger.org/manual#csv-files](http://hledger.org/manual#csv-files)).

\- history-based - the CSV description is matched against transactions already
in the journal, and the most similar one is used as a template to flesh out
the new transaction. Eg: Ledger ([http://ledger-
cli.org/3.0/doc/ledger3.html#The-_003csamp_003...](http://ledger-
cli.org/3.0/doc/ledger3.html#The-_003csamp_003e_003cspan-
class_003d_0022command_0022_003econvert_003c_002fspan_003e_003c_002fsamp_003e-command)).

\- artificial intelligence - I seem to remember reckon does something else
more clever ?

OFX:

\- manual download - as above, but you download an OFX file. OFX records
provide more structure than CSV but still need to be fleshed out. ledger-
autosync does this, using history matching. It also skips transactions you've
already saved to the journal, avoiding duplicates.

\- automatic download - ledger-autosync can also handle the download, if your
bank provides OFX Direct Connect. This is the most automated option at the
moment, recommended. I pull transactions daily from Wells Fargo this way
(though I'm going to quit one of these days since they charge too much for
it).

GNUCash:

\- In the distant past, ledger could read GNUCash files directly, so you could
enter with GNUCash and report with ledger. This feature is long gone, but you
might be able to get it working with an old Ledger version, and `print` into a
journal file you can then use with modern *ledger.

Converting from other finance apps, eg mobile ones:

\- As above, you might find adhoc ways to import from apps with nicer data
entry. Eg use the iXpensit Pro app on iphone, export the CSV, convert that,
add crazy automation duct tape until it's "smooth".

hledger web:

\- hledger-web has an add form. It's not very good, but it's in your browser,
and if you're really keen you could set it up to be accessible from your
smartphone.

hledger add:

\- hledger's built-in add command does assisted (history-based, tab completion
etc.) interactive data entry on the console. Some folks may find that
preferable to editing a text file.

Editor modes:

\- for people used to text editors: ledger-mode provides some data entry
conveniences for Emacs users, and there's vim-ledger, a ledger bundle for
TextMate, etc.

HOWEVER...

If like me you're working on building discipline and insight into your
finances, you may find nothing beats manual data entry for a while. You don't
get the same awareness when everything is automated.

------
amboar
Interesting; I might poke around at Ledger. Recently I just wanted to see what
I was spending money on in a few simple graphs graphs, and so hacked together
some python and matplotlib:
[https://github.com/amboar/fpos](https://github.com/amboar/fpos). fpos doesn't
do anything complicated, but allowed me to see where my money was going
without me doing too much tedious work.

------
bananas
Tried it but I can't shift the spreadsheet mentality. Perhaps I'm getting old
and inflexible but literally everything has a brick wall somewhere apart from
spreadsheets.

Edit: I did my accounts on an HP48GX until about 2003, bought sage line 100
and hated it, moved to excel 2000 and now libreoffice calc.

~~~
roel_v
While theoretically you can do double-entry bookkeeping in Excel, it's
frustrating and error-prone.

Then again for somebody who doesn't see the value of double entry bookkeeping,
it's unnecessary anyway, and Excel will do fine.

~~~
bananas
I do double entry. Accounts as columns, transactions as the first two columns
(desc/id and amount) and one transaction per row. Transactions are added to
the ledger with a macro and the ledger columns are locked so there is no
possibility of human error. One sheet per financial year, balance carried over
for all accounts between sheets.

So yes you can do it and no it's not frustrating if you do a little
automation...

Compare this to Sage which requires piles of money, time, expertise,
maintenance, installation, backup and restore.

~~~
roel_v
Would you mind describing a bit more how this works? I've never seen a double-
entry system in Excel that I found workable and sufficiently self-checking to
ensure data integrity, but I don't really understand yet how you do it. Where
do you keep per-account ledgers? Are that your columns in the sheet? What
exactly is done with the macro?

I might have a hard time imagining because I need to translate the terminology
from Dutch - am I understanding correctly that 'account' = something like
'Expenses - utilities' or 'Taxes to claim'? How do you make a profit and loss
statement, and a balance sheet? Do you use some sort of annotation for your
accounts?

~~~
bananas
Its pretty simple. It took me a while to work it all out. You have one sheet
per financial year with the following columns:

Description - text description of transaction.

Date - transaction date.

Ref - invoice ID/cheque number etc.

Amount - transaction amount.

Then there are columns, one for each account which are locked I.e. you can't
type in them.

To make a transaction, you enter the transaction details in a new row and add
the amount and set the source and destination account on the row (Ctrl+click)
each in the correct order. Then run the macro which replaces the source with a
formula (-amount) and the destination with (amount) from the row. Note that it
uses the formula rather than the value to maintain integrity and allow the
value to be retrospectively corrected. You could in theory do VAT accounting
with it but I haven't bothered to do that yet.

There are columns for bank, petty cash, expenses, corp tax, PAYE, dividends,
invoices etc.

The profit/loss statement is the sum of various columns for the year with some
maths. This is updated on the fly by sheet references.

There are row summaries at the top and the first two rows are frozen so you
can see the total for each account at any time.

All data is available up front so its pretty easy to do analytics on.

I might write it up properly at some point but that should give you a
reasonable overview.

I wouldn't use this on mega high amounts of transactions. I top about 200 a
year if I'm busy.

The system is portable between excel, libre office, numbers and Google sheets
in theory although I haven't tried the latter yet.

------
rkowalick
I'm a big fan of ledger. Very easy to use and very powerful.

One of my first ruby projects was creating a scraper for the Chase mobile
website that outputed ledger-compatible text:
[https://github.com/rkowalick/autobank](https://github.com/rkowalick/autobank)

------
cel
Here are some scripts I made for importing transactions into ledger journals
from various formats: [https://github.com/clehner/ledger-
scripts](https://github.com/clehner/ledger-scripts)

------
hrjet
I have been maintaining a ledger-inspired app in Scala:
[https://github.com/hrj/abandon](https://github.com/hrj/abandon)

While I loved the main idea in ledger, of having a text-based database of
transactions, I was not satisfied with the particulars of the implementation;
hence the fork.

You can find a list of all ledger-inspired apps here:
[https://github.com/ledger/ledger/wiki/Ports](https://github.com/ledger/ledger/wiki/Ports)

------
fiatjaf
What is so hard in personal accounting that takes an enourmous quantity of
apps, webapps, web services and CLI tools to solve? Is it really worth
creating markdown files for each expense and passing them to a "powerful
tool"?

I'm asking honestly, not trying to make fun of it somehow.

~~~
superuser2
There are lots of large, flashy programs, but in my cases UX is exceptionally
poor and the tools are extremely inflexible.

Take Mint, for example. It is impossible to have an overall budget. You can
only set budgets per category. There does not appear to be a modern tool that
will show me a progress bar of where I am on spending per month. Every option
I've ever seen requires budgets to be set per category.

There are lots of different ways people want to see data, and many of these
flashy/polished tools (like Mint, Simple, whatever) give a giant "fuck you" to
anyone who doesn't think in exactly the way the program was designed.

~~~
sathyabhat
YNAB should fit your needs well - I know it does for me. Using YNAB after
trying(and failing, mainly because it doesn't support my
currency/location)Mint.

[https://www.youneedabudget.com/](https://www.youneedabudget.com/)

------
thelsdj
I spent 10-15 hours (mostly in Ledger) figuring out what my Bitcoin tax
liability was. Not (mostly) Ledger's fault that it took so long. Now that I
know what I'm doing, I should be able to do this year in just a few hours.

~~~
Torgo
Ledger appears to be the "prescribed" way to do accounting natively in
Bitcoin/other cryptocurrencies as well. I investigated this earlier this year.
Quicken is out, no support and no way to add it in. And I found that GNUCash
can't handle bitcoin's level of divisibility, and is tied to ISO currency
codes. Ledger doesn't care about any of that.

~~~
atmosx
What do you mean by 'divisibility'?

~~~
Semiapies
Probably the use of tiny fractions of a Bitcoin in transactions.

------
dgreensp
Thanks for posting this, it's new to me! I was just thinking about trying to
find a new double-entry accounting system (no joke). The last time I did a
proper budget it was with Apple Numbers, which was not very satisfying.

------
FroshKiller
This project is very interesting to me. I work for a company that develops a
SaaS accounting solution, and I've wanted to work on a CLI suite for posting
and auditing tools.

------
kinleyd
Ledger has been on my TBD list for a while. Been meaning to implement a
project with it. Now may be a good time.

------
cheez
John Wiegly is an amazing, prolific and intelligent programmer. Very
inspiring.

------
mrbill
Been using this for over a year, since the last time I saw it on HN...

~~~
bennylope
Would love to hear how you like it, as well as what you previously were using
(or would be using instead).

------
dragonwriter
Ledger is awesome, but hardly new...What's the news here?

~~~
ams6110
Agree, but I think it's ok if cool stuff is posted again every so often. There
are always people who didn't see it last time around.

It's funny, I found ledger to be WAY easier to learn and use than QuickBooks,
which just completely baffled me. Yet QuickBooks is the leading system for
small business.

~~~
mercurial
I haven't used QuickBooks, but I think most people would stop at "open the
terminal". Probably even my partner, and she is running Debian. That said, it
turns out that a flexible custom text file format, combined with well thought-
out concepts and powerful commands, blows out of the water most widget-heavy
UIs in terms of ease of use. It's unfortunate that more people don't realize
it.

Of course, the stellar documentation helps too.

~~~
dragonwriter
> That said, it turns out that a flexible custom text file format, combined
> with well thought-out concepts and powerful commands, blows out of the water
> most widget-heavy UIs in terms of ease of use. It's unfortunate that more
> people don't realize it.

I think more people "don't realize it" because "ease of use" is subjective
rather than objective, and for many people, a custom text file format, even
combined with well-thought out concepts and powerful commands, _doesn 't_ blow
widget-heavy UIs out of the water.

