Issue #280: Support implicit prices for explicitly specified pairs (blais/beancount)

28 views
Skip to first unread message

Martin Blais

unread,
Apr 8, 2018, 11:59:47 PM4/8/18
to bean...@googlegroups.com
New issue 280: Support implicit prices for explicitly specified pairs
https://bitbucket.org/blais/beancount/issues/280/support-implicit-prices-for-explicitly

Martin Blais:

Re. your first email: That's not great behavior from Beancount.
Ideally at the very least it should issue a warning, or try to resolve the rates.

In general, replacing the currency conversion with an unconditional graph search is too dangerous IMO, it could start getting really expensive without us noticing. Besides, if we did that I would consider redesigning the price map from scratch, avoiding filling it in with inverses in the first place. A better approach to solve the networth report issue might be to have a function which fills in missing pairs in the existing price map for particular desired currencies (i.e., the operating currencies in this case) once and then use that. What do you think?

I'll comment further on your PR.
Thanks,





On Thursday, January 12, 2017 at 2:56:34 AM UTC-5, Justus Pendleton wrote:
As a follow up to myself...to try to understand what is going on I reduced it down so I only have one operating_currency -- AUD.

One surprise is the way currency conversions work in holdings_report.py:convert_to_currency. What I mean is:

I have this...

2017-01-11 price AUD 0.7379 USD
2017-01-11 price USD 22,568.27 VND

But because I don't have an explicit AUD <-> VND price the call to prices.get_latest_price(price_map, base_quote) returns (None, None). This results in it throwing out anything I have with a cost_currency of VND.

If I add another entry, so it looks like

2017-01-11 price AUD 0.7379 USD
2017-01-11 price AUD 16,856.94 VND
2017-01-11 price USD 22,568.27 VND

then things work as expected. Is it even possible to have bean-price fetch two different prices for AUD like that? One in VND and one in USD?

It seems like currency/commodity conversion should be using a graph rather than just a dictionary lookup. I have a patch that does this that I can submit so long as I'm not misunderstanding how all this is supposed to work. When I change it to use a graph lookup then the problem I talked about in my original post goes away.

Responsible: blais
Reply all
Reply to author
Forward
0 new messages