New feature today: Fixated commodity prices

54 views
Skip to first unread message

John Wiegley

unread,
Mar 2, 2009, 4:04:41 PM3/2/09
to ledge...@googlegroups.com
As an extension of "lot pricing", you can now fixate the per-unit
price of a commodity.

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

Austin F. Frank

unread,
Apr 15, 2009, 7:05:32 PM4/15/09
to Ledger
On Mar 2, 5:04 pm, John Wiegley <jo...@newartisans.com> wrote:

>      2009/01/01 Shell
>          Expenses:Gasoline             11 GAL {=$2.29} @ $2.30
>          Assets:Checking

This is a great feature, and thanks for implementing it. I was
wondering whether it could be extended to handle the @@ syntax as
well. I just bought some gas, and my account isn't balancing because
of a $-0.01 difference between the price per gallon and what went onto
my card

2009/04/15 Gas at Hess
Expenses:Auto:Gas 12.68 gallons {=$2.359} @@ $29.92
Assets:Checking

Could the $-0.01 difference between 12.68 * $2.359 and $29.92 be
folded into Equity:Capital Losses the same way it would be in John's
example above?

Thanks,
/au
Reply all
Reply to author
Forward
0 new messages