
The Double-Entry Counting Method (2016) - dragonsh
https://beancount.github.io/docs/the_double_entry_counting_method.html
======
notthemessiah
The historical significance of Double-Entry bookkeeping can not be
understated. Prior to Leonardo "Fibonacci" Bonacci bringing it to Pisa from
the Arabs in Algiers, North Africa, there was no concept of "budget" for most
merchants, each transaction was a separate affair, and consequently, finance
could not scale. There were several attempts at international lending, and it
bankrupted the Bardi and Paruzzi companies who lent lots of money to King
Edward III, who ended up defaulting on it. The Medici family succeeded where
others failed, providing a level of service in banking previously
unparalleled, thanks to being able to manage complex cash flows through
Double-Entry bookkeeping. (Fibonacci also introduced the Hindu-Arabic numeral
system at a time where most of Europe was using Roman Numerals for
arithmetic). It made the Republican city states of northern Italy on par with
the political power of noble families, and as other countries caught up with
Florence, one could, for the first time, seek an education outside of the
Church and in their own country.

Every programmer should be familiar with one descendant of double-entry
bookkeeping: the integer. Though its binary representation may be more
familiar, the formal mathematical construction of the integers consists of an
equivalence class of pairs of natural numbers. In the Chinese "Nine Chapters
on the Mathematical Art" they describe red and black counting rods denoting
gains and losses, and the equivalence class being that taking away a red and
black rod at the same time leaves the "total" or normalized form unchanged.
Integers took a lot of time to be accepted in mathematical practice, but they
were in use for far longer.

~~~
drieddust
Intresting facts: 1\. Fibonacci didn't invent the series named after him. He
was merely copying it from the Indians he came in contact. He himself admitted
this 2\. Hindu arabic numerals are just Hindu numerals. Arabs didn't add
anything. Roman numerals reached the world due to Beitish but they aren't
called British-Roman numerals.

~~~
divyamistry
Not doubting these points, but you should always cite peer-reviewed or
otherwise verified sources. It makes all the difference between a fact and an
opinion. This is especially true when contradicting a widely held belief.
Without a verifiable source, these are just "interesting hypotheses".

~~~
drieddust
I am glad you asked, here are the references.

1\. Please read "Liber Abaci". It is right there in the prologue section. Hard
to find a free copy of this link hence posting a link to tweet[1] with
screenshot of the relevent page. You can also cross verify with Italian
version on archive.org[2]

2\. Same story repeat itself with Indian numbers and algorithms.[3][4]

[1]
[https://twitter.com/TIinExile/status/1198526477026807809](https://twitter.com/TIinExile/status/1198526477026807809)

[2]
[https://archive.org/details/LiberAbaci/page/n5/mode/2up](https://archive.org/details/LiberAbaci/page/n5/mode/2up)

[3]
[https://twitter.com/TIinExile/status/1180777105778307072](https://twitter.com/TIinExile/status/1180777105778307072)

[4] [http://kutubltd.com/book-
details.aspx?CID=11&ID=30591](http://kutubltd.com/book-
details.aspx?CID=11&ID=30591)

------
rocqua
Can anyone explain why 'income' is negative and 'expenses' are positive? It
seems to me like it should be the other way around.

All I can think of is to ensure that

    
    
        sum (expenses) + sum (income) = delta(sum(assets) + sum(liabilities))
    

Over any given interval of time. But really, adding a single minus sign in the
above equation would make the rest of the story so much more intuitive to
beginners. I wonder if this is just an ossified bad choice, or if I am missing
something.

edit:
[https://beancount.github.io/docs/the_double_entry_counting_m...](https://beancount.github.io/docs/the_double_entry_counting_method.html#credits-
debits) answers my question.

~~~
wenc
I took accounting in high school, and then again in college for my minor in
management.

I learned that in basic book-keeping on paper, the key really was just
"classification"; that is, understanding what category an account was in (not
immediately obvious for things like depreciation/amortization, etc). That
determined the perspective from which things are seen, and so debit/credits
became clear. However this method turned out to be really unwieldy to program
on a computer (I even tried to build a double-entry book-keeping spreadsheet
on Excel but failed). The author's method is far preferable and far more
programmable -- I wish I had this insight in college.

At the basic levels, book-keeping is about a couple of things:

1) Recording transactions in a "journal"

2) Posting from said journal to "accounts" (Dt/Cr) = i.e. double entry
accounting

3) Doing reconciliations (e.g. bank reconciliation) to make your accounts
consistent with some third-party

4) Doing cash flow analysis

5) Preparing Income Statements and Balance Sheets, which is used to analyze a
company's cumulative/current position.

Most accounting courses cover these steps (called "book-keeping") but real
"accounting" is more than this: it's about getting insights from these
numbers, by calculating useful ratios, KPIs etc.

The real insight from accounting is being able to deduce a company's
_strategy_ from their financial statements. Apparently this is one of the
things Harvard Business School teaches in their MBA program that few schools
do.

Also, if you read lots of SEC 10-k filings (like Warren Buffet does), the
claim is that one should be able to put together a story of what a company is
doing by looking at how it's managing its money, what it is investing in, and
so on.

------
dragonsh
If you like this you will also like beancount[1] and fava [2]. The author of
beancount initially started using ledger-cli and than to have a better
adherence to accounting developed beancount in Python. Beancount has similar
file format as ledger-cli with few modifications and can attach documents and
metadata to entries. Also web interface fava provides a beautiful interface to
it.

[1]
[https://github.com/beancount/beancount](https://github.com/beancount/beancount)

[2] [https://github.com/beancount/fava](https://github.com/beancount/fava)

~~~
he9911z
One of the main troubles I have with beancount/fava is their multiple currency
behaviour. If I made some income in some foreign currency in say 1995, the
amount would be shown to me as converted to my base currency at today's
exchange rate, not at the rate that was in 1995 when the transaction actually
happened. That makes sense for assets and liabilities, but not for incomes and
expenses. The software fundamentally lacks an ability to make this distinction
between these two different sets of accounts in this dimension.

~~~
dragonsh
You can have multiple reports from beancount at current market rate, at
original cost [1], at conversion cost of the commodity of your choice.

[1]
[https://beancount.github.io/docs/running_beancount_and_gener...](https://beancount.github.io/docs/running_beancount_and_generating_reports.html#rendering-
at-cost)

~~~
he991z
I mean when using the price system which the author recommends for multi-
currency transactions. What you say is possible when using the cost system,
but leads to a lot of other complications as it means maintaining an
inventory/lots for these transactions, and the documentation also suggests not
taking that route.

------
otoburb
When I comb through financial statements (for fun, but not much profit yet) I
always feel like I'm analyzing stack traces. How I wish there was a
gdb/rr/Valgrind or similar debug framework for financial accounting
statements.

EDIT: Spreadsheet software helps a lot, but that's about the same as being
given a hex editor. Necessary, but oh so tedious.

~~~
specialist
Throwaway idea: Has anyone trained some auditing AI by feeding known fraud
data sets into the machine?

~~~
EricE
You don't need AI, just a well understood axiom:
[https://analyticsindiamag.com/the-power-of-benfords-law-
in-d...](https://analyticsindiamag.com/the-power-of-benfords-law-in-detecting-
financial-fraud/)

People have been pretty smart throughout history, not just the last few
decades. AI has to be one of the most overhyped solutions in the 20th century.

------
lmilcin
I have been taught accounting along with micro/macro economics and bunch of
other useful financial topics at equivalent of high school and I am really
happy that I did even if I did not appreciate it at the time and went for
completely different studies and job (studied theoretical mathematics, working
as a software developer).

What I have noticed is that people who don't have any accounting background
tend to think single entry when they look at their accounts and this
frequently prevents them from understanding what is actually happening.

------
victor106
>"Income numbers are negative, and Expenses numbers are positive. So if you
earned more than you spent (a good outcome), the final sum of Income +
Expenses balances will be a negative number"

This is kind of counter intuitive. You would think of income as being positive
and expenses being negative. This is why accounting trips me up.

~~~
nybble41
The problem is that you're thinking of "income" as "the amount of money I
received". That would, of course, always be a positive number. Income accounts
actually represent the _source_ of income, such as a customer or employer; you
received money from somewhere, and so the balance of that source has
decreased, while your own assets have increased. Expenses are just the
opposite: a negative entry in your asset account, counterbalanced by a
positive entry in the expense account representing the recipient of the money.
Your loss is their gain. You could flip it around but then your own asset
accounts would have negative balances. Or you could do what some accounting
systems do and selectively negate the balances for credits and debits
depending on the type of account, but that's just confusing all around.

------
leephillips
This is the most clearly written article about any topic of accounting that I
have ever seen.

