For example, say you buy 10 gallons of gas at $1.20. In future
"value" reports, you don't want these gallons reported in terms of
today's price, but rather the price when you bought it. At the same
time, you also want other kinds of commodities -- like stocks --
reported in terms of today's price.
This is now supported as follows:
2009/01/01 Shell
Expenses:Gasoline 11 GAL {=$2.29}
Assets:Checking
This transaction actually introduces a new commodity, "GAL {=$2.29}",
whose market value disregards any future changes in the price of
gasoline.
If you do not want price fixing, you can specify this same transaction
in one of two ways, both equivalent:
2009/01/01 Shell
Expenses:Gasoline 11 GAL {$2.29}
Assets:Checking
2009/01/01 Shell
Expenses:Gasoline 11 GAL @ $2.29
Assets:Checking
There is no difference in meaning between these two forms. Why do
both exist, you ask? To support things like this:
2009/01/01 Shell
Expenses:Gasoline 11 GAL {=$2.29} @ $2.30
Assets:Checking
This transaction says that you bought 11 gallons priced at $2.29 per
gallon at a *cost to you* of $2.30 per gallon. Ledger auto-generates
a balance posting in this case to Equity:Capital Losses to reflect the
11 cent difference, which is then balanced by Assets:Checking because
its amount is null.
John