Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
periodic value reports should use the market prices of each period #329
I am having trouble with hledger's balance sheet reporting and I think there's a bug in how the reports work.
For reference, I have a business I'm modeling, something like a gold mine where I get revenues directly in a commodity. The business has a hedging component, so it might hold or sell the commodity on any given day. It also has (dollar-denominated) expenses.
To test out the hedging strategy, I'm using hledger against a file to see what period balance sheet reports would be, and I want to incorporate the mark-to-market impacts of hedging or not.
The --value flag sounded good, but it does something very strange: the balance command books commodities at what looks like their final price in the journal.
Perusing this conversation https://groups.google.com/forum/#!topic/hledger/e8Ss7ZL4ADI makes me think that might have been the intent for the initial push on this very, very useful functionality. But, I might be doing something wrong -- let me know.
My lines in the ledger for pricing are like this:
My reasoning on why this is wrong is pretty simple: balance sheets / statements should never change based on future information. They are supposed to be an immutable record of the state of finances at a moment in time.
Am I understanding the current situation correctly, and if so, any thoughts on a fix? I'm a total haskell newbie but would be willing to give it a go if you pointed me in the right direction.
Thanks for the report. Yes, balance -V uses the price as of the report period end date (or the end of your journal) (http://hledger.org/manual.html#market-prices).
As I said in the thread, I think using the price at the end of each report interval (for a multi-column balance report) would be more useful. But this might still not be what you want; can you give an example showing how you think it should work ?
What you say about statements depending only on past information makes perfect sense. Though, *ledger's basic commands, especially
I guess I am mostly motivated by having 'real' balance sheets, and I don't know enough about hledger's internals to speculate how you'd want to implement.
Here's how I, as a business person, would want to look at a Balance Sheet with some Gold on it.
Say I obtain 1 oz of gold a week, and the prices are 500, 1000, 250 respectively at the end of the week per oz. The cumulative balance sheet without the -V I would expect to look like this:
And the Cumulative P&L would read
I then run the cumulative reports dollar denominated. (with -V as we've been discussing). I would expect something like the following:
The P&L would Contain
Those Income statements would obviously flow through to Equity on the Balance Sheet.
Interpreted: Week 1 we made $500 mining. Week 2 we made $500 mining and $500 in market appreciation from holding the gold. Week 3 we made $250 in Mining Income and Lost $1000 due to gold prices dropping.
NB, I'm also looking at beancount right now, which seems to have a lot here, including basis calculations. So, don't push ahead on this just on account of me.
Yes beancount has more in this area, but this is very helpful - thanks. It sounds like using the price at the end of each report period will work well - good.
"Mark to market" is a useful term I didn't know. Ledger reports that change as "capital gains/losses"; hledger doesn't report this explicitly yet. Isn't there some error in the last P&L example ? In week 2 I'd think you made $1000 mining (1 oz of gold at that week's price of $1000) and $500 on the revaluation of week 1's oz from $500 to $1000.
Capital Gains/Losses makes sense to me as well.
I think it's right -- it's a cumulative P&L by period. If the P&L isn't cumulative, then you're correct. Net Income for the week (marked to market) was $1500. In my example I carried forward the prior week's mining income (hence cumulative). This has the impact of allowing market change impacts on holdings to be pulled out into a separate row.