New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

periodic value reports should use the market prices of each period #329

Open
vessenes opened this Issue Mar 8, 2016 · 7 comments

Comments

Projects
None yet
4 participants
@vessenes

vessenes commented Mar 8, 2016

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: P 2015/03/16 AU 1200.23 implying a $1200.23 price per ounce of gold. There is one per day, and they are in order with other journal transactions.

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.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Mar 8, 2016

Owner

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 balance, are more low-level than standard accounting reports; hledger's balance sheet/income statement/cashflow commands are supposed to be a bit more like real accounting statements. I agree balance -V could probably do something better here. I'm not sure if that will make it work differently from Ledger's balance -V.

Owner

simonmichael commented Mar 8, 2016

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 balance, are more low-level than standard accounting reports; hledger's balance sheet/income statement/cashflow commands are supposed to be a bit more like real accounting statements. I agree balance -V could probably do something better here. I'm not sure if that will make it work differently from Ledger's balance -V.

@simonmichael simonmichael added the balance label Mar 8, 2016

@vessenes

This comment has been minimized.

Show comment
Hide comment
@vessenes

vessenes Mar 8, 2016

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:

                                  Week 1    |    Week 2    |   Week 3
-------------------------------------------------------------------
Assets:AU                           1  AU   |      2 AU    |     3 AU

And the Cumulative P&L would read

Income:Mining:AU                    -1 AU   |     -2 AU    |    -3 AU

I then run the cumulative reports dollar denominated. (with -V as we've been discussing). I would expect something like the following:

                                                     Week 1    |    Week 2    |   Week 3
------------------------------------------------------------------------------------------
Assets:AU                                              $500    |      $2000   |   $750

The P&L would Contain

Income:Mining:AU                                       -$500   |     -$1500    | -$1750
Other Income: Mark To Market                               $0  |     -$ 500    |  $1000

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. 😄 But I think this would add significant correctness to reports. I'd hate to think of people filing reports with tax authorities without this working.

vessenes commented Mar 8, 2016

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:

                                  Week 1    |    Week 2    |   Week 3
-------------------------------------------------------------------
Assets:AU                           1  AU   |      2 AU    |     3 AU

And the Cumulative P&L would read

Income:Mining:AU                    -1 AU   |     -2 AU    |    -3 AU

I then run the cumulative reports dollar denominated. (with -V as we've been discussing). I would expect something like the following:

                                                     Week 1    |    Week 2    |   Week 3
------------------------------------------------------------------------------------------
Assets:AU                                              $500    |      $2000   |   $750

The P&L would Contain

Income:Mining:AU                                       -$500   |     -$1500    | -$1750
Other Income: Mark To Market                               $0  |     -$ 500    |  $1000

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. 😄 But I think this would add significant correctness to reports. I'd hate to think of people filing reports with tax authorities without this working.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Mar 8, 2016

Owner

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.

Owner

simonmichael commented Mar 8, 2016

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.

@simonmichael simonmichael added the A WISH label Mar 8, 2016

@simonmichael simonmichael added this to the 1.0 milestone Mar 8, 2016

@vessenes

This comment has been minimized.

Show comment
Hide comment
@vessenes

vessenes Mar 8, 2016

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.

vessenes commented Mar 8, 2016

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.

@simonmichael simonmichael modified the milestone: post 1.0 Oct 31, 2016

@simonmichael simonmichael changed the title from multi commodity, values and balance sheets to periodic value reports should use the market prices of each period May 5, 2018

@devbanana

This comment has been minimized.

Show comment
Hide comment
@devbanana

devbanana Aug 5, 2018

This seems like an old issue, but I would also like to see this sort of functionality. I was surprised when the multi-column balance view showed the prices as of the latest date.

devbanana commented Aug 5, 2018

This seems like an old issue, but I would also like to see this sort of functionality. I was surprised when the multi-column balance view showed the prices as of the latest date.

@jeauxlb

This comment has been minimized.

Show comment
Hide comment
@jeauxlb

jeauxlb Aug 29, 2018

Just adding my voice to the chorus of support for this feature. I have recently incorporated stocks into my hledger reporting and was also surprised to find hledger not reflecting then-current prices over reporting windows.

jeauxlb commented Aug 29, 2018

Just adding my voice to the chorus of support for this feature. I have recently incorporated stocks into my hledger reporting and was also surprised to find hledger not reflecting then-current prices over reporting windows.

@simonmichael

This comment has been minimized.

Show comment
Hide comment
@simonmichael

simonmichael Aug 29, 2018

Owner

Would someone like to work on this ? I guess it will be not too hard.

Owner

simonmichael commented Aug 29, 2018

Would someone like to work on this ? I guess it will be not too hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment