Hi,
Is there an easy way to fix the commodity exchange rate to a certain
date while still reading from an exchange database? Basically, I'd like
to set Expenses and Liabilities to use the exchange rate from the
transaction date, but to let the exchange rate for things in Assets to
float. Certainly, I could fix the exchange rate for each transaction of
interest using the {=$1234} syntax, but I'd like to refer out to the
exchange database. Also, I'm aware of the -H flag to use historical
pricing data, but that doesn't quite work because I don't want the
assets to use historical data, but the most up to date prices. In the
manual, there's a section that suggests:
"""
Or how about never re-valuating commodities used in Expenses, since they
cannot have a different future value:
= /^Expenses:/
; VALUE:: market(amount, post.date, exchange)
"""
which would do exactly what I want. However, that doesn't appear to
work. For example, the ledger file
= /^Expenses:/
; VALUE:: market(amount, post.date, exchange)
= /^Liabilities:/
; VALUE:: market(amount, post.date, exchange)
2015/01/01 * Initial balances
Assets:USD $1000
Assets:NOK NOK 5000
Equity
2015/01/02 * Cost in NOK that we need fixed
Expenses:Foo NOK 100
Liabilities:Foo
2015/01/03 * Pay down the liability in USD
Liabilities:Foo $13.31
Assets:USD
with the exchange database:
P 2015/01/01 NOK $0.1335
P 2015/01/02 NOK $0.1331
P 2015/01/03 NOK $0.1317
P 2015/01/04 NOK $0.1317
P 2015/01/05 NOK $0.1311
P 2015/01/06 NOK $0.1304
generates:
$ ledger -f fixed_account.ldg --price-db exchange.db -V balance
$1638.69 Assets
$652.00 NOK
$986.69 USD
$-1652.00 Equity
$1300.00 Expenses:Foo
$1313.31 Liabilities:Foo
--------------------
$2600.00
which looks completely wrong. How'd we get $1300 for expenses and
$1313.31 for liabilities? Anyway, I suppose there's a couple of
questions in there.
1. Is there an easy way to fix the commodity exchange rate to a certain
date while still reading from an exchange database? Here, the -H flag
doesn't work because I don't want to do this for all commodities, but
only for entries in Expenses and Liabilities.
2. What's going on with the command:
= /^Expenses:/
; VALUE:: market(amount, post.date, exchange)
found in the manual? Is it bugged or could someone explain what's going
on with my small example?
Thanks for the help.
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.