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

theforexapi.com is not working #149

Open
fnikky opened this issue Oct 29, 2023 · 19 comments
Open

theforexapi.com is not working #149

fnikky opened this issue Oct 29, 2023 · 19 comments

Comments

@fnikky
Copy link

fnikky commented Oct 29, 2023

theforexapi.com is not working, can I change the API to another one? Please fix the problem as soon as possible

@fhoek
Copy link

fhoek commented Oct 30, 2023

It hasn't been working since 16th of October.

@Andrewnolan13
Copy link

Andrewnolan13 commented Oct 31, 2023

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)

#Rename the file to your desired filepath
os.rename(csv_file, filepath)

......

This way you can reference the csv file you have downloaded instead of referencing the api.

ddofborg added a commit to ddofborg/exchange_rates that referenced this issue Nov 2, 2023
Based on @Andrewnolan13 comments MicroPyramid/forex-python#149 (comment) created a function to get the rates for specific currencies for a specific (or close to it) date.
@ddofborg
Copy link

ddofborg commented Nov 2, 2023

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}

@cagdasulas
Copy link

cagdasulas commented Nov 3, 2023

Is there any update regarding when the API will be again up ?

@hjerbii
Copy link

hjerbii commented Nov 3, 2023

Hello, any updates?

@fnikky
Copy link
Author

fnikky commented Nov 8, 2023

@abhijeet-1110 hi API is not working, ERROR 504, fix please.

@fnikky
Copy link
Author

fnikky commented Nov 10, 2023

@abhijeet-1110 please fix API

@ddofborg
Copy link

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).

@abhijeet-1110
Copy link
Collaborator

@ALL Sorry for the inconvenience. It is working now. Please check

@pienegu
Copy link

pienegu commented Jan 18, 2024

@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

@msarokinmkrst
Copy link

Hi @abhijeet-1110

Is there a way to make the API available again? It's down as many people mentioned here 😄

@bambussoeren
Copy link

bambussoeren commented Feb 21, 2024

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.

@abhijeet-1110
Copy link
Collaborator

@ALL My sincere apologies to all,Due to server upgradtion currently facing the issue.
We can't repeat it

@DLu
Copy link

DLu commented Feb 21, 2024

You can't repeat the problem, or you can't repeat the solution you used before?

@ddofborg
Copy link

There are some other packages which use ECB data (with caching). That should stay up:)
See #149 (comment) and #149 (comment)

@DavidGergov03
Copy link

@ddofborg i downloaded exchange_rates but there is no function get_exchange_rates in it?

@ddofborg
Copy link

@ddofborg i downloaded exchange_rates but there is no function get_exchange_rates in it?

It's there:

https://github.com/ddofborg/exchange_rates/blob/d0e7e0f6cf377850ac674f36be967b2f6094a5dd/exchange_rates.py#L35

@ThibaultDC
Copy link

Hello, still not working

@ddofborg
Copy link

Hello, still not working

Please give me some context, otherwise there is really no advice I can give you.

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