Hi Martin,
Beancount seems to round inferred numbers by default:
1970-01-01 open Assets:Cash
1970-01-01 open Assets:Positions
1970-01-01 open Expenses:Financial:Commissions
2018-03-29 * "Buy 10 BILI"
Assets:Cash
Assets:Positions 10 BILI {11.4899 USD, 2018-03-29} @ 11.4899 USD
Expenses:Financial:Commissions 0.1 USD
turns into:
2018-03-29 * "Buy 10 BILI"
Assets:Cash -115.0 USD
Assets:Positions 10 BILI {11.4899 USD, 2018-03-29} @ 11.4899 USD
Expenses:Financial:Commissions 0.1 USD
The full-precision number for Assets:Cash should be -114.9990 USD, but
it was incorrectly rounded to -115.0 USD.
In the documentation
https://docs.google.com/document/d/1lgHxUUEY-UVEgoF6cupz2f_7v7vEF7fiJyiSlYYlhOo/
section "Precision of Inferred Numbers":
> If the default tolerance is not overridden in the input file—and
> therefore is zero—the full precision will be used; no rounding occurs.
In the minimal example above, the precision seems to be inferred from
0.1 USD commission. If I change the input file, changing commission from
0.1 USD to 0.1000 USD, the output is correct:
2018-03-29 * "Buy 10 BILI"
Assets:Cash -114.9990 USD
Assets:Positions 10 BILI {11.4899 USD, 2018-03-29} @ 11.4899 USD
Expenses:Financial:Commissions 0.1000 USD
My broker-dealer returns the commission as 0.1 USD because it is a
floating point number in JSON (you cannot end numbers with zeros). But
behind the scenes it calculates the cash balance with the full-precision
numbers (e.g. 0.1000 USD). After a few transactions, the balance of
Assets:Cash has a difference of more than 0.005 USD with the
broker-dealer and thus fails the balance assertion.
Is there a way to turn off the implicit rounding without padding 0.1 USD
to 0.1000 USD in the input file?
I am using tagged release 2.0.0.
--
Zhuoyun Wei