hledger icon indicating copy to clipboard operation
hledger copied to clipboard

generate revaluation transactions when market prices change ?

Open simonmichael opened this issue 9 years ago • 0 comments

rui1 asked on #hledger why examples like this give a non-zero final total (assuming -B is not added), seemingly contrary to the accounting equation:

2016/07/21 Test
    assets:cash        USD 1000
    income:salary   USD -1000.0

2016/07/21 Buy blobs
    assets:blobs  100 BLOBS @ USD 10
    assets:cash            USD -1000

2016/07/21 Sell blobs
    assets:blobs  -100 BLOBS @ USD 20
    assets:cash              2000 USD

The buying and selling of BLOBS at different transaction prices implies a revaluation transaction, which could be written manually like this:

2016/07/21 Blobs become more valuable
    assets:blobs    -100 BLOBS @ USD 10
    assets:blobs     100 BLOBS @ USD 20
    income:capital gains      USD -1000

which restores the final total to zero as expected.

A similar situation arises when market prices change. Ledger generates revaluation transactions automatically when market prices change, and so will we at some point.

Can/should we also generate revaluation transactions for a transaction price change like the above ? This raises some questions (how transaction prices and market prices interact, should it be done by default..) and needs some exploring. The goal would be to make things more clear, intuitive, and robust.

simonmichael avatar Jul 22 '16 18:07 simonmichael