Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CurrencyRates conversion is not correct. #138

Open
muhammad-grayphite opened this issue Jul 24, 2023 · 2 comments
Open

CurrencyRates conversion is not correct. #138

muhammad-grayphite opened this issue Jul 24, 2023 · 2 comments

Comments

@muhammad-grayphite
Copy link

I have a usecase where I am converting VND to USD but conversion rate are not valid. for example:
Screenshot 2023-07-24 at 1 31 35 PM
Screenshot 2023-07-24 at 1 31 50 PM

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

@Cruuncher
Copy link

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

@janosspaits
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants