MicroPyramid / forex-python

Foreign exchange rates, Bitcoin price index and currency conversion using ratesapi.io
http://forex-python.readthedocs.io/en/latest/usage.html
MIT License
661 stars 195 forks source link

TheForexapi website is down #142

Closed MysteriousBaboon closed 1 year ago

MysteriousBaboon commented 1 year ago

When I'm trying to requests any URL from https://theforexapi.com i get an error 504. Seems like it went down 2 days ago

JadeJuno commented 1 year ago

Seems to be back up now. Please close if that's the case.

janosspaits commented 1 year ago

it is back up now, but some rates are not correct. for example:

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