56 KiB
% Plain Text Accounting, a guide to Ledger and friends
<style> body { /* background-color:#fdd;*/ } .columns { margin-left:0 !important; margin-right:4%; } h1 { text-align:center; margin-top:10%; margin-bottom:5%; } h2 { } h3 { font-weight:normal; } h4 { } h5 { font-size:1.2em; } .faq h5 { /* questions */ font-weight:bold; margin-bottom:0; } #intro { font-size:1.2em; } #sitemapheading { font-size:4.2rem; /* font-weight:bold; */ } #section1 { /* background-color:#fff; */ /* these need to be full width */ } #section2 { /* background-color:#eee; */ } #section3 { /* background-color:#ddd; */ } #section4 { /* background-color:#ccc; */ } #section5 { /* background-color:#bbb; */ } #section6 { /* background-color:#aaa; */ } </style>plain text accounting
Plain text accounting means doing accounting with plain text data formats and scriptable software, in the style of Ledger, hledger, beancount, and co. This site collects FAQs and a directory for the PTA community's tools, docs and practices. It is maintained by Simon Michael (hledger project leader, Ledger contributor, PTA researcher & fan), and contributors like you. Got feedback ? Join us in #plaintextaccounting or send an edit.
FAQ
(A work in progress; improvements always welcome.)
What and why
What is Accounting, and what can it do for me?
Accounting is tracking the flow of valuable commodities, such as money or time. It clarifies activity, priorities, obligations, opportunities. It can reduce stress and even be enjoyable.
What is Plain Text Accounting?
In 2003, John Wiegley invented Ledger: a command-line reporting tool and a plain text data format for efficient double-entry-style accounting. Ledger's ideas appealed to many software developers and technical folk. In 2007 and 2008 it was joined by hledger and Beancount respectively, and as of 2019 there are more than a dozen Ledger-likes, many add-on tools and an active community. This site was started in 2016 to help keep track of it all.
What is double-entry?
Double-entry bookkeeping is a process for keeping accounting records reliably. For every movement of value (a transaction), both the source and destination are recorded. Simple arithmetic invariants help prevent errors.
Value at any point in time is tracked in various accounts, classified as asset (owned), liability (owed) or equity (invested). Two more classifications track changes during some period: revenues (inflows) and expenses (outflows).
Transactions consist of debits (increases to asset or expense accounts, or decreases to liability or equity accounts) or credits (decreases to asset or expense accounts, or increases to liability or equity accounts).
What are some characteristics of Plain Text Accounting ?
Accounting data is valuable; we want to know that it will be accessible for ever - even without software. We want to know when it changes, and revision-control it. We want to search and manipulate it efficiently. So, we store it as human-readable plain text.
We simplify debits and credits by using signed numbers - positive for inflows to an account, negative for outflows from an account.
We define arbitrary account hierarchy to suit our needs. This scales smoothly from simple to complex scenarios, and from high-level overview to fine detail.
Ledger-likes are, at least in part, command-line tools. This makes them efficient to use and very scriptable and flexible.
Ledger-likes also, at their core, tend towards functional operation: they read the input data without changing it, and output a report. This simple model makes them easy to understand and rely on.
Who is using this, and how?
Who's using Ledger? has some stories.
Is it a good fit for me?
If you would like to use a GUI that provides lots of guidance, PTA tools currently don't meet that need. Most current PTA users tend to be comfortable using the command line, editing plain text, and perhaps using version control.
What are the alternatives?
Traditional GUI-centric accounting software:
Free/open-source: GNUCash, Grisbi, KMyMoney..
Commercial: Quicken, Quickbooks, You Need A Budget..
Online/cloud-based accounting software: Xero, FreeAgent..
Here is Wikipedia's Comparison of accounting software. Also:
- spreadsheets
- keeping accounts on paper
- using a bookkeeper/accountant.
What are the advantages over traditional (Free/open-source) accounting software, like GnuCash?
Some key factors:
a. The plain text, human readable, well supported data formats.
b. The division of concerns between creating and managing the data (your responsibility) and analysing it (the tool's responsibility). Ie "immutable data" + "referentially transparent reporting tools".
c. The command-line interface.
d. The ecosystem of related tools.
create synergies such as:
1. The data is more future proof. You can access it relatively easily with different software, newly-written software, or no software.
2. The command-line based UI, together with the plain text format, allows easy integration with other software, custom workflows and automation.
3. The user's responsibilities and mental model feel simpler, ie: "I just need to keep a list of transactions". Complex features and tools are not visible until you need them. Common actions can be easily scripted for daily use.
4. The data can be managed using the rich ecosystem of tools for managing text. This is appealing to folks familiar with such tools.
5. Most significantly, the data can be effectively version controlled, providing an audit trail, unlimited "undo", and collaboration.
6. Because the software (mostly) does not touch your data, and because version control would let you know and roll back if it did, you can have great confidence in the integrity of your data. If the software misbehaves, your data is not at risk. It's safe and relaxing to try out new features or new software on your data.
7. The data/tool separation facilitates decentralised development, stimulating an ecosystem of more tools and integrations.
8. The free form DSL-style format provides great expressiveness for modelling and documenting real-world financial activities, without UI-imposed limitations.
Why are the advantages over commercial accounting software, like QuickBooks?
In addition to the advantages above, being Free or Open Source software helps ensure:
- No lockin - your data remains accessible, and there are no yearly fees.
- You can fix, enhance and port the software.
- The software is more portable, scriptable, and lightweight.
Where can I read more discussion of this approach ?
- The Surprising Ease of Plain Text Accounting
- Articles linked below...
- ...
Objections and Concerns
Isn't personal accounting a waste of time?
People have very different needs and practise personal accounting for many different reasons. There is of course a point of diminishing returns; tailor your accounting practices to your needs. Needs change over time. Some of us would benefit from doing more (or better) accounting, some less (I would guess this second group is smaller). In The Millionaire Next Door (highly recommended), one research finding was that above-average wealth accumulators spend more time on financial planning, which for many of us requires accounting as a foundation. "Minimal time dedicated to financial planning is a leading indicator of a UAW [Under Accumulator of Wealth]".
Must I edit text and type cryptic commands?
Not entirely! "Plain Text Accounting" is a broad description, referring mainly to the data format. We welcome optional GUIs, and they are coming.
Do you really enter every little transaction?
Yes! Many folks in our community do it. Mahatma Gandhi reconciled to the penny every night. J.D. Rockefeller was famous for his ledgers. It's not required. I started doing it as a temporary learning exercise, and still like it. It makes troubleshooting and reconciling easier.
How is that possible?
Practice, and a process/toolset that suits you. Some folks import most of the data from their banks, so little manual data entry is required. A few prefer to manually enter everything, for the increased awareness and insight. "Manual" data entry is usually assisted in some way: interactive console tools (hledger add and similar), web-based tools (hledger-web and similar), GUI tools (ledgerhelpers), smart editors (eg emacs & ledger-mode), recurring transaction scripts. I currently use a mixture of bank CSV import and rapid copy/paste in emacs. I spend 15 minutes a day on average, and for me that's currently a good investment.
How do I use the transaction data in my bank's web or mobile app?
If you can export it as CSV, you can import it and run queries against it. There are also some tools for converting OFX, QIF etc.
So I've got a huge list of transactions recorded, duplicating my bank statements. How does that help?
Accounting is modelling flows of money (or other value). Such a model aggregates information from many sources, in one trusted place. With it you can efficiently generate reports, forecast things (cashflow!), answer questions, try experiments. Some people need a very simple model, others benefit from a more detailed one, and we don't know up front what we might need in future. The most fundamental accounting data is a simple list of transactions (the journal). Once you have captured this, you can mine it for anything you may want later on. Plain text accounting provides nice open data format(s), tools and practices for doing this, and could be a good foundation for more powerful tools.
Isn't a command-line tool too limited for real-world accounting needs?
"I am sure for a simple expense/budget ledger it will work OK, but when it comes to recurring journals, multiple reconciliation accounts, inter company transfers, control account tracing etc., give me a nice GUI any day..."
Understandable. The current plain text accounting tools provide a very generic double entry accounting system with which you can model such things, and script them.
There are a number of generic GUIs available (hledger has curses and web interfaces, and there are web/curses/GTK interfaces for Ledger and beancount). But there are not yet a lot of rich task-specific GUIs. There's no reason they can't be built, though.
Isn't a plain text format too limited for large organizations?
"it's pretty obvious that plain-text files don't scale to a multinational, with hundreds of accountants of various types all trying to work with the same files. Even with proper use of Git I bet that would get old fast. You would instead want a real database, with a schema, and some data validation and some programs/webpages to smooth out the data entry and querying and whatnot."
I'm not sure. Current plain text accounting tools can do some schema definition and data validation, and will do more in future. The plain text storage format is open, human-readable, future-proof (useful even without the software), scales smoothly from simple to complex needs, and taps a huge ecosystem of highly useful tooling, such as version control systems. And, despite the name, there's no reason these tools can't support other kinds of storage, such as a database.
If this is double entry accounting, where are the debits and credits?
Most (not all) plain text accounting implementations use signed amounts instead of debits and credits. This makes them "double entry light" perhaps, but it has been a rather successful simplification, intuitive to most newcomers.
How do I communicate with my accountant?
Clean up text reports by hand, print them as PDF, export CSV reports to a spreadsheet..
What if my accountant only uses QuickBooks?
You'll need a new accountant, or a duplicate set of books in QuickBooks, or to pioneer *ledger -> QuickBooks exporting.
Can I use this to do my taxes?
You can use this to track and report the data needed for tax reporting. Fill out and submit tax forms with another tool, or by hand.
Getting started, Practicalities
Where can I see a comparison of hledger, Ledger, beancount, and the rest?
Glad you asked! See below, and also comparisons. hledger's FAQ discusses differences from Ledger, Beancount docs probably do too.
How to organise files ? Should I split the journal into many files ?
All in one file (or one file per year) and ordered by date is simplest and creates the fewest headaches (balance assertions/assignments, scope of directives, where to put entries, finding things..).
If you use emacs: it’s possible to insert org headings (which are comments to h/ledger) and then use org-mode or org-minor-mode to collapse/expand/navigate sections of your journal.
Also in emacs: in ledger-mode, C-c C-f can give you a filtered view of just one account’s transactions. (But be careful, if you edit in the wrong place it will lose data.)
https://www.reddit.com/r/plaintextaccounting/comments/d69slp/how_do_you_manage_multiple_accounts_in/
How big is your ledger/journal file ?
For individual accounting, somewhere between 500-1500 transactions and 100-400K of journal per year seems typical.
https://www.reddit.com/r/plaintextaccounting/comments/dbjizl/how_big_is_your_ledgerjournal_file/
How do I do budgeting?
See budgeting below. I emulate YNAB-ish envelope budgetting (see third link).
news/discussion
#plaintextaccounting, #ledgercli, #hledger, #beancount, @LedgerTips
software
plain text accounting apps
| Project | Start | Last release | Code | Committers | Stars | Mail list, size | Chat, size |
|---|---|---|---|---|---|---|---|
| Ledger | 2003 | 2019-03 | C++ | 160 | 2994 | ledger, 922 | #ledger, 70 |
| hledger | 2007 | 2019-09 | haskell | 110 | 1226 | hledger, 151 | #hledger, 70 |
| Beancount | 2008 | 2019-01 | python | 40 | beancount, 261 | #beancount, 20 | |
| Abandon | 2013 | 2017-05 | scala | 9 | 132 | gitter | |
| Transity | 2018 | 2018-09 | purescript | 5 | 382 | gitter | |
| Ledger in Go | 2013 | 2018-06 | go | 5 | 168 | ||
| cl-ledger | 2007 | common lisp | 4 | 50 | |||
| .Net Ledger | 2017 | 2018-08 | C# | 1 | 29 | gitter | |
| Tackler | 2017 | 2019-04 | scala | 1 | 18 | gitter | |
| beans | 2017 | 2019-01 | haskell | 1 | 10 | ||
| monescript | 2017 | 2018-01 | javascript | 1 | 3 | ||
| Prudent | 2018 | javascript (addons) | 1 | @PrudentLedger | |||
| goledger | 2019 | 2019-09 | go | 1 | |||
| Inactive: | |||||||
| uledger | 2015 | python | |||||
| pacioli | 2013 | python | |||||
| ledger.pl | 2013 | perl | |||||
| Penny | 2012 | 2014 | haskell | ||||
| UMM | 2009 | 2010 | haskell | ||||
| sm-Ledger | 2007 | squeak smalltalk |
Next, related add-ons and helpers by category
(note: *ledger below means Ledger and hledger-style journal format):
data import/conversion
- Ledger and hledger have CSV conversion built in. Also:
- bean-identify, bean-extract, bean-file - Beancount built-in tools
- banks2ledger - CSV to *ledger converter
- beancount-import web app/framework for converting various formats to beancount (python)
- beancount-ynab You Need A Budget to beancount converter
- buchhaltung CSV/FinTS/HBCI/OFX to *ledger conversion/deduplication (haskell)
- csv2beancount CSV to beancount converter (clojure)
- CSV2Ledger CSV to *ledger converter (perl)
- gcash2ledger.py GNUCash XML to *ledger converter (python)
- gnucash-to-beancount GNUCash sqlite to beancount converter (python)
- gnucash2ledger.py GNUCash sqlite to *ledger converter (python)
- grisbi2Ledger Grisbi to *ledger converter
- hledger-import-dsl alternate, programmable CSV converter for hledger
- hledger-to-influxdb hledger to InfluxDB converter (haskell)
- homebank2ledger HomeBank to ledger and beancount converter (perl)
- icsvledger interactive CSV to *ledger converter (python)
- into-ledger CSV to *ledger converter
- Ledger in Go has limport, a CSV to *ledger converter
- ledger-autosync OFX download, OFX to *ledger conversion, deduplication
- ledger-guesser neural network for generating entries like past ones, can be used with ledger-autosync (javascript)
- ledger-myexpenses MyExpenses android app sqlite db to *ledger conversion (python)
- ledger-reconciler automatically download and reconcile your ledger financial entries
- ledger-to-beancount yet another simple ledger to beancount converter (python)
- ledger-tutorials convert Pete Keen's tutorials to ebook format
- ledger2beancount.py *ledger to beancount converter
- ledger2beancount ledger to beancount converter
- outofit QuickBooks to *ledger converter
- piecash GNUCash SQL to *ledger converter (python)
- plaid2qif Download transactions from plaid as QIF or CSV files
- plaid2text Plaid API to *ledger/beancount download/conversion
- qb2ledger QuickBooks General Journal CSV to *ledger converter
- QIFtoLedger (Bank of America's) QIF to *ledger converter
- reckon smart interactive/non-interactive CSV to *ledger converter
- smart_importer library for building smarter CSV to beancount/Fava converters
- total_recall CSV to *ledger converter
- ynab-to-ledger You Need A Budget (YNAB) to *ledger converter. Handles multiple currencies, multiple number formats, reconciliation, memos, transfers, and split transactions
- ynab_to_ledger You Need A Budget to *ledger converter
- Costflow convert one line message to beancount/*ledger format
- Go Ledger parser a parser and ledgerfmt, ledger2json, json2ledger tools (go)
data generation
- beancount-extract-price generate prices transactions based on your beancount ledger (python)
- bean-price Beancount's price fetching tool (python)
- DepreciateForLedger generate *ledger depreciation transactions (python)
- hledger-interest generate *ledger interest entries (haskell)
- ledger-get-prices download market prices (ruby)
- ledgerbil schedule recurring txns, interactive reconcile, date sorting
- LedgerScheduler move entries from one file to another when they come due (python)
- market-prices download market prices from several sources (python)
- recurring generate recurring *ledger entries (python)
- sassetti adds lisp macros to ledger files (common lisp)
reports
- hledger-diff report differing transactions between two journals (haskell)
- hledger-irr calculate an account's internal rate of return (superseded by roi) (haskell)
- ledger-plot interactive tool for making GNUplot charts from Ledger (python)
- ledger-plots R package & script to make charts from Ledger (R)
- r-ledger an R package for reading and reporting on ledger/hledger/beancount files (R)
- TaxingLots calculates capital gains for a ledger journal (python)
time logging
- org2tc org to timeclock converter
- on-modify.timetrack.py taskwarrior hook for timeclock output
- t ledger timeclock shellscript
- tim time logging and reporting tool using hledger
UI, console
- bean-add interactive transaction entry tool (python)
- hledger add interactive transaction entry tool (builtin command)
- ladd create and edit a new *ledger transaction by fuzzy-matching past descriptions
- ldgr command line tool to add/sort/tag ledger files (ruby)
- ledger xact history-aware transaction generator (builtin command)
UI, curses
- hledger-iadd TUI for *ledger transaction entry (haskell)
- hledger-ui TUI for *ledger browsing (haskell, video)
- ledger-add TUI for *ledger transaction entry (python)
- regdel TUI for browsing Ledger files (python)
UI, GUI
- ledgerhelpers misc. GUI tools + helper library (Python, GTK)
- Prudent integrated journal editing/importing/reporting GUI for Ledger (Javascript, mac only, closed source)
UI, web
- fava web UI for beancount browsing (python, demo)
- hledger-web web UI for *ledger browsing, data entry (haskell, demo, Sandstorm app)
- Ledger in Go web UI for browsing ledger transactions, reports, and porfolios
- Ledger Web ledger HTML reporting system (ruby, postgres)
- Ledger Web web UI/API for ledger browsing, data entry (python)
- ledger-analytics web UI for ledger data analytics (javascript)
- ledger-dashboard web UI for ledger browsing, data entry (python)
- ledgible web UI for ledger browsing, data entry (python)
- node-ledger-web web UI for ledger browsing (javascript)
- WealthPulse web UI for ledger browsing, price fetching (F#)
UI, mobile
- beancount-mobile data entry app for beancount (Android, javascript)
- cashier mobile or desktop client for ledger and hledger-web (Android/Desktop, javascript, app)
- cone data entry app for the h/ledger format (Android, dart)
- MoLe mobile client for hledger-web (Android, java)
API
- hledger-api JSON API server for *ledger files (retired, use hledger-web instead) (haskell)
- ledgerhelpers extends Ledger's python library (python)
- node-hledger Node.js API for *ledger files (javascript)
editor support
Editor plugins. Note these often work quite well for other ledger-likes, not just the one they are named for.
beancount-mode, hledger-mode, ledger-mode (also works for hledger, beancount etc.)
vim-ledger (supports ledger & hledger), vim-beancount, hledger-vim
docs
general accounting
plain text accounting
- Ledger manuals
- Ledger wiki
- Ledger CLI cheatsheet
- Getting Started With Ledger
- hledger docs
- Beancount docs (google) / (sphinx)
- Beancount: Command-line Accounting in Context
- Beancount: Syntax Cheatsheet
- Program your Finances: Command-line Accounting
- Don’t Sink Your First Attempts at Plaintext Accounting
- Syntax Quick Reference for the Ledger-Likes
comparisons
- Matthias Kauer: Command Line Accounting – A look at the various ledger ports 2015
- Another Ledger user's perspective 2015
- Beancount: A Comparison of Beancount and Ledger 2014
- ledger vs hledger vs beancount or how to choose the right cli client 2014
- hledger: hledger & Ledger 2014, 2019
- Omari Norman: Why Penny 2013
presentations
- Andreas Pauley: Purely Functional Personal Finance 2018
- Ledger CLI Accounting for Geeks 2014
- Hacking Your Finances for Fun and Profit 2013
- Ledger and Text based Accounting 2009
videos
- hledger fan youtube channel (short lessons) 2019
- Quiliro Ordóñez: ledger-mode lightning talk 2019
- Colin Dean: Plaintext Accounting with the ledger ecosystem 2017
- Colin Dean: Plain Text Accounting 2017
- Simon Michael: Hands-on with hledger 2016
- Austin Walker: Conquering Your Finances with Emacs and Ledger 2016
- FLOSS Weekly 375: hledger (youtube, 3m overview) 2016
- Evolution of ledger 2015
- Evolution of hledger 2015
- FLOSS Weekly 150: Ledger (youtube) 2011
- Accounting course by Prof. Krug 2011
- Khan Academy: Accounting and financial statements
- David Mitchell: Personal Debts
articles & blog posts
- Skip Oliva: Accounting in Plain Text, Part 1 2019
- John Sullivan: Answering questions with accounting: Reimbursements 2019
- Michael Walker: Personal Finance 2018-2019
- Felix Crux: Ledger Practices series 2016-2018
- Zoran Zaric: Depreciation in Personal Finance with Hledger 2018
- Zoran Zaric: Tracking Investments in Lots with Hledger 2018
- LWN: Counting beans - and more - with Beancount 2018
- Michael Walker: I Need A Budget 2017
- Accounting for the simple minds with plain text accounting 2017
- LWN: Restarting the free accounting search 2017
- Michael Walker: Visualise your finances with hledger, InfluxDB, and Grafana 2017
- Brady Trainor: Hledger web 2017
- Karan Ahuja: Hledger Improvements Wishlist. 2016
- Alex Johnstone: Managing my personal finances with beancount 2016
- Stefano Rodighiero: hledger-dupes 2015
- Matthew Turland: Ledger basics and habits 2014
- Simon Michael: What is hledger? 2013
- Simon Michael: More on ledger 2013
- Simon Michael: Introducing hledger! 2013
- Joey Hess: hledger 2012
- Gene Goykhman: An Alternative to QuickBooks 2012
- LWN: The accounting quest: Ledger 2012
- Pete Keen: Program your Finances series 2010-2012
- Clint Adams: Accounting at SFLC 2011
- Sascha Welter: Doing my own accounting 2011
- Christine Spang: [h]ledger rocks my world 2010
- советы: Ledger — бухучёт в командной строке (english) 2009
- Joe Barr: Ledger, the bran muffin of accounting tools 2006
common tasks
choosing accounts
- sample chart of accounts for a freelancer
- Beancount Cookbook: Account Naming Conventions
- Mint: Ways to Categorize Your Spending
- Simplified version of double-entry bookkeeping for personal and business finance?
choosing cash vs accrual
entering data
- hledger Basics tutorial: Record a transaction with “hledger add”
- ledger-mode:
C-c C-aadd a transaction,
C-c C-bamount calculator,
C-c C-c/C-c C-etoggle cleared - Beancount: Command Line Accounting Cookbook
- Accounting bookkeeping entries
- ledger-envelope-generator.rb
- Ledger Practices: Separate Your Journals
- UI tools
importing
- Ledger: The convert command
- hledger: CSV format
- hledger: Convert CSV files
- Beancount: Importing External Data in Beancount
- Beancount: Prices in Beancount
- Payment matching done right
- "Full-fledged hledger" tutorial
- "Hledger Flow" tutorial/slideshow
- import tools
reconciling
- ledger-mode:
C-c C-r - How to use ledger(1) to reconcile your chequebook with your bank statement
- How to use ledger(1) to reconcile your payments with your payment processor
reporting
- example queries for Beancount
- hledger Cookbook: Rewrite account names
- Report Scripts for Ledger CLI with Gnuplot
- Full-fledged hledger tutorial
- Ledger Practices: Reporting Special Events Separately From Regular Spending
- Program your Finances: Reporting for Fun and Profit
- Pete Keen: A Robust Reporting System for Ledger 2012
budgeting
Budget reporting with Ledger's/hledger's periodic transactions:
Envelope budgeting with ordinary accounts:
Envelope budgeting with Ledger's automated postings:
- bsilvereagle: Envelope Budgeting with ledger
- Program Your Finances: Envelope Budgeting
- Marcin Borkowski: Ledger – virtual postings aka envelopes
Envelope budgeting with automated postings, org & babel:
- Org tutorials: Weaving a budget with Org & ledger
- Alan Schmitt: Using Org for Ledger Reports and Budget
forecasting
invoicing
multiple currencies
- Peter Selinger: Tutorial on multiple currency accounting
- ledger-currencies tutorial
- Understanding the valuation function and the market function
trip expenses
shared expenses
- Beancount: Sharing Expenses in Beancount
- Keeping (financial) score with Ledger
- Program Your Finances: Automated Transactions
- How to keep control of shared expenses inside marriage?
- How to use ledger(1) to split shared expenses
- Ledger Practices: Tracking Accounts Jointly and Separately
taxes
time tracking
- Ledger: Time Keeping
- hledger: Timeclock files
- hledger: Timedot files
- Timetracking and billing with (h)ledger
- time tracking tools
inventory tracking
non-profit accounting
exporting
customising
API access
- Ledger: Extending with Python
- Ledger Python 3 Support Python
- ledgerhelpers Python
- hledger-lib, hledger, an example
- hledger-web: JSON API
- node-hledger JavaScript
\(c) 2016-2019 [Simon Michael](http://joyful.com) & contributors | Send updates via [github](https://github.com/plaintextaccounting/plaintextaccounting.github.io) ([latest changes](https://github.com/plaintextaccounting/plaintextaccounting.github.io/commits/master))