Which currency exchange rate price source to use?

182 views
Skip to first unread message

Oon-Ee Ng

unread,
Apr 26, 2021, 11:17:53 PM4/26/21
to bean...@googlegroups.com
I've tried out https://github.com/xuhcc/beancount-exchangerates so far, and can't figure out installation for https://github.com/tarioch/beancounttools

Exchangerates gives me output looking like this:-

2021-04-27 price USD:CUR    X.XXXX CUR

instead of (what I think is supposed to be) the correct:-

2021-04-27 price USD     X.XXXX CUR

I don't recognise the above syntax, should I be doing a simple sed to get it into the format I'm already using (the 2nd one)? What does it even mean? Would using beancounttools be 'better'?

Patrick Ruckstuhl

unread,
Apr 27, 2021, 2:53:08 AM4/27/21
to bean...@googlegroups.com

Hi,

what issues did you encounter when installing beancounttools? Should be a simple


pip install tariochbctools


As for the config, probably it's tied to the way you setup your commodities. The way I have mine configured are like this

2019-01-01 commodity EUR
  price: "CHF:tariochbctools.plugins.prices.exchangeratesapi/EUR"

So the symbol I use in beancount is EUR, but the symbol for the price lookup might be something else


Regards,

Patrick

--
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/CAGQ70evy9CBkxPQZL5dgV08YwnqiDF9Zr%3Dx%3DkZ%3Dujv5XoGBz6g%40mail.gmail.com.

Oon-Ee Ng

unread,
May 7, 2021, 7:45:09 PM5/7/21
to bean...@googlegroups.com
Well it didn't show up on pypi with a search for 'beancounttools', and the github page doesn't list this pypi package so I only found out about it from your email (thanks!)

But... why is everything hardcoded to be CHF? Was so confused with the initial results I was getting.

Patrick Ruckstuhl

unread,
May 7, 2021, 8:01:11 PM5/7/21
to bean...@googlegroups.com, Oon-Ee Ng
Hi,

Thanks for getting back on this. There is the link to pypi at the very top with the image but it makes sense to describe this as well.
Sorry about the hardcoding to CHF, that's what I need and I haven't made this flexible everywhere. I noticed this when I started creating a pr for beanprice. I was thinking to move my price fetchers there and planning to fix it as part of the move. But I haven't heard back anything on my pr for almost a month, so I should probably enhance them in my repo. Which ones are you most interested?

Regards,
Patrick

Oon-Ee Ng

unread,
May 7, 2021, 8:56:12 PM5/7/21
to Patrick Ruckstuhl, bean...@googlegroups.com
Well I don't really suggest you accommodate my own currency since I may possibly be the only beancount user there. Really should be something we specify ourselves somewhere (no idea how that can be achieved).

Patrick Ruckstuhl

unread,
May 8, 2021, 2:32:43 AM5/8/21
to Oon-Ee Ng, bean...@googlegroups.com
Yes, what I meant which price source (e.g. exchangeratesapi, alphabantage, ...) do you want to use?

Oon-Ee Ng

unread,
May 8, 2021, 9:31:03 AM5/8/21
to Patrick Ruckstuhl, bean...@googlegroups.com
Currently exchangeratesapi. Am not really picky, just trying to automate the process rather than manually specifying flunctuations in my home currency.

Patrick Ruckstuhl

unread,
May 9, 2021, 3:00:33 AM5/9/21
to Oon-Ee Ng, bean...@googlegroups.com

Hi,

my pr just got merged into beanprice. So you can use this

pip install git+https://github.com/beancount/beanprice.git

and then specify the commodity like this

2000-01-01 commodity USD
  price: "CHF:ratesapi/USD-CHF"

if you want to use EUR as base (instead of CHF) then it would be

2000-01-01 commodity USD
  price: "EUR:ratesapi/USD-EUR"


similar for other base currencies.


It's using https://ratesapi.io/documentation/ for the lookup. Data is coming from

https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

this should give you an idea which currency pairs you can use.


Regards,

Patrick

Reply all
Reply to author
Forward
0 new messages