New issue 190: Use of implicit_prices and operating_currency together leads to incorrect calculations of net worth https://bitbucket.org/blais/beancount/issues/190/use-of-implicit_prices-and
Zhuoyun Wei: Hi, if you have the following conditions to be true, the calculated net worth is wrong: - Two operating currencies are defined; - At least one transaction involves the two currencies with `@@`; - The implicit_prices plugin is enabled. Here is a minimal example: ``` plugin "beancount.plugins.implicit_prices" option "operating_currency" "CNY" option "operating_currency" "USD" 1970-01-01 open Liabilities:CC 1970-01-01 open Expenses:Food 2017-09-01 * "" Liabilities:CC -660.00 CNY Expenses:Food +100.00 USD @@ 660.00 CNY ``` Running bean-report: ``` Currency Net Worth -------- --------- CNY -660.00 USD -100.00 -------- --------- ``` Either: - disabling one of the operating currencies or - disabling implicit_prices plugin restores the correct calculation of net worth: ``` Currency Net Worth -------- --------- CNY -660.00 -------- --------- ``` I rooted the cause of this behavior in a very confusing situation. I was looking at the net worth graph in Fava and found something very strange: - My ledger spans from 2013 to 2017. - The ledger consists of only CNY transactions from 2013 to 2015. The net worth graph from 2013 to 2015 consists of a rising line of CNY and a flat line of USD which is always 0. - In year 2015 I got my first international credit card and there were USD @@ CNY transactions from then on. - On the day the first USD @@ CNY transaction occurs, the USD value in Fava net worth graph spikes from zero to a non-zero value, which roughly equals to all my CNY assets converted to USD. - The USD line in the graph keeps a similar shape with CNY line from 2015 to 2017. Attachment: the USD net worth spikes from zero to non-zero starting from the day the first USD @@ CNY transaction occurs, and keeps a similar shape with CNY value from then on. Responsible: blais -- 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 post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/20170906124508.30042.25766%40celery-worker-110.ash1.bb-inf.net. For more options, visit https://groups.google.com/d/optout.