Plain Text Accounting
plaintextaccounting.org
plaintextaccounting.org
But almost more importantly: if you're a programmer, it's really very fun! Like, i have my own system where I download my bank statement as a CSV and process it in AWK together with an org-mode table of payees that map each line on the bank statement to an account, which then generates a ledger file. Since it's just you using it, you can make it so it works however you like, and it quite satisfying to see it all come together.
It's also a great way to learn about accounting. Turns out, I really kinda like accounting! It has many of the same pleasures of programming or math, and seeing everything balance is very satisfying. In short: if you're a programmer who feels like they haven't quite got a handle on their finances, I can't recommend plain text accounting highly enough.
The moment I start talking in terms of liabilities, virtual accounts, etc. their eyes light up!
Incidentally, Accounting and Software have a lot in common. They both build and apply abstractions to the "real world" (flipping-bits), in order to give the abstraction-wielder more power and insight.
Can you expand on this slightly? One of my frustrations with personal finance tools that I have tried in the past is that they're really bad at modelling occasional expenses— for example as a low-car family, we only fuel our vehicle once every 4-5 weeks, so some months the "gas budget" goes unused, whereas other months if we take a trip, we'll completely blow the gas budget because we fuel up twice or three times.
I wish it were possible to "smooth" those kinds of expenses into an average daily amount, but also have a way of indicating that a particular chunk of them should actually be extracted from the smoothing and assigned to a different category altogether (eg, the gas used on the trip should go to "vacations", not "vehicle"). A similar thing applies with other bursty things like home repair expenses, where I'd like my Home Depot receipts amortized over a time period that I specify rather than counted right at the moment of purchase.
I also run a janky Python script which imports my various .csv files, detects which is which, and turns them into ledger entries.
So a vacation stop at a gas station would look like this:
2021-01-01 Chevron
Assets:Checking $-100.00
Expenses:Auto:Gas
So lets say I know I spent $40 of that on food, and want to put another $40 into the vacation budget, I modify like so: 2021-01-01 Chevron
Assets:Checking $-100.00
Expenses:Food $40
Expenses:Vacation $40
Expenses:Auto:Gas
And it puts the rest in the gas budget.There are ways to report average expenditures and smooth them out, ways to report how many days between each purchase in a particular category or from a particular merchant, and so on. Want to amortize a particular purchase? No problem, it's a periodic transaction.
ledger-cli can do accounting, really if there's a question about your money or a way you want to keep track of it, it's covered. Several graph libraries can ingest ledger files.
I use YNAB for budgeting and they basically advise what you're requesting - figure out what the "average" is over a given period of time and just budget that amount. Say you contribute $200/mo to an all-encompassing gifts budget, you may only pull from it a few times a year but the money is already earmarked.
Amortizing things doesn't make sense for a home budget - the whole point is to know whether or not you have enough money for x.
I would say it's very hard to budget for bursty things on a monthly cadence. You can have a "virtual account" for this stuff, that fills on months with little activity and drains on months with more activity. But this is kind of complicated and might not be worth it.
I'd try answering the question: what is your goal in budgeting for gas, for example? Is it to keep gas spending under control? Or to understand how much you spend on gas? And if you want to understand, why? Budgeting is a solution to some answers to these questions, but not all of them.
Personally, I find it more useful to track these things, than to budget them, if that makes sense.
For example, I want to know how much I spent on rental cars in 2020, because that impacts our decision to lease a car in 2021.
> a way of indicating that a particular chunk of them should actually be extracted from the smoothing and assigned to a different category altogether
In GNU Ledger, you can apply arbitrary categories to each expense, and you can also "tag" line-items. For example, if you think 80% of your last refill was from a trip, you can do as follows:
20201/01/12 * Chevron
Expenses:Travel:Car:Gas $16.00 ; :vacation:
Expenses:Travel:Car:Gas $4.00 ; :commuting:
Liabilities:CreditCards:AppleCard $-20.00
You can then do queries to see which of your gas came from commuting, and which came from vacation.You can remove vacation from your reports altogether, and you can also focus exclusively on each vacation. You can even tag vacations, if you so choose.
; :vacation:lasvegas2021:
> amortized over a time period that I specify rather than counted right at the moment of purchaseYou can achieve this behavior by specifying "effective dates" for certain purchases.
For example, when I buy plane tickets, I like to amortize the cost of that ticket over each day I'm at my destination (similar to your home depot example).
2020/01/11 * American Airlines
; three-day trip to Colorado
Expenses:Travel:Plane $80.00 ; [=2020/02/01]
Expenses:Travel:Plane $80.00 ; [=2020/02/02]
Expenses:Travel:Plane $80.00 ; [=2020/02/03]
Liabilities:CreditCards:Apple $240.00
The dates in the comment are called "Effective dates". You can ask for reports to be presented with either effective dates or transaction dates, at query-time. Note that the credit card payment's effective date is identical to the transaction date.Let me know if you have any further questions! It's a fun topic.
However, reporting average expenses is easy, and sometimes enough..
I’ll add that it’s also delightfully easy to get started.
As an application, Accounting is kind of like Vim or Excel or other tools with steep learning curves and nirvana at the end of them.
You can start by just tracking one bank account by hand which is easy enough and fun, because you’re still learning how this accounting thing works.
Pretty soon you’ll be tracking your investments, ISOs, taxes, credit card points, and so on as absurdum. You’ll be the person who finds the bug in your employer’s W-2 generator...
It’s a steep time investment, but once you’ve written the automations, it’ll take you maybe 30 minutes each month. And you’ll never experience the feeling of “not being in control” of your finances again.
Some investment brokers will only give you PDFs with tables in them. But there are some pretty amazing libraries for converting these into CSVs, that have worked well for me.
Some people use plaid, but I didn’t like the idea of introducing a middleman-dependency.
What I’ve been doing over time is downloading all of the raw transaction history I can get, and storing it in a git repo. Each month when I “top it off”, I just use git add -p to add only the latest bits. The most annoying part is when they change their CSV format on you (Chase did this recently) and you need to reformat all of your historical data to match.
Now I have a Postfix server setup which accepts the daily transaction summaries they send and makes CSVs out of those. There's still some HTML munging involved but I've found it much easier to let the data come to me than to go out and try to fetch it myself. In my experience financial institutions simply don't have a lot of reliable automation options accessible to the normal consumer.
There's an Open Financial Exchange (OFX) standard that's supposed to be for this, I think. I came across it when someone mentioned the ledger-autosync [1] tool that tries to use it to get your data from your bank automatically. If I understand correctly (no guarantee on that), this automation would work for institutions listed here [2].
[1] https://github.com/egh/ledger-autosync [2] http://www.ofxhome.com/index.php/home/directory/successfulRe...
The submitted page links back to a previous discussion on HN:
https://news.ycombinator.com/item?id=12119050
Funny enough the top comment on that discussion concludes:
> I now focus my efforts on income expansion rather than cost control. Some of you may say, recording costs is not controlling it. In that case, I find accounting, even less useful (once I have arrived at approximate cash outflow). Income expansion, puts me in a different frame, which I find strangely empowering. Even more so than the satisfaction that comes from having controlled costs.
Previous HN submission : https://news.ycombinator.com/item?id=2298471
For me, the most meaningful info is a markdown doc where I quarterly asses all of my investment accounts / assets and come to a "current net worth total".
I've found a personal correlation between trying to minimize and track minuscule expenses and a decline in my mental health or happiness at work. I'm frugal by nature and trust myself enough to not worry too much about day to day spending.
Aside from some fairly basic goal tracking, boring boglehead investing, and making sure nothing stupid is being transacted, I really don't do a lot and everything seems to be working. Dont @ me about my warhammer addiction though...
* Tracking the cost basis of your capital assets
* Tracking fees related to transactions involving capital assets
* Calculating taxes
* Analyzing allocation of capital assets into categories
* Tracking drift from a target
I'm not going to adjust tens of thousands of dollars of capital assets because the management fee moved 0.05%... Who do you think I am, Elon Musk? I'm glad you enjoy using your time to do track these kind of things, but I gladly choose not to learn my accountant's job.
If you're paying an accountant only for taxes, and not general finances, chances are your financial life and investments are very simple. Either that or you're not managing them well :-)
Some people have multiple investments - some liquid (stocks), some illiquid (properties). They have side businesses (e.g. rental income). They have to allocate money for repairs on their rental properties. They have to set money aside for vacancies and property taxes, etc. You're likely not going to find an accountant who'll do this for a mere $400/yr.
If you have rental income and are not managing this, sooner or later you'll lose a lot of money. I guarantee it. Also, most people who have properties do not make that much net profit (typical is $100-200/month per unit), so paying, say, $2000 to an accountant could wipe away the net profit from one unit for a whole year.
No one is trying to tell you that you should use these tools. Many high income folks do fine without them. But if you have side businesses, you either need to spend a lot more on an accountant or get more disciplined. Most people will choose the former if they can afford it (which is probably a good idea).
Fair enough. If your expenses are at the level of mine, I'd gladly take your $3500/year to do it for you. :-)
And given that several commenters have said they spend about an hour a month on it, after all automation is in place, I'm sure many would take that money from you. It comes to about $300/hour. Certainly some people are earning a lot more than I am, and paying $300/hour is worth it to them.
I'm not a hard core ledger user, but I have a simple solution: I don't enter anything into a text editor. I enter it into a fairly nice money management SW (using a GUI), that autofills a lot of stuff for me, and lets me import from my bank/CC. And then I simply run a script to convert its data format to ledger. I'm sure I spend more than an hour a month, though. I haven't automated most of my data sources.
What's there to track, how much you've spent on potatoes and underwear this month versus the previous?
That was the scenario for a disciplined citizen. Most just pay the bills (not necessary all of them) and then just spend what's left on their debit card until there's nothing left. It usually happens before the next salary, of course. No accounting software would help there.
UPD: I'm not sure it was the right place to spill my negativity, I fully understand the benefits of being organized with your finances.
But:
1) Once you've automated most the of the steps, it takes, say, 1h per month to have everything up to date, so basically nothing.
2) Compared to no tracking, you can often end up finding money another party owes you. At that point, the 1h per month is financially worth it.
3) How little can you spend if times are tough? Any theoretical budget will pale in comparison with actual tracking of past expenses. Once you know this, you know how many months of spending you have in cash, meaning you can invest the rest in the long-term.
4) How much will you spend in 5 / 10 / 20 years? Why? You can better estimate this with accounting.
5) Let's say you spend $x on hobby A and $y on activity B. Does that reflect how much you like A and B? If not, maybe change it?
*: still... how diminished is your salary if you start a job that requires that you wear a suit everyday? Is it still better than the other offer you rejected? Maybe you made a mistake? This is way
It's also a single source of truth for your entire financial existence. You can use it to track your asset allocation. Which some people in the bracket you describe care a lot about.
Of course, you can pay people to do all of this stuff for you. (Accountant, Investment Broker, etc). But there are well-documented costs to these solutions. Basically, you have to trust them a lot, and if you don't speak their language you can't verify their choices.
Edit: to be clear, I'm not saying that maintaining a ledger is the right choice for everyone. It's a trade-off, like anything else, I just wanted to explicitly observe the variables that were at play in my decision. YMMV
that was it for me! i started using hledger because of:
- tracking irregular payments from a bunch of sources, often outstanding for a while
- tracking how much somebody owes me / i owe them
- being pretty much cash-only for a long while (long story). with cash, if you don't track the expenses manually, you wake up at the end of the month with a whole bunch of money gone and no idea what happened to it
- not knowing how much money i actually have available because it's spread across my wallet / bank account / paypal / piggy bank
hledger really helped me not go crazy with all of this!
PS. another unexpected benefit - tracking expenses can also help with ambient worries like "ugh i spend too much on takeout food". like, if you track it, at the end of the month you can look at how much you spent on it and conclude that it's actually reasonable (within your budget) and stop feeling guilty about it!
Inspired by your example, here's our rolling monthly sums of food expenses, COVID marked [1].
You can see where we moved (temporarily) to a place with lower food costs, and stopped eating out.
But there's also a dip around the holidays, because we spend a lot of that time with family and our food expenses go down proportionally. That dip happens to be consistent YoY, but we don't realize it because we have other things on our mind.
It's just great fun to have this stuff at your fingerprints.
It’s kind of tricky. I have an AWK script that reads a ledger report to compute the X and Y-value pairs. These are written to a temp file that is read by GNUPlot.
It’s a bit of work to get setup, but I’m able to copy paste the idea around my reports.
I’ve also found the GNUPlot manual to be very easy to read!
I’m away from my laptop now, but I’ll add a gist tomorrow.
It probably would have been better done in python (I probably wouldn't have needed the zero-inserting hack), but it works pretty well.
1. Accurate visualization. As you suggest, a great number of people pay most attention to their checking account balance. Making student loan payments on time can feel like just paying 'bills'. But it's actually a split between interest and principal, and in a sense, you are accumulating wealth by paying down principal in a way that just looking at the debit card balance will not. Similarly, racking up CC debt can feel cheap when making minimum payments.
2. Improved forecasting. Before GNUCash I largely worked the same way as you describe. Keeping a mental tally of bills outstanding and checking my balance via the automated phone system to judge what I can spend. Now I have scheduled transactions for those bills recorded 90d in advance, and can see at a glance my Minimum Future Balance. It's nearly the same thing, but with way less acid reflux from stress. And I can schedule in all the random annual expenses -- vehicle registration, vacations (when permitted), annual subscriptions -- just once and the system remembers for me. Plus I have a more granular archive of expenses to estimate and budget around.
3. Expense Analysis. Most people track one asset: checking acct, and maybe liabilities. Double entry accounting makes it feasible to transition from that to treating expenses and income as equally important. Probably the canonical example is car insurance; most insurers offer a six month premium, or a monthly payment with a surcharge. If you focus on checking acct balance, you go for the monthly payment with smaller upfront. If you want to reduce your annual expense you pick the six month option, dipping into savings briefly if required. On the income side, you'd be surprised how many people don't even bother to get the employer 401k match, even though you can often carry a CC balance (a very worst case scenario) and come out ahead.
4. (advanced) Portfolio balancing. If you're fortunate enough to fund a retirement plan, tracking your portfolio and asset allocation can be tricky across Roth IRA, 401k, etc. An annual rebalancing, formalizing the 'sell high, buy low' formula, is equally tricky when none of your accounts synchronize. A double entry system makes this and other retirement planning steps feasible.
1. There are people who like to create complex analysis/structure around their lives. I don't say they are unnecessarily complicating their lives, because that's part of their personality. So, yes, you are correct. An double-entry ledger doesn't add much insights.
2. After $200k/year income and $1m+ wealth, and if your wealth is very diversified (inherently complex), then I can see the value in it. ie: An engineer with $200k has less complexity than a freelance with $200k/year. At a certain point the freelance will benefit from an accountant, but maybe he's running some stuff in the dark economy or something.
Doing detailed accounting helps prevent you from that "go into debt" scenario.
Typical long term things people forget to save for:
- Their next car
- Car Repairs
- House repairs
- New roof for house
Etc.
With detailed accounting, you can set money aside for these things, and then when you suddenly decide to go on a vacation, you know how much money you need to leave aside in your savings to cover the above.
Now, I also have a small LLC. And I used to track my business income/expenses. It's useful, but also, I don't have that much volume to really care about ledger it's just too much work right now. Last year I did taxes with ledger, it was PITA to import everything. This year I just dumped my transactions into google sheets and setup pivot table, which accomplished exactly what I needed for tax return.
If you don't have enough, reduce your expenses, not your savings.
[0] https://www.investopedia.com/terms/p/payyourselffirst.asp
[1] https://www.daveramsey.com/blog/envelope-system-explained
I've automated a few things but it's still largely a manual process to update the file, which I do maybe 2-3 times a month. Requires some patience but I think it's worth it. Also the emacs mode for beancount is superb.
The main advantage is it's very flexible, you can track investments, bank accounts, credit cards, pensions and even abstract things like digital currency wallets (e.g. Playstation Network) or vacation time. I've even used it to track RSUs from employment etc.
e.g. When I do a debit card purchase I move currency from Whatnot:Cheque:Pending to the expense account, then later from Pending to Whatnot:Cheque:Current so for EVERY debit card transaction I'm copy-pasting a template and editing by hand.
Fava/beancount is so good though, that it's a local maximum - I'm a bit stuck.
If you don’t want to do that, another option is hledger. I used that for a while before deciding to switch back to beancount for its ingest process. However, considering I have made no progress on that over the last year, I might just go back to using hledger.
hledger’s ingest process is not as sophisticated as beancount’s. You can’t write arbitrary plugins like with beancount, but you can pattern match on the incoming text and assign accounts that way. You can also define automatic transactions in your books, which I found incredibly helpful for managing my budget.
For example, here is a plugin that I wrote to "delay" a posting of a transaction to another date via an intermediate ("transfer") account [2] and its tests [3] that solves a problem pretty similar to yours (I should someday package my plugins properly and maybe put them on PyPI, but I haven't had the time yet). The beancount documentations also has a list of existing published plugins [4].
[1]: https://beancount.github.io/docs/beancount_scripting_plugins...
[2]: https://linx.marussy.com/selif/v31rtbi5.py
[3]: https://linx.marussy.com/selif/tpwlujdk.py
[4]: https://beancount.github.io/docs/external_contributions.html
[1] https://github.com/redstreet/beancount_reds_plugins/tree/mas...
./purchase 10 AAPL 128.80
I've tried with many accounting apps, but the clarity of the plain text, editing it with my preferred editor, and the capabilities of ledger (reading only!) are what kept me (I think). I also wrote an intro for ledger here [1].
[0] https://www.ledger-cli.org/
[1] https://sirodoht.com/blog/introduction-to-plain-text-account...
> We can neither create money out of thin air, nor make it disappear. Money has to come from somewhere and go somewhere.
reminded me of the excellent "Accounting for Computer Scientists" by Martin Kleppmann [1], with a very useful and easy to remember mental model of this process.
[1] https://martin.kleppmann.com/2011/03/07/accounting-for-compu...
The other "getting started" guide I found [1], for a contrast, starts with a whole ecosystem of scripts and a system in place for effective ledger use - which will be useful later, when I do want to get a full system going, but I've learnt it's better to start simple and stumble around, until I can put together the pieces of the system myself later (with theirs as a very useful reference).
[1] https://rolfschr.github.io/gswl-book/latest.html#the-setup
Otherwise there is a great ecosystem of tools (and I have automated a lot of my own with Python) for parsing, classification, and import of data into the plain text ledgers.
[1] https://github.com/egh/ledger-autosync [2] http://www.ofxhome.com/index.php/home/directory/successfulRe...
Also, we had some CI automations to report company runway to Slack etc
The basic instructions are open account, close account, and update account (transaction). In addition, a lot of PTA tools support some form of higher-order directives: directives that generate other directives.
For example, the availability of prices might trigger the insertion of valuation transactions based on the change of value for a balance position, when processing the balance.
Or declarative accrual transactions for a given date might insert "virtual" transactions at specific other dates.
The PTA / language-centric view allows to reason about those very easily, as abstractions which result in AST rewrites.
I literally opened Notepad.exe, and started making double-entry accounts of all of my expenses.
I broke them down into recurring expenses, surprise expenses, and then discretionary spending.
For each recurring expense, I made its own ledger of dates and the expense. I could then predict my future expenses. Given the current date, and knowing when the money would next be due, I could calculate how much I needed to set aside PER DAY, in order to be ready to meet that expense. Once that critical next date passed, I could achieve a steady state, of how much I needed to set aside PER DAY, for that expense.
I then started doing double-entry accounting on my main, available cash account, on a daily basis, subtracting the recurring expense daily amount each day. So, I had an actual balance, but then I also knew how much was left for my surprise expenses and discretionary spending.
I then went after my surprise expenses, and tried to come up with a rough flow rate for them, as well.
And then I gave myself an allowance for discretionary spending.
Mathematically, everything I just described was incredibly simple to do. No software required.
Having that discipline saved me from going in to debt.
I maintained that discipline until my cash crunch wasn't so tight.
And now I kind of wish I had the time to write the software. :-/
I also wish I could get my stupid bank to give me "Read-Only Credentials," so I could write software to poll my bank, and not feel so recklessly irresponsible about it. (Having ONE account, with the ability to disperse funds, it feels wildly irresponsible to leave software running with those credentials.) I know there's also the problem where someone receives 17 cents, and then reports "I got 17 cents" in order to establish the ability to make withdrawals from accounts. So then my idea of having the software running with read access could be used as an exploit to steal my money. sigh That's a big pile of BS.
Anyone have any recommendations for banks that would HELP ME securely do any of this, or do it for me?
I'd really love it if my phone went DING every time I spent money, and it asked me to classify the expense, right then, right there. Way easier than doing it after-the-fact.
Plain text is great for data that is just that - plain text.
As soon as data isn't text, the idea falls apart quickly. What would be the advantage of storing audio data as text? It would take up more space, be ambiguous, and would require more memory and compute time to load and save.
Same applies to many other forms of data that aren't inherently text or supposed to be manipulated manually.
Everything is not text and everything is not intended to be manipulated and interpreted by humans directly. This applies to audio and video data, but also to a lot of specialised data formats that are optimised for the algorithms that use them.
So no, we won't always be returning to text and "leaving" text formats is a natural and important step for data that's not generated manually for and by humans (i.e. by means of manual data entry).
After years of using Ledger and trying to adapt it and my own systems to store richer financial data and manipulate it programmatically, I have migrated to my own solution based in SQLite rather than plain text. I realized that what I have is a data storage and manipulation problem, which is exactly the problem SQL databases solve very well.
Text works well for some things but it doesn’t deserve all the worship it gets in geek circles. Part of this was my own fault because I tried to make text work in situations where it wasn’t suited, but hopefully others will read my comment and not make the same mistake solely because they read some blog posts and other things from old-school UNIX heads saying “text is great!” Don’t try to make text do everything.
Then, because transactions aren't sorted, it becomes easier to load up some kind of UI (CLI or GUI) to browse things by-date or by-account or whatever. To say nothing of charting & reporting...
And at that point...the usefulness of plain-text-ness seems quite diminished. It becomes more like a data-entry format than anything else.
That said, I continue to use a plain-text accounting system because the alternatives aren't really any better at this point and often come with their own issues.
There are other tables to hold what I call "categories" (accountants would call these "accounts") and "accounts" (these correspond to the more colloquial usage) and commodities and other items like the balances from bank statements.
I considered both SQLite and Postgres. Postgres has nice things like true ALTER TABLE support but SQLite's ease of administration and simple API swamps any advantage that Postgres would offer for this.
My user interface is in Haskell, but one could use any language for that - I just like Haskell. It's all CLI based. I import the overwhelming volume of transactions from bank downloads, but when I need to enter something manually I currently just write a little Haskell script to do it (eventually I might add a CLI program to do this.)
XML? Or is that too far from plain text?
The issue partly stems from the lack of coupling between data and metadata on file systems. I think the next evolution of file systems involves the ability to link files together in an organic way. But that is tricky since it breaks the abstraction of files as stream of bytes. Might need to go up a level of abstraction and create new primitives for cp, mv, etc.
It’s usually pretty easy to figure out the right encoding for text files, especially when you know their origin (which I expect you would for accounting documents).
Additionally, UTF-8 is quite universally accepted these days.
I've been doing my personal accounting in Emacs org-mode tables / spreadsheets for 3 years now. I do not need super fancy things in my accounting, but so far it worked great and I am quite sure one can build more complex accountings than mine, as one has the full power of elisp and calc at ones fingertips, when using Emacs org-mode.
I haven't done this yet, but have played with ledger and org-mode separately. I've seen several articles about this, including on the official docs [1, 2]
[1] https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-...
[2] https://orgmode.org/worg/org-tutorials/weaving-a-budget.html
I may have to look into ledger, but it wouldn't even be on my radar if it wasn't backed by plain text.
I love comments like these. The moment I see the words "plain text" in any HN post I always go to the comments and ctrl+f emacs.
The rest of the world would still think it looks like the website is broken if it looks like lite.cnn.com
For me it's the opposite. In "regular" cnn.com I obtain an empty page (probably due to my overzealous adblocker), yet in lite.cnn.com I can read the news.
Two of the commercial products listed (Quicken, Quickbooks) are from Intuit. One of the worst software companies out there. Aside from their "Free" Turbo Tax fiasco (easy to find via web search), Quicken was the most infuriating program I ever used.
I now use MoneyDance (no affiliation, customer for 5+ years).
It's a Java program. It just works. It looks the same after every update. Updates are free for a couple of years. Then I pay for the update, because I like them and want them to succeed.
They have a user forum where problems are solved.
I no longer swear about my finances, unless it's about my finances. The software I use is now invisible.
At the end of the day, double entry accounting is double entry accounting and you should be able to move transaction journals between the tools. I haven't tested any of these, but it looks like there are various techniques / tools that make gnucash <-> ledger possible.
- https://wiki.gnucash.org/wiki/Ledger-CLI
- https://github.com/icyflame/gnucash-xml-to-ledger-dat
- ...
One of the revelations was that the accounting system could be used for a few different types of commodities: time, effort, inventory, etc.
If I had to summarize my favorite features I'd say:
1) Strong support for multiple currencies/commodities including cost-basis,historical-market,current-market price conversions.
2) Advanced reporting options to support various filters, mutations, conversions, outputs. One of my favorite reports is total net worth in CAD converted using latest market prices
ledger bal Assets -V -X CAD
Another might be top expense accounts in decreasing cost: ledger bal Expenses -H -X CAD --flat -S -T
3) Error detection: by enforcing double-entry accounting it has helped me identify hidden fees. It also helps when I make a mistake balancing a transaction.4) Better than 2 decimal precision. This helps with crypto where your crypto balances can look something like 1.23456789 BTC
2021/01/12 Grocery store
Assets:Checking
Expenses:Groceries $50
This transaction means that you spent $50 at the grocery store. It's double-entry bookkeeping, so the transfers always balance: "Assets:Checking" account is reduced by $50 and "Expenses:Groceries" is increased by $50. This entry is equivalent to the previous one. 2021/01/12 Grocery store
Assets:Checking -$50
Expenses:Groceries $50
But this entry is invalid, since it's not balanced (it's the accounting equivalent of a compiler error, and ledger will throw an error when parsing this): 2021/01/12 Grocery store
Assets:Checking -$75
Expenses:Groceries $50
A ledger file is literally just a list of these transactions. Accounts are created the first time you use them in a transaction. Transactions can have more than two associated accounts, but they still have to balance. There are many more advanced features, but this (along with some basic understanding of accounting) is all you really need.> This site collects FAQs and a directory for the PTA community...
I've been relying on this for the last 3 years, it works very well.
What's your workflow with it? Do you run `ledger-guesser <transaction details> >> journal_file.txt`? I'd somewhat prefer typing out the details in an editor, but I suppose I could type a bunch of transactions one per line in a file and xargs that into ledger-guesser.
What does it do when your transaction is of a new type that it wasn't trained on? Does it have a confidence threshold below which to tell you "I cannot guess this one"?
I plug this tool in my scripts that import transactions from banks (and stripe).
The scripts extract transaction details (amount, payee, currency), then they use `ledger-guesser` to create ledger entries and add them to the journal.
The generated entries are "uncleared". Then I manually "clear" the entries. Review. Commit. (You can also use a tag for reviewed transactions if you already use ledger's "cleared" indicator for something else).
For the best results, I have 1 journal per bank account. So I have different training data for each bank account.
There's no confidence threshold. When there is a new type of transaction is encountered, the guesser will chose the account with the highest probability.
The guesses are made based on the words found in the payee (and date). Unknown transaction have generally a few known tokens. Example: "INCOMING TRANSFER FROM NEW_CLIENT"... The classifier will probably classify that entry as "Incomes:OurLargestClient". In that case I have just to fix that entry to change the client, all the rest is good, it still saves a good amount of typing.
Ledger has budgeting features, allows me to use multiple commodities (I even wrote a script to get stock prices and help ledger value them). I can’t comment on bigger things, but for my use case, I really enjoy it.
The biggest thing holding me back from something like this has been the overwhelmingly boring amount of data entry required.
The rest ist just batched categorization by searching and applying.
One of the "plain text accounting" apps listed at plaintextacconting.org (under "perl", from a prominent OpenBSD person) that uses similar vocabulary to describe it, and mentions looking at ledger somewhat and why he decided to write his own. (I mention it partly as a future reference for myself in case I want to compare them more later, or if someone already has.)
Also, a prior HN discussion (which, now I see, they have a link to a list of them at the original post's site; oh well): https://news.ycombinator.com/item?id=12119050
Cross Account Budgets[1]. I want to assign every cent coming in to a budget but the budget shouldn't be tied to a specific account as money can come in on multiple accounts but I want to model the "real" situation at the same time and assign the money to a bank account.
[1] Described in this old mailing list post: https://groups.google.com/g/beancount/c/ddi5fOuAFoU/m/jp3d0M...
If you have two checking accounts that you use for Gas for example, you would credit the appropriate bank account the money came out of at the time of purchase and debit the appropriate expense account in the General ledger. What you see in the Expense account will then reflect how much money you spent on Gas no matter which checking account you used. You can then compare this to what you budgeted for.
EDIT: Here’s the appropriate PTA page on how you can use these tools for budgeting, but these are just tools. The General Ledger can reflect as much or as little data as you want it to, and the quality of the reports they generate will be based off that.
I wrote this doc describing my method,
https://docs.google.com/document/d/e/2PACX-1vS7EzDgEt9_cQ5lc...
The idea is to record every transaction as between exactly two accounts. This is a little tricky with real-world transactions but it can be done, e.g., a real-estate purchase involving 8 accounts.
For example, I started using FreeAgent for taxes and the game changing feature for me is the (Open Banking based) transaction feeds where transactions are pulled daily from multiple bank accounts, where you're prompted that you need to explain/categorise each new transaction and the explanations + transactions get locked-in once they become part of a submitted tax return.
You can easily change the category of a transaction in the UI but e.g. deleting or modifying a transaction amount will require multiple steps and for you to ignore loud warnings. The automated import takes care of avoiding duplicates and making sure nothing is missed compared to doing it manually.
I've done accounting with just spreadsheets before and I hated how easy it would have been to make an accidental edit and not notice. Manually exporting and importing CSV files is fatiguing and error prone as well.
I find this similar for invoicing software: you could keep a spreadsheet of who you need to invoice, if you sent it, if it's been paid, sending late reminders etc. but there's a lot of freedom to make mistakes and mistakes here are high impact. Invoicing software automates many of the steps, forces you to follow a set process and gives loud warnings if you deviate or make unusual edits.
Preventing regressions: Every time I update with the latest transactions I close the last transaction with an assertion that ensures the balances are correct. (E.g. that the balance on checking is equal to the latest statement, or that outstanding VAT is 0 after paying taxes)
I’ve been using ledger for my (small) business for about 5 years now. I’ve a script that calculates all the figures for my quarterly VAT submission by the categories that the tax authority requires (I use tags to label transactions).
Importing transactions is still manual work, but given the low volumes it’s not a problem. I do find it frustrating that most banks are still so limited in providing API access to accounts.
Invoices are a bit special, I can see outstanding amounts under Assets:Receivables, but haven’t found a good way to track this easily by invoice.
BTW, I think one of the main differences between Ledger/hledger and Beancount is whether assertions are interpreted per-file or globally.
I make sure by reconciling my accounts weekly (verifying them against the actual bank/brokerage accounts). I don't import automatically, I found that that led to laziness on my part. The value proposition of this style, for me, was better awareness of my money (not a vague, "I have enough" or I have around $xxxx in my checking account and $xxxxx in my brokerage account).
However, there are tools to bring in transactions automatically and I did use them for a bit. There are tools that offer support for OFX, CSV, QIF and others listed on the linked page. I found OFX (not just with this, but in general) to be inconsistent across banks, and, when I did things "automatically", made it semi-automatic. I'd download the CSV of transactions and import them.
I've never really had a problem with accidental deletions, duplications, or edits - it's a text file, and a transaction is at least 3 lines long (date and two postings), usually followed by a blank line. It's not like a CSV where the entire thing fits on a single line, and all the lines kind of blur together because they're so similar.
I commit my ledger file to git weekly, but that's more of a backup than anything else.
I manually enter all my transactions, so data import isn't really a problem I worry about (though I know ledger / hledger have ways of doing that).
My general workflow is:
1. Pull tx data from bank websites, mostly via some hacky web browser automation scripts which log in and download the appropriate QFX/CSV.
2. Run `bean-extract [args] && bean-file [args]`, which processes the tx logs into a beancount file of newly seen transactions, and then move+renames the original files into an archive.
3. Copy entries from the generated beancount file to my permanent ledger via my favorite text editor. The processing rules I have (which get run during bean-extract) are comprehensive enough that this is mostly just copy-pasting large swaths of text to the appropriate section (e.g. "Balance Transfers", "Employment Salary & Benefits", "Everyday Expenses"), but I'll usually have a couple odd expenses which don't get automatically categorized.
4. Add a `balance` assertion for any accounts which have new transactions--this throws an error if my current calculated balance for that account doesn't match the assertion.
5. Run fava to check for errors and view any reports I'm interested in.
6. `git commit` the whole mess.
In general, (3) is only adding new text so it's hard to make deletions/edits by accident, and (4)+(5) give a strong guard against duplicated/missed/incorrect entries. (6) lets me glance over the diff before committing, mainly to confirm it's an append-only operation (unless I changed the name of an account or something like that, which is both rare and can be done in a separate commit to keep things tidy).
At the end of the day, the amount of supporting code I have for all the automation is around 1k lines, and it's been built up pretty slowly over the years--the initial automation got set up incrementally in order of how tedious I found various bank websites vs. the volume of transactions for the associated accounts, but at this point I can mostly just copy-and-paste my previous work on the rare occasion I need to set up a new account.
In some sense, git commits are "meta transactions" for my personal journal, leading from one consistent state to another consistent state.
I have absolutely zero interest in tracking my finances via ledger - unlike the programmers here apparently. Mirror opposite in a way
Living far below my means and couldn’t be bothered to record every single thing. It’s all on the bank statements anyway
The value add decision happens when you decide whether to incur the expense at all, not by recording it
It may be worth to dive deep into Ledger concepts.
If required, you could always close a balance in one file and start with new accounts in a new file, sharding your journal by year, for example.
When I was using double entry accounting down to individual grocery items in GNUCash, I used to do this just for my own sanity.
Ledger used to save a parsed/processed file to speed up subsequent reads. It was dropped as not being worthwhile.
Long-running UIs, like hledger-ui, hledger-web, and fava I expect, do the parsing only once, though the report calculation is typically repeated on each page load.
There's also Timewarrior from the Taskwarrior people: https://timewarrior.net/
So, given that, the requirement must simply be to make erasing history too hard to do accidentally. A simple git commit history would suffice for that. Or just a check when you save the file to see if any lines have been removed.
It doesn't seem necessary anyway though - If everyone keeps a record of every incoming and outgoing transaction, then if I alter a transaction retrospectively, it will no longer match the counterparties records, and my modification will be detected.
For example, say we received cash 5,500 for our software services that we have yet to complete, we would need to debit cash and credit some Accounts Receivable.
lets say I make a mistake:
Cash.....5,050
Accounts Receivable..........5,050
I would either need to do another journal entry for 450 dollars to both accounts, or reverse out them and do it again, of which it would still be visible
One could easily write a small (web or desktop) application that takes some plain text, appends it to a ledger file and creates a git commit. As well as only providing a read-only view to the ledger.
Git is an amazing VCS swiss army knife. That doesn't make it the best tool for a given job.
On pen and paper you can copy a new falsified ledger and throw away the original. I think that's fraud, so good luck with it.
The security mechanism is out of band - you keep the pages secure, and you also reconcile / audit your accounts with those of your bank, suppliers, customers, etc - it's never 100% within the medium of the accounts themselves.
You can't do that with quicken.