"A valid price for … could not be found"

101 views
Skip to first unread message

Matthew Harris

unread,
Oct 13, 2016, 4:11:35 PM10/13/16
to Beancount
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?

Jason Chu

unread,
Oct 13, 2016, 5:15:42 PM10/13/16
to Beancount
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.

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.

--
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.
For more options, visit https://groups.google.com/d/optout.

Martin Blais

unread,
Oct 13, 2016, 9:40:47 PM10/13/16
to Beancount
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:

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:

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+unsubscribe@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.
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+unsubscribe@googlegroups.com.

To post to this group, send email to bean...@googlegroups.com.

Matthew Harris

unread,
Oct 14, 2016, 1:14:12 PM10/14/16
to Beancount
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

and

2005-05-24 * "Home Purchase"
  Assets:Home  1 HOUSE {100000.00 USD} @ 100000.00 USD
  Liabilities:Mortgage  -100000.00 USD

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

What am I doing wrong? A short example in the Cookbook would be helpful.
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.
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.

Martin Blais

unread,
Oct 14, 2016, 9:40:50 PM10/14/16
to Beancount
On Fri, Oct 14, 2016 at 1:14 PM, Matthew Harris <mharr...@gmail.com> 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.


 
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscribe@googlegroups.com.

To post to this group, send email to bean...@googlegroups.com.

Matthew Harris

unread,
Oct 14, 2016, 11:33:39 PM10/14/16
to Beancount
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!

Martin Blais

unread,
Oct 14, 2016, 11:38:15 PM10/14/16
to Beancount
Yes. 
(See Note: from 3rd message in thread :-))

To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscribe@googlegroups.com.

To post to this group, send email to bean...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages