Issue #255: Prices are not transitive (blais/beancount)

18 views
Skip to first unread message

Martin Michlmayr

unread,
Mar 25, 2018, 4:11:43 PM3/25/18
to bean...@googlegroups.com
New issue 255: Prices are not transitive
https://bitbucket.org/blais/beancount/issues/255/prices-are-not-transitive

Martin Michlmayr:

If a price pair MR/USD exists as well as USD/EUR, why can't beancount convert from MR to EUR directly? i.e. why are prices not transitive? (They are in ledger)

Example:

```
beancount> SELECT CONVERT(position, "USD") WHERE account ~ 'Test' AND currency ~ 'MR'
convert_pos
-----------
7.5000 USD
-7.5000 USD
beancount> SELECT CONVERT(position, "EUR") WHERE account ~ 'Test' AND currency ~ 'USD'
convert_position_c_
----------------------------------
8.130081300813008130081300813 EUR
-8.130081300813008130081300813 EUR
beancount> SELECT CONVERT(position, "EUR") WHERE account ~ 'Test' AND currency ~ 'MR'
convert_
--------
1000 MR
-1000 MR
beancount> SELECT CONVERT(CONVERT(position, "USD"), "EUR") WHERE account ~ 'Test' AND currency ~ 'MR'
convert_convert_position_c__c_
----------------------------------
6.097560975609756097560975610 EUR
-6.097560975609756097560975610 EUR
beancount>
```

Test case:

```
2014-01-01 open Assets:Test

2018-03-20 * "Test"
Assets:Test 1000 MR
Assets:Test

2018-03-20 * "Test"
Assets:Test 10 USD
Assets:Test

2018-03-25 price EUR 1.23 USD
2018-03-25 price MR 0.0075 USD
```


Reply all
Reply to author
Forward
0 new messages