Any idea when you'll be able to make these sorts of changes? Given the holidays, I may have slightly more time to work on the fava side of it if I had a market value method I could use.
I just realized it would also have to be plumbed through bean-query because I also have queries that pull together all my "retirement" savings and give me one number that I'd like to have in market value as well. That part could wait though. On Thu, Dec 8, 2016 at 8:28 AM Martin Blais <[email protected]> wrote: > This is where the "weight" of a posting is currently calculated: > > https://bitbucket.org/blais/beancount/src/c796e5e34b8fbd05862847ff809c1240130c59e0/src/python/beancount/core/interpolate.py?at=default&fileviewer=file-view-default#interpolate.py-57 > A function to compute the market value from an Inventory should be next to > it. > > I should make a function next to it which accepts a price_map and a date > and which computes the market value from it. I'm sure I have two or three > versions of this all over, e.g., > > https://bitbucket.org/blais/beancount/src/c796e5e34b8fbd05862847ff809c1240130c59e0/src/python/beancount/ops/holdings.py?at=default&fileviewer=file-view-default#holdings.py-476 > (Note: The concept of Holding will go away at some point, and be replaced > with a set of Posting objects, creating Holding was a mistake.) > > I'll add a function for you, somewhere in the core. I think the Right > Thing I need to do is review the redundant calculations of cost, weight and > market value and refactor some things to have a single location where they > all are next to each other. That would clean up code. I'll do that. > > > > On Wed, Dec 7, 2016 at 2:14 PM, Jason Chu <[email protected]> wrote: > > Proposal: Add market(self, date) method to Inventory ( > https://bitbucket.org/blais/beancount/src/c796e5e34b8fbd05862847ff809c1240130c59e0/src/python/beancount/core/inventory.py?at=default&fileviewer=file-view-default#inventory.py-68) > and add a switch somewhere in fava to toggle between cost and market values. > > Background > > Given the discussions in https://github.com/beancount/fava/issues/129 and > https://github.com/beancount/fava/issues/242, I think I understand the > problem enough to try to explain it. > > Right now when we generate balances and charts, we always use the cost of > the inventory. It is apparently the correct accounting method, but it also > doesn't change over time. Currently the way to see commodities at cost is > to use something like the unrealized plugin (or my multi-month version of > it https://github.com/xentac/beancount-plugins-xentac). Unfortunately > this isn't ideal. > > The ideal situation, as Martin points out is to convert to market value at > a particular date instead of at cost. The market method on Inventory would > have to take a date upon which to look up the nearest price in the price > db. Perhaps the default could even be today's date, so you could just > render everything at today's value if you wanted (would work great for fava > balances). > > There's one question I have though. Would I have to create some sort of > Equity transaction that balanced out the transactions or is it enough to > consider market rates as "magical" value that's added only at > display/evaluation time? > > I don't mind doing this work, I think I understand the problem well enough > to execute it. > > Thoughts? > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/CAFFHUguzenTBz67QsGVOKOP%3DEK3mQ4OXa%2B5gL1MVaVOWC4agUw%40mail.gmail.com > <https://groups.google.com/d/msgid/beancount/CAFFHUguzenTBz67QsGVOKOP%3DEK3mQ4OXa%2B5gL1MVaVOWC4agUw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/CAK21%2BhN9Pp9nijdb2xjDR-gs4O6hGUao4W%3DvV8a653xThUepVQ%40mail.gmail.com > <https://groups.google.com/d/msgid/beancount/CAK21%2BhN9Pp9nijdb2xjDR-gs4O6hGUao4W%3DvV8a653xThUepVQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAFFHUgttYuNPecUcNqOJTbivwUtPhc9hSfGLjDcWa8%3Dv9ce1YA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
