New issue 236: CONVERT() should allow date as optional parameter
https://bitbucket.org/blais/beancount/issues/236/convert-should-allow-date-as-optional
Martin Michlmayr:
I want to use CONVERT() to convert something to its historical cost (i.e. exchange rate on date of transaction, without later revaluation).
I don't think this is currently possible with beancount. Maybe CONVERT() can be extended to allow an optional DATE.
Example:
```
2014-01-01 open Expenses:Test
2014-01-01 open Assets:Cash
2014-01-09 * "Test" "Test 1"
Expenses:Test 10.00 EUR @ 0.8283 GBP
Assets:Cash -8.28 GBP
2014-06-10 * "Test" "Test 2"
Expenses:Test 10.00 EUR @ 0.8106 GBP
Assets:Cash -8.11 GBP
2014-07-30 * "Test" "Test 3"
Expenses:Test 10.00 EUR @ 0.7914 GBP
Assets:Cash -7.91 GBP
2014-09-11 price EUR 0.8011 GBP
2014-12-31 price EUR 0.7825 GBP
```
```
select date, position, convert(position, "GBP"), balance where account ~ 'Expenses'
date position convert_po balance
---------- --------- ---------- ---------
2014-01-09 10.00 EUR 7.8250 GBP 10.00 EUR
2014-06-10 10.00 EUR 7.8250 GBP 20.00 EUR
2014-07-30 10.00 EUR 7.8250 GBP 30.00 EUR
```
It uses the latest exchange rate (0.7825) for all transactions.