--update doesn't work for commodities not held at cost
Input file:
plugin "beancount.plugins.auto_accounts"
2021-04-01 commodity EUR
price: "USD:yahoo/EURUSD=X"
2021-04-01 *
Assets:Cash 100.00 EUR @ 150.00 USD
Equity:Opening-Balances
this works:
> bean-price test.beancount
2021-04-27 price EUR 1.21 USD
this does nothing:
> bean-price test.beancount --update
If I add {...} to the transaction, both commands work as expected.
I believe this bug has been previously pointed out in https://github.com/beancount/beanprice/pull/26 (cc @doriath)
Got the same issue. but when trying with -i flag, it start to works well..
so must be something special around https://github.com/beancount/beanprice/blob/2122268e4696b40bdb565a31bc38eb831fe8d584/beanprice/price.py#L394-L404
also based on your description, it might be related to this function https://github.com/beancount/beancount/blob/24df7465413ed22dc9c500f4d781430cb1c9e655/beancount/ops/lifetimes.py#L21-L76
It looks like an issue with how get_commodity_lifetimes (mentioned by @ileodo) determines currency pairs. It uses method currency_pair of Position class, which only considers cost currency.
https://github.com/beancount/beancount/blob/master/beancount/core/position.py#L255-L261
@blais just wondering can you still recall was there any consideration on this?