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
<https://docs.google.com/document/d/1lgHxUUEY-UVEgoF6cupz2f_7v7vEF7fiJyiSlYYlhOo/edit>
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
<https://www.bogleheads.org/forum/viewtopic.php?t=278342>. 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

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAHREChgep_7vkV2tEJqphM9oK3zsArA6yD4%3D5pBT-UdGNAL1mg%40mail.gmail.com.

Reply via email to