Right way to retrieve price with bean-query

57 views
Skip to first unread message

pat...@ch.tario.org

unread,
Nov 21, 2017, 12:34:54 PM11/21/17
to Beancount
Hi,

As I'm trying to interface with beancount only through bean-query, I'm wondering if I'm doing it right to retrieve a certain price at a certain date.

To select a single price I'm doing this:

select distinct getprice('USD', 'CHF', #'2017-10-10')

This works but it looks like what's happening in the back is that it does the getprice call for each position and then only reduced it down to a single response because of the distinct (without the distinct I'm getting N-times the price.
Is there something that I'm missing? Is there something similar to the oracle "select from dual" to avoid this?

Thanks and Regards,
Patrick



pat...@ch.tario.org

unread,
Nov 21, 2017, 12:38:45 PM11/21/17
to Beancount
Responding to myself. I think I can do it like this:

select getprice('USD', 'CHF', #'2017-10-10') limit 1
Reply all
Reply to author
Forward
0 new messages