Open fnikky opened 1 year ago
It hasn't been working since 16th of October.
Hi, the API pulls form the European Central Bank website. Alternatively, you can go to the ECB website and just download the csv.
a more automated way of doing this is the following:
import requests import zipfile import io
url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip?a6ef9319d740f54c034942a0317114f8" filepath = ... #where you want to save the csv
response = requests.get(url) z = zipfile.ZipFile(io.BytesIO(response.content)) z.extractall()
csv_file = z.namelist()[0] z.extract(csv_file)
os.rename(csv_file, filepath)
......
This way you can reference the csv file you have downloaded instead of referencing the api.
Based on @Andrewnolan13 comment I created a function which downloads the ZIP and generates the rates. See https://github.com/ddofborg/exchange_rates
Get a list of exchange rates for a given currency on a given date. Data is download from the European Central Bank history zipfile.
Note, rates are not cached. Each request will download the data again.
Usage:
>>> from exchange_rates import get_exchange_rates
>>> print( get_exchange_rates('USD', target_currencies=['EUR', 'CAD', 'USD'], on_date='2023-10-01') )
{'EUR': 0.9496676163342831, 'CAD': 1.3613485280151947, 'USD': 1.0}
>>> print( get_exchange_rates('EUR', target_currencies=['EUR', 'CAD', 'USD'], on_date='2023-10-01') )
{'EUR': 1.0, 'CAD': 1.4335, 'USD': 1.053}
Is there any update regarding when the API will be again up ?
Hello, any updates?
@abhijeet-1110 hi API is not working, ERROR 504, fix please.
@abhijeet-1110 please fix API
I think theforexapi.com is dead.
Some other packages which work: https://github.com/ddofborg/exchange_rates (mine, returns a dict with rates) and https://github.com/oddaspa/easy-exchange-rates (returns a pandas dataframe).
@all Sorry for the inconvenience. It is working now. Please check
@ddofborg Thanks for a simple and stable solution. The ECB is seldom down.
I made a wrapper that caches the rates and only downloads new rates once a day. It migh be useful to others. https://github.com/pienegu/div/blob/main/exchange_rates_cached
Hi @abhijeet-1110
Is there a way to make the API available again? It's down as many people mentioned here 😄
The api / the python module is very unreliable I have to say. Serveral days unavailable each month. Will use different api / module in the future, despite liking the ease of use for this module.
@all My sincere apologies to all,Due to server upgradtion currently facing the issue. We can't repeat it
You can't repeat the problem, or you can't repeat the solution you used before?
There are some other packages which use ECB data (with caching). That should stay up:) See https://github.com/MicroPyramid/forex-python/issues/149#issuecomment-1805480580 and https://github.com/MicroPyramid/forex-python/issues/149#issuecomment-1805480580
@ddofborg i downloaded exchange_rates but there is no function get_exchange_rates in it?
@ddofborg i downloaded exchange_rates but there is no function get_exchange_rates in it?
It's there:
Hello, still not working
Hello, still not working
Please give me some context, otherwise there is really no advice I can give you.
theforexapi.com is not working, can I change the API to another one? Please fix the problem as soon as possible