Hi Martin,
I am starting to use beancount and am finding the balancing to be a bit troublesome. Any thoughts on implementing my suggestion below?
The
documentation mentions "peculiarities in Vanguard investment accounts whereby rounding appears to follow odd rules and balances don’t match." But in reality Vanguard follows a
simple algorithm. The only difference is that Vanguard performs the computation in units of the commodity being converted to (i.e. the posting with a positive amount) whereas Beancount always uses the commodity of the cost (USD).
Let's take a real-world example:
2009-09-14 * "Buy"
Assets:Checking -3,331.23 USD
Assets:Vanguard:VTSMX 128.174 VTSMX {25.99 USD}
This fails with error:
Transaction does not balance: (0.01226 USD)
But it
does balance. Vanguard computed 3,331.23 USD / 25.99 USD/VTSMX = 128.173528... and rounded to 128.174.
A (seemingly) simple solution is to perform the computation in all commodities involved and accept if any sum is within the precision tolerance. So in my example:
- Fail in USD
- Posting 1: -3,331.23 USD
- Posting 2: 3,331.24226 USD (= 128.174 * 25.99)
- Sum: 0.01226 USD > 0.005 USD (fail)
- Pass in VTSMX
- Posting 1: -128.173528 VTSMX (= -3,331.23 / 25.99)
- Posting 2: 128.174 VTSMX
- Sum: 0.0004717 VTSMX < 0.0005 VTSMX (pass)
What do you think? Would it make sense for beancount to use this modified algorithm?
Thanks!
Mark