John and I had a long discussion on IRC a few days ago which resulted
in a patch that changes the definition of cost in ledger (-B).
The background of the discussion was bugs #712 and #713.
Bug #712 is about Equity:Capital Gains and Equity:Capital Loss
entries ledger automatically generates that are in my opinion
incorrect. (<
http://bugs.ledger-cli.org/show_bug.cgi?id=712>)
Bug #713 is about strange behaviour with -B after a capital gain or
loss is made (<
http://bugs.ledger-cli.org/show_bug.cgi?id=713>).
As it turns out, both of these issues can be addressed by changing the
definition of cost in ledger. In the past, if you bought 1 AAA for
$10 and then sold it for $12, ledger would take $12 as the cost. With
the patch, the cost is $10. In my opinion, this brings ledger in line
with accounting expectations.
I've done extensive tests on my own ledger files, but John and I would
like to ask for more people to test the patch before it's applied
(especialy people who made capital gains or losses). You can find the
patch on the 713-costs branch. Please test that branch and let me
know if you see any strange behaviour.
I've attached two files from John that show how ledger sees some
transactions (for the old and new behaviour).
--
Martin Michlmayr
http://www.cyrius.com/