[bug]: `exchange_rate`: it does not work for `GBP` to `USD`
mcgizzle opened this issue · 1 comments
mcgizzle commented
Check the bug has not already been reported
- I could not find the bug in existing issues
Edit function_name
and the short error description in title above
- I wrote the correct function name and a short error description in the title above
What happened and what did you expect?
select bigfunctions.eu.exchange_rate('GBP', 'USD')
returns null
It works in all other cases I tested, even the reverse exchange_rate('USD', 'GBP')
works
unytics commented
Thanks a lot @mcgizzle for opening this issue.
I suspect this happens when there are too many calls to yahoo finance.
I improved the function by:
- checking the country given in input against ISO 4217 country codes and do NOT calling yahoo finance if the country code is not valid.
- improving the cache management by NOT storing None in cache if yfinance does not return expected result.
I hope it will solve the issue.
Can you please tell me if you encounter null values again?
Thanks