Thanks Mark for the well-written question.
I'm not sure if this relaxation always makes sense (e.g. for currencies),
but it certainly seems like it would be sensible for investment commodities
like this.
I'd want the default to be full precision and only when you override the
tolerance for VTSMX would it take effect (and relax the check).

The real problem is that in general there's no balance check on the units,
only on the "weight" of each posting.
While in your simple example it seems trivial to compute the sum of the
VTSMX equivalents, in general (> 2 postings, some in other currencies,
etc.) it's not something that's already being calculated, and that's
probably not an easy addition.

Maybe we can come up with some other heuristic to relax the tolerance in
terms of USD, so that the maximum of a list of tolerance values (in USD)
gets used in the current check. I'd be inclined to consider even a
per-transaction override.






On Tue, Feb 11, 2020 at 10:35 PM Mark Lodato <loda...@gmail.com> wrote:

> 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 beancount+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAHREChgep_7vkV2tEJqphM9oK3zsArA6yD4%3D5pBT-UdGNAL1mg%40mail.gmail.com
> <https://groups.google.com/d/msgid/beancount/CAHREChgep_7vkV2tEJqphM9oK3zsArA6yD4%3D5pBT-UdGNAL1mg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPLkywC1mZfuJ_sA6p7Afpo_B7ZLerQCYazVamDQ%2Bc9WQ%40mail.gmail.com.

Reply via email to