bean-price with yahoo reporting invalid currency

93 views
Skip to first unread message

kunagu varun kumar

unread,
Dec 4, 2023, 7:08:31 AM12/4/23
to Beancount
Hi,

I'm new to beancount and setting up bean-price to get latest currency information. I'm trying to convert USD to INR and I'm getting invalid results. Can someone help me understand why data is incorrect?

1 USD  is 83.30 INR

bean-price -d `date -u +%Y-%m-%dT%H:%M:%S` -e "INR:yahoo/USD"


2023-12-01 price USD                     44.68000030517578 INR

Chris Berkhout

unread,
Dec 5, 2023, 2:53:54 AM12/5/23
to bean...@googlegroups.com
Hi


This will get the right price:
bean-price -d `date -u +%Y-%m-%dT%H:%M:%S` -e "INR:yahoo/INR=X"
2023-12-05 price INR=X                   83.36799621582031 INR

I'm not sure that you can rename INR=X to USD with a single bean-price command. Using a Beancount file will help there:
; input.beancount
2023-12-01 commodity USD
  price: "INR:yahoo/INR=X"

bean-price input.beancount --update --update-rate daily --inactive --clear-cache
2023-12-01 price USD                     83.35269927978516 INR
2023-12-01 price USD                     83.35269927978516 INR
2023-12-01 price USD                     83.35269927978516 INR
2023-12-04 price USD                     83.21859741210938 INR

Alternatively, pricehist (https://gitlab.com/chrisberkhout/pricehist) will do it without a file, and without repeating Friday prices for weekend days:
pricehist fetch yahoo --start 2023-12-01 INR=X --fmt-base USD --output beancount
2023-12-01 price USD 83.352699 INR
2023-12-04 price USD 83.218597 INR
2023-12-05 price USD 83.363998 INR

Cheers,
Chris


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/542ec38f-eb77-4e27-8194-3d35455dec54n%40googlegroups.com.

Chris Berkhout

unread,
Dec 5, 2023, 2:58:54 AM12/5/23
to bean...@googlegroups.com
...and without repeating Friday prices for weekend days:
 
leaving out "--update-rate daily" will do that in bean-price:

bean-price input.beancount --update --inactive --clear-cache
2023-12-01 price USD                     83.35269927978516 INR

kunagu varun kumar

unread,
Dec 8, 2023, 7:15:43 AM12/8/23
to Beancount
Awesome. Thanks for this
Reply all
Reply to author
Forward
0 new messages