[HN Gopher] Beancount: Double-entry accounting from text files
       ___________________________________________________________________
        
       Beancount: Double-entry accounting from text files
        
       Author : techtalsky
       Score  : 131 points
       Date   : 2022-01-30 16:17 UTC (6 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | raymondh wrote:
       | Accountant here: Recommend using Beancount with version control
       | on your data so that you can take snapshots at various points in
       | time.
       | 
       | The notion behind "accountants don't user erasers" is that like a
       | blockchain, you're creating a trail of evidence. If all of the
       | data is mutable all of the time, its evidentiary value is low
       | (for example, the IRS gives more weight to "contemporary"
       | evidence than to records constructed or altered after-the-fact).
       | 
       | Another reason to freeze, snapshot, or close your books is to not
       | lose the support and detail behind any financial statements
       | you've produced. Imagine getting a business loan based on your
       | Balance Sheet and Income Statement but later being unable to
       | reconstruct how those were produced.
       | 
       | Generally, accounting systems use a system of cumulative,
       | immutable journal entries. If a mistake is made, then a reversing
       | or adjusting entry is made.1
       | 
       | There is merit to text based bookkeeping, but don't create a
       | world that is so free form and mutable that it loses it meaning
       | and connection with the real world.
       | 
       | 1 https://en.wikipedia.org/wiki/Adjusting_entries
        
         | fangpenlin wrote:
         | I really enjoy using Beancount + Git for managing the
         | accounting book for my own startup company, but I found it a
         | bit tedious to add entries periodically. I wonder why nobody
         | build a service make it like GitHub but for Beancount and
         | automate lots of stuff. I then decided to make a service for it
         | a while back. Shameless self-promoting here, yesterday I just
         | launched the service in very early stage of open beta:
         | 
         | https://beanhub.io/
         | 
         | Basically the idea is, as a software engineer, I believe
         | accounting book can be automated like how we build software.
         | There are many interesting workflow we can bring into the
         | system, such as
         | 
         | - Pull request review - Commit sign off (pgp signature) - CI
         | for generating reports
         | 
         | and many other interesting aspects. Also just like software, I
         | believe many of the orgs can benefit from open sourcing their
         | financial data, like no-profits or government. So I am thinking
         | making open source accounting book free repository for the
         | product just like GitHub did previously. Anyway, I just found
         | this thread happen to appear on hacker news so just want to
         | share the stuff I am building. Feedbacks are welcome.
        
           | addcninblue wrote:
           | I've considered building something like this as well! I think
           | something cool would be to integrate "predictions" or
           | modeling with this. For example, for people with consistent
           | salaries, this can be used to model financial goals, etc.
           | Thoughts are welcome!
        
             | fangpenlin wrote:
             | Yeah, so for BeanHub, when you push a commit, the system
             | will capture the accounting book into SQL database. Taking
             | from there, I can imagine there are many data prediction
             | model can be applied to the ingested data. I am also
             | thinking to support "CI job" feature (run a task when you
             | push a new commit), not for building software but for your
             | accounting book. So even if it's not supported by the
             | system officially, it's still possible to build your
             | prediction model.
        
       | bobjordan wrote:
       | Fava is a nice GUI that's built on top of beancount, see
       | https://github.com/beancount/fava
        
         | KennyBlanken wrote:
         | Before anyone else does what I did and loses a bunch of time
         | setting it up: fava is completely read-only.
        
           | lelandfe wrote:
           | https://fava.pythonanywhere.com/example-beancount-
           | file/edito...
           | 
           | I do see the demo has an editor!
        
       | user3939382 wrote:
       | This reminds me of ledger: https://www.ledger-cli.org/
       | 
       | * Turns out they address the comparison:
       | https://beancount.github.io/docs/a_comparison_of_beancount_a...
        
         | globular-toast wrote:
         | I've been using ledger for 10+ years. I guess I should try
         | beancount, but ledger works for me. I've never had to calculate
         | capital gains or any other taxes myself, though.
         | 
         | Ledger's simple model makes a lot more sense to me (ie.
         | everything is just a commodity), but it sounds like beancount
         | is set up to deal with a lot of the extra bullshit that exists
         | in the legal system.
        
         | _benj wrote:
         | I initially thought that it had to be either/or and when I
         | switched to beancount I was sorely missing then simple balance
         | reports from ledger.
         | 
         | What I've been doing lately is just generating ledger-formatted
         | ledger on the fly for this that I used ledger before, while
         | still benefiting from the strict beancount format, balance
         | assertions and such that ledger doesn't have
        
           | Buttons840 wrote:
           | https://www.ledger-cli.org/3.0/doc/ledger3.html#Balance-
           | asse...
           | 
           | It appears ledger does have balance assertions.
        
             | _benj wrote:
             | oh nice, thanks for sharing, I wasn't aware of that :-)
             | 
             | It seems though that the assertions are attached to
             | transactions. The way I use balance assertions on beancount
             | is that, say, payday after balancing everything I'd enter
             | 
             | > 2022-01-30 balance Assets:Bank 500.00 USD
             | 
             | and that will ensure that whatever happens, even if I need
             | to go back in time to clear transactions, the amount needs
             | to be that one, and that balance is usually straight from
             | my current bank balance.
             | 
             | So, it seems slightly different use case that ledger's
             | balance assertion
        
       | raspyberr wrote:
       | Does anyone know if there's a good app I can use for plaintext
       | accounting on my phone? I'd love to be able to use syncthing to
       | sync the ledger on my PC and phone. It'd really help me stop
       | collecting receipts so I can bulk put them in when I get home.
        
         | bingohbangoh wrote:
         | FWIW Emacs has a ledger mode that is fantastic. I suspect other
         | editors do as well.
        
         | howeyc wrote:
         | Any text editor will do.
         | 
         | Or maybe this? https://cone.tangential.info/
        
           | KennyBlanken wrote:
           | I am not editing a structured text file on my phone while out
           | and about.
           | 
           | Especially due to the error-prone-ness and slowness of using
           | mobile screen keyboards, you need guided/assisted data entry;
           | a number pad only when you need to enter numbers or dates. A
           | "use today's date if blank" field, selectors for accounts and
           | tags, etc.
        
           | raspyberr wrote:
           | Yeah any text editor would be fine which is what's great
           | about PTA but editing text on a phone isn't great. That app
           | looks like it might be what I'm looking for so I'll have a
           | look at that thanks
        
       | bingohbangoh wrote:
       | Out of curiosity: has anybody used this to do business
       | accounting?
       | 
       | I am intrigued by these ultra simple setups. However, most
       | accountants -- the people who will ultimately help you once your
       | business is sufficiently complex -- will use Quickbooks or some
       | other established software.
        
         | shubhamkrm wrote:
         | Software Freedom Conservancy uses it for their non-profit
         | accounting. They have published their workflow here:
         | https://github.com/conservancy/npo-ledger-cli/blob/master/np...
        
         | uoaei wrote:
         | On one hand you can tailor your bean-counting with fancy
         | scripts that achieve exactly what you need. On the other hand
         | you would need to spend probably lots of time writing and
         | maintaining those scripts. Doesn't seem worth the hassle for
         | the vast majority IMO.
        
         | ska wrote:
         | I've done this with gnucash, which isn't exactly the same but
         | similarly unusual to them.
         | 
         | What I found was that unless you are using the same back end,
         | most of them were going to re-enter everything anyways as they
         | want to double check. So it was more important to have the
         | accounts & conventions they expected, rather than the actual
         | software.
         | 
         | In my case, the data entry cost was about < 10% of my bill, so
         | moving to the same software as them wouldn't be a big saving.
         | 
         | I've not used beancounter, so I'm not sure how much (if any)
         | work would be needed to get the same support I had in gnucash.
         | Mostly the complexities of invoicing and taxes in multiple
         | countries and currencies, payroll, etc. One big issue
         | potentially is you'll need to be able to produce proper
         | financial statements for your jurisdiction (at least, countries
         | I'm used to). Not sure if/how that is supported out of the box
         | so might be some work.
        
         | cranium wrote:
         | I started using Ledger for my small consulting business in
         | Switzerland. Here, the internal accounting structure is quite
         | flexible as long as you can output the balance sheets in the
         | required format. My fiduciary asks for PDFs to verify the
         | (legal) accounting norms anyway.
        
           | nickray wrote:
           | How do you map KMU Konten to ledger accounts (can you
           | rollup?), and do you automate VAT accounting?
        
             | cranium wrote:
             | It's quite easily to map the accounts once you have the
             | main categories mapped (I use the french naming so my
             | german translation may be wrong):
             | 
             | - Aktiven <-> Assets - Passiven <-> Liabilities -
             | Betrieblicher Ertrag <-> Income - Betrieblicher Aufwand <->
             | Expenses
             | 
             | I'm not sure I understand what you ask about rollup, but so
             | far I haven't found a case I couldn't fit within Ledger.
             | For VAT, I have a flat VAT rate that only applies to my
             | turnover so it was simple to automate (reduce turnover by
             | x% and put that amount into Owed VAT).
        
       | awinter-py wrote:
       | ah yes the masculine urge to use C++ and bazel in a python text
       | processing codebase
        
       | djhworld wrote:
       | Been a beancount user since 2018, great piece of software. Gets
       | even better if combine it with auxilliary tools like Fava for
       | visualisation and "beancount-mode" for emacs.
        
       | balves wrote:
       | I switched to beancount after trying several other things (mint,
       | spreadsheets, gnucash), and I like it quite a bit. It's choice to
       | be very strict about things held at cost (like units of stock) is
       | a great differentiation.
       | 
       | It's VERY hard to accidentally miss capital gains, or get cost
       | basis wrong on something, or have something not balance. Much
       | harder than even ledger-cli, let alone the other alternatives. It
       | feels at times like working with a static type system versus a
       | dynamic type system.
       | 
       | And the burden associated with this is not anything more than
       | other tools. Importers have been great. I have 68 asset
       | subaccounts between my spouse and I (if you do double-entry
       | accounting you'll know this isn't actually that many), and I
       | spend about 1-2 hours a month balancing the books, doing
       | reporting, etc.
       | 
       | Finally, it's quite easy to get your transactions into a pandas
       | datatable or similar, allowing you to utilize your
       | programming/datascience skills to do things that just aren't
       | available in other tools. Mint offers nothing here, spreadsheets
       | can do some of it (but the downsides of accuracy), and gnucash
       | requires learning some niche scheme stuff; it feels very "tacked
       | on".
        
         | djhworld wrote:
         | I've been using beancount for 3+ years and totally agree, the
         | flexibility of it is the real USP.
         | 
         | I've never used any import tools though, I just enter the
         | transactions manually maybe once or twice a week. It's been
         | fine - especially using beancount-mode for emacs, although
         | admittedly it's just my accounts, it might not scale so well
         | for a family.
        
         | NoboruWataya wrote:
         | > gnucash requires learning some niche scheme stuff; it feels
         | very "tacked on".
         | 
         | There is also piecash, which gives a nice Pythonic interface to
         | the SQL files generated by GnuCash:
         | https://pypi.org/project/piecash/
        
         | haberman wrote:
         | > Importers have been great.
         | 
         | What importers do you mean? Are these importers you've written
         | yourself, or existing importers you were able to reuse? What
         | format are these importers pulling from (PDF statements, CSV,
         | OFX, etc)?
        
           | balves wrote:
           | https://github.com/redstreet/beancount_reds_importers/tree/m.
           | ..
           | 
           | https://github.com/jbms/beancount-import
           | 
           | https://beancount.github.io/docs/importing_external_data.htm.
           | ..
           | 
           | Support for OFX is generally great, CSV is also great. There
           | are some proof of concept things floating around too for PDF.
        
             | haberman wrote:
             | Do you find that all of your financial institutions offer
             | reliable OFX/CSV feeds?
             | 
             | I'm asking because I've generally come to the conclusion
             | that PDF is the only universal data format that every
             | institution will offer.
        
               | OJFord wrote:
               | Not GP, but in my experience they offer CSV with the most
               | helpful columns for programmatic use omitted; present
               | only in the PDF.
               | 
               | Of course I've submitted requests pointing it
               | out/requesting it, but to be honest I can only assume
               | it's deliberate.
        
         | repiret wrote:
         | For GnuCash it's easy to parse it's XML files or Sqllite
         | database, so you don't have to mess with scheme.
        
       | nuclearnice3 wrote:
       | Jan 12 thread "Plain Text Accounting"
       | https://news.ycombinator.com/item?id=25745615
        
       | howeyc wrote:
       | Part of Plain Text Accounting family:
       | https://plaintextaccounting.org/
       | 
       | I really prefer having complete control of my financial data this
       | way, and reports can be as custom as you'd like. Better than
       | something like Mint in my opinion.
        
         | nightski wrote:
         | I hate mint but use a different budgeting system. I'm not sure
         | you can compare an accounting system with a budgeting system -
         | they serve different purposes. I'd love to build a full
         | budgeting system on top of one of these text accounting systems
         | some day.
        
           | howeyc wrote:
           | Just create a "Budget" account and a report that does
           | "Budget" vs "Expenses"
        
             | BeetleB wrote:
             | Beancounts budgeting system is fairly poor. It can't handle
             | envelope budgeting, which is the only useful budgeting
             | system I've found so far.
        
               | navaati wrote:
               | It's not _great_ , but what I do is create a fake expense
               | far into the future...
        
               | barrucadu wrote:
               | For envelope budgeting, I just make subaccounts of my
               | bank accounts for specific purposes.
        
               | [deleted]
        
       | clircle wrote:
       | Any married people have advice on how to track finances? I used
       | bean count or ledger when i was single, but the manual system
       | kind of breaks down when you have a family .
        
         | derefnull wrote:
         | How does the system 'kind of break down' when you have a
         | family?
        
           | clircle wrote:
           | The short answer is that my wife and I have different
           | opinions about how to track data.
        
             | stirfish wrote:
             | My wife and I have separate bank accounts
        
               | chana_masala wrote:
               | ...and? How is that directly relevant?
        
               | stirfish wrote:
               | We gather our own data without any conflicts. Sorry, I
               | thought that was apparent.
        
           | retrac wrote:
           | Once you add parallelism to your transaction processing, all
           | manner of untoward things can happen. For example, two parent
           | processes may attempt to execute the same transaction to
           | acquire the same resources at the same time, having failed to
           | exchange messages to ensure their internal household state is
           | fully synchronized. And sometimes child processes will fail
           | to acquire permissions but silently commit transactions
           | anyway!
        
             | derefnull wrote:
             | I understand that concurrent edits to the ledger will
             | become problematic. If this really is a requirement, a
             | distributed ledger solution (cloud based tool) may be
             | needed
             | 
             | Though is the root issue just communication? At some point
             | transactions need:
             | 
             | 1. Recorded
             | 
             | 2. Categorized (optional, but desirable)
             | 
             | 3. Reconciled (This can only happen as often as bank
             | statements are issued)
             | 
             | With multiple spenders, communication (to answer the
             | question "what is this transaction for?!?!") is paramount
             | and fits naturally at the reconciliation step or more
             | frequently if desired.
             | 
             | The workflow described is synchronous, centralized and
             | simple
        
             | PebblesRox wrote:
             | This week my toddler spent $60 on a 11x14 inch canvas print
             | of himself getting a bottle of ketchup out of the fridge.
             | $20 was for priority shipping to ship it to our former
             | address in a different city.
             | 
             | I thought the photos app was a fairly innocuous form of
             | screen time, not realizing that it was so easy to make a
             | purchase! No password confirmation or anything.
             | 
             | Fortunately support made a one-time exception and refunded
             | the payment even though it was well past the cancellation
             | window.
             | 
             | I still removed all the payment methods and addresses from
             | our Google Pay account because I couldn't figure out any
             | other way to guarantee that this doesn't happen again.
             | 
             | Frictionless payment flows do not mix well with toddlers.
        
             | globular-toast wrote:
             | What's the problem? Just track all transactions.
        
         | globular-toast wrote:
         | It really depends what your arrangement is. Is everything
         | shared between you? Then you need to track all accounts. You
         | should look into automating ingest of your accounts data. Most
         | banks/credit cards etc. should allow some kind of statement
         | export. If not, consider switching provider.
         | 
         | I would advise not to worry about petty cash. Don't get
         | pedantic. Worry about the big things. Just make a cash account
         | for petty cash.
         | 
         | If you don't share accounts then just track your stuff and set
         | up reimbursement account(s) for your family. You'll only know
         | the net amount you need to transfer between yourselves to
         | square up at the end of the month or whatever you agree to do.
        
         | molsongolden wrote:
         | lunchmoney.app is pretty cool and strikes a good balance of
         | offering powerful features without forcing too much complexity
         | on the average user.
        
         | katzgrau wrote:
         | Me and my wife have been using EveryDollar. It's simple and
         | pulls in transactions, which is good because I despise finance
         | (despite being reasonably thrifty) and I'm also lazy.
        
         | Pasorrijer wrote:
         | I use homebank. Download all your various transactions, load
         | and tag them and you're done.
         | 
         | You can build rules too so the more you use it, the more
         | automated it becomes.
        
           | chana_masala wrote:
           | Wow, I can't believe I haven't heard of Homebank [1] before.
           | This looks very much like what I've been wanting. Thank you
           | for the recommendation.
           | 
           | [1] http://homebank.free.fr/en/index.php
        
         | xupybd wrote:
         | I went through the same thing. I used to use hledger. Now I use
         | lunchmoney so my wife can use the tool. TBH I'm thinking about
         | going back to hledger. Don't get me wrong lunchmoney is amazing
         | but it's not as well suited to me. My wife has little interest
         | in looking at the budget so there is not much point.
        
         | _benj wrote:
         | I enabled notifications on all our cards and bank accounts so
         | whenever a transaction happens I get an email.
         | 
         | From there I just use gmail filters to put all of those in a
         | folder and then wrote a script to download, parse and enter
         | those transactions on my ledger with "Expenses:FIXME"
         | 
         | Once a week or so (when I have around 10-20 transactions) I
         | import them and go through them, asking my SO if there's any
         | transactions I don't know of.
         | 
         | Alternatively I also just make one transactions to put in an
         | account that is fully my SO's and one that is mine (mostly for
         | both of our hobbies) and those I don't track, except for the
         | monthly deposit to those
        
         | Tuckerism wrote:
         | YNAB (https://www.youneedabudget.com/) was the trick for us--
         | while I am totally comfortable with these kind of tools or even
         | just a spreadsheet, the app and functionality from YNAB made it
         | accessible to my significant other. We also like the "envelope"
         | method for budgeting, so this made it a natural fit. I
         | recommend everyone at least try it if they're not budgeting
         | already.
         | 
         | (If this is what you meant by family finances-- as others have
         | pointed out, there's a difference between budgeting and
         | accounting. YNAB has met all of my family's needs in the
         | financial realm.)
        
         | mcgin wrote:
         | I use hledger-flow [1]. It's an opinionated way of importing
         | csvs into the hledger format. Works really well for me, just
         | export the csvs, write a mapping and you are good to go.
         | 
         | It supports preprocessing the csvs if you need to clean the
         | data or compute some new fields which is really powerful. Once
         | you are up and running it only needs some minor updates each
         | month to map unidentifiable transactions I can do this in under
         | an hour these days.
         | 
         | [1] https://github.com/apauley/hledger-flow
        
         | atgreen wrote:
         | For my family I use ledger and a bunch of little programs I've
         | written over the years to import data and generate reports.
         | I've tried every other tool and system over the decades, and
         | nothing beats PTA (and ledger, in my case).
        
           | cogburnd02 wrote:
           | > PTA
           | 
           | Parent-Teacher Association??
        
             | zrail wrote:
             | Plain text accounting
        
             | [deleted]
        
         | zie wrote:
         | People will disagree with me, but.. don't?
         | 
         | I keep track of my expenses by CC and cash account, by the
         | month. I don't care that I spent $5 on a coffee. I do care that
         | for the month of January I stayed within my $X amount, and that
         | for the year I'm on track for my savings goal(s), retirement,
         | etc.
         | 
         | So I keep 2 spreadsheets, 1 is monthly, to ensure the bills get
         | paid and the 2nd is my NW that tracks my retirement and savings
         | goals.
        
       | darcys22 wrote:
       | Shameless self plug: ive been building a similar open source
       | command line accounting system
       | 
       | https://github.com/darcys22/godbledger
       | 
       | Its heavily inspired by both ledger and beancount but my biggest
       | issue with them is that text files arnt great for double entry
       | bookkeeping. Having a relational database is the better option
       | which is what GoDBLedger has.
       | 
       | After a certain point a business cant keep track of its
       | transactions in text files because there are simply too many of
       | them, so these systems really only scale to personal finance
       | levels (few hundred transactions maybe thousand transactions).
       | 
       | In addition building plugins that can import your whole text file
       | into a sql system so you can query them is redundant. Just have
       | it in a relational database to start with.
        
         | CGamesPlay wrote:
         | You're spot-on about this. Even for my personal finance, I have
         | to apply classification rules at import time and I can't bulk
         | edit transactions to reclassify them after the fact. As a
         | result I am looking for a replacement, although a requirement
         | for me is some sort of fava equivalent.
        
           | hiq wrote:
           | > I can't bulk edit transactions to reclassify them after the
           | fact.
           | 
           | If you store your transactions in a plaintext format, why
           | don't you use CLI tools? I just renamed a bunch of accounts
           | using sed for instance, in a hledger journal.
        
             | darcys22 wrote:
             | UPDATE transactions SET account = "Income" WHERE account =
             | "Expense";
        
           | darcys22 wrote:
           | Thats pretty much what I've been working on.
           | 
           | https://youtu.be/19moSl4YFeI
        
         | mongol wrote:
         | I have also written a ledger using sqlite and go. It is not
         | open source (yet) because somewhere in the git history may be
         | traces of personal details. But at some point I think I will
         | open it.
         | 
         | The way it works now is that I generate a directory structure
         | from my bank account transactions. In each directory I put a
         | text file thay describes my accounting transactions. The
         | program parses this and inserts it into the database. From
         | there it can generate reports.
        
         | BeetleB wrote:
         | My ledger file has over $20K entries. Although I'm cheating: I
         | actually input transactions into another SW and simply convert
         | its format to Ledger.
        
           | darcys22 wrote:
           | Interesting! Whats the other software?
           | 
           | I actually love ledger, and GoDBLedger can read in ledger
           | files for this reason. I hate to throw negative feedback at
           | other open source systems because the ultimate goal is to
           | automate the financial process and we are really all working
           | together to achieve that.
        
       | onislandtime wrote:
       | With no background in accounting, I was impressed with the
       | Beancount documentation. Very well written and a great way to
       | learn accounting. I am looking for a solution to track my
       | investments but I find it a bit overwhelming to get started with
       | Beancount from scratch. Is there a tool to convert brokerage data
       | into Beancount data from scratch?
        
       | _benj wrote:
       | Switched to beancount from ledger a few months ago and I'm really
       | enjoying the strict syntax of beancount. The cool thing though is
       | that I really didn't lose any of my reporting flows that I had
       | with (h)ledger... I just made scripts that convert the beancount
       | journal on the fly, run whatever I was used to with hledger, and
       | then delete the temporary file.
       | 
       | I feel like I'm getting the best of both worlds :)
        
         | rssoconnor wrote:
         | Did you covert your hledger journal to beancount, or just start
         | anew?
        
           | _benj wrote:
           | I started anew, just because after having using ledger I
           | wanted to change some accounts, categories, and generally
           | change the way I was doing things before.
           | 
           | But I don't see why I'd be an issue to convert ledger to
           | beancount.
        
       ___________________________________________________________________
       (page generated 2022-01-30 23:00 UTC)