Open muhammad-grayphite opened 1 year ago
Going from VND to USD I get an error, not a number:
Python 3.11.4 (main, Jun 20 2023, 16:59:59) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from forex_python.converter import CurrencyRates
>>> c = CurrencyRates()
>>> c.convert('VND', 'USD', 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.11/site-packages/forex_python/converter.py", line 108, in convert
raise RatesNotAvailableError("Currency Rates Source Not Ready")
forex_python.converter.RatesNotAvailableError: Currency Rates Source Not Ready
I have noticed the same thing today with GBP to EUR. It broke yesterday. 2 days ago it was the correct 1.16, now it's 0.126 or something which is completely off.
from forex_python.converter import *
from datetime import datetime, timedelta
yesterday = datetime.now() - timedelta(days=1)
now = datetime.now()
c = CurrencyRates()
start_currency='GBP'
end_currency='EUR'
money = 1.0
result = c.get_rate(base_cur=start_currency, dest_cur=end_currency, date_obj=yesterday) * money
print(result)
this prints out 0.13268758707622902
even more interestingly if you use convert instead of get_rate, it gets you the correct amount
I have a usecase where I am converting VND to USD but conversion rate are not valid. for example:
These values are not even close. if library is not supporting this currency than it should not convert. please let me know if this can be fixed. I need an API/Library which can convert all the currencies to usd even the local currencies. like Google finance