Aha. With "bean-query print" I was able to determine that I needed to put the implicit_prices plugin before the unrealized plugin. Now I'm warning-free. Thank you!
On Friday, October 14, 2016 at 6:40:50 PM UTC-7, Martin Blais wrote: > > On Fri, Oct 14, 2016 at 1:14 PM, Matthew Harris <mharr...@gmail.com > <javascript:>> wrote: > >> In the Language manual, you say a Price directive is synthesized when a >> posting has a cost or price. But I get the "A valid price for HOUSE/USD >> could not be found" warning with >> >> 2005-05-24 * "Home Purchase" >> Assets:Home 1 HOUSE {100000.00 USD} >> Liabilities:Mortgage -100000.00 USD >> >> > This does not create a price directive, that's the problem. > > >> >> and >> >> 2005-05-24 * "Home Purchase" >> Assets:Home 1 HOUSE {100000.00 USD} @ 100000.00 USD >> Liabilities:Mortgage -100000.00 USD >> >> > Same here. > However, if you added the implicit_prices plugin, it will generate a price > directive based on the "@ 100000.00 USD" and you'd be fine. > > > but not >> >> 2005-05-24 * "Home Purchase" >> Assets:Home 1 HOUSE {100000.00 USD} >> Liabilities:Mortgage -100000.00 USD >> 2005-05-24 price HOUSE 1000000.00 USD >> >> > This works because you provide an explicit price directive. > > >> >> What am I doing wrong? A short example in the Cookbook would be helpful. >> > > Have you tried debugging using "bean-query <file> print" ? > This is a way you can print all the interpreted directives and see if a > Price directive is present or not. > > > > >> >> >> On Thursday, October 13, 2016 at 6:40:47 PM UTC-7, Martin Blais wrote: >>> >>> Matthew: This is not a bug, but rather a choice I made a while ago that >>> instead of silently ignoring the unrealized gains if you didn't provide >>> some price information, to warn about it instead: >>> >>> https://bitbucket.org/blais/beancount/src/tip/src/python/beancount/plugins/unrealized.py?fileviewer=file-view-default#unrealized.py-89 >>> >>> If you prefer I could simply ignore the error here and skip the addition >>> of an unrealized gain. Let me know if you think this is sensible. >>> (Personally I think it's more sensible for you to provide an estimate price >>> value for your home, every year, based on comparables.) >>> >>> >>> On Thu, Oct 13, 2016 at 5:15 PM, Jason Chu <xen...@gmail.com> wrote: >>> >>>> I had to use the add_implicit_prices plugin ( >>>> https://bitbucket.org/blais/beancount/src/5e2dcbfc81b15cfbaa9d743ee87d8f4f26eaf0cb/src/python/beancount/plugins/implicit_prices.py?at=default&fileviewer=file-view-default) >>>> >>>> to turn entries like these into prices. >>>> >>> >>> This will work too. >>> Unless you have some really tight and automated way to create your price >>> entries, this should probably be welcome in everyone's file (I'm using it). >>> >>> Note: If you do this, make sure you put the implicit_prices plugin >>> _before_ the unrealized_gains one, so it creates the price directives >>> before the check from the unrealized gains plugin. >>> >>> I hope this helps, >>> >>> >>> >>> You should try out my unrealized_periodic plugin ( >>>> https://github.com/xentac/beancount-plugins-xentac). Instead of a >>>> single transaction, I create monthly transactions tracking gains over >>>> time. It uses the same calculation code, it's just an extension to remove >>>> the old unrealized amount and add the new unrealized amount in the same >>>> transaction each month. I like it because it better represents gains over >>>> time. Ideally it would update gains every time the price changes, but >>>> that >>>> leads to too many transactions and the plugin goes really slowly. >>>> >>>> On Thu, Oct 13, 2016 at 1:11 PM Matthew Harris <mharr...@gmail.com> >>>> wrote: >>>> >>>>> Hi, Martin. I know you claimed to have eliminated a bunch of "a valid >>>>> price for … could not be found" errors from the unrealized gains plugin a >>>>> year ago, but I'm still getting a bunch of them in my file. It's so many >>>>> that I'm not even sure where to begin. >>>>> >>>>> Okay, here's one that should be easy. It's not my common case, but >>>>> it's easy to isolate because I only have one transaction with it: >>>>> >>>>> ;; -*- mode: org; mode: beancount; coding: utf-8 -*- >>>>> >>>>> option "operating_currency" "USD" >>>>> plugin "beancount.plugins.auto_accounts" >>>>> plugin "beancount.plugins.unrealized" "Unrealized" >>>>> >>>>> 2005-05-24 * "Home Purchase" >>>>> Assets:Home 1 HOUSE {100000.00 USD} >>>>> Liabilities:Mortgage >>>>> >>>>> >>>>> When I run bean-query on this file, I get >>>>> >>>>> <unrealized_gains>:0: A valid price for HOUSE/USD could not be >>>>> found >>>>> >>>>> >>>>> Am I expressing this transaction correctly, and is it a bug that I'm >>>>> still seeing this error? >>>>> >>>>> -- >>>>> 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 beancount+...@googlegroups.com. >>>>> To post to this group, send email to bean...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/beancount/27f70f8b-694d-4f0e-bece-bf84c45904f9%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/beancount/27f70f8b-694d-4f0e-bece-bf84c45904f9%40googlegroups.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 beancount+...@googlegroups.com. >>>> To post to this group, send email to bean...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/beancount/CAFFHUgscsNwrnZhSDHGS34_QeEBy3NFfjo0rz%3Dxo130usRG0hQ%40mail.gmail.com >>>> >>>> <https://groups.google.com/d/msgid/beancount/CAFFHUgscsNwrnZhSDHGS34_QeEBy3NFfjo0rz%3Dxo130usRG0hQ%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 beancount+...@googlegroups.com <javascript:>. >> To post to this group, send email to bean...@googlegroups.com >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beancount/9e4a9c17-5903-4656-a88b-1b1539af8249%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beancount/9e4a9c17-5903-4656-a88b-1b1539af8249%40googlegroups.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 beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/5b6653dd-ce41-45ae-a10a-a74d75c5a93c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.