0

Title sums it up. I cannot use most API because they have a ratelimit and I have 50-60k values I need to retrieve from different days and currencies(it's about as many different days as requests).

I tried using from forex_python.converter import CurrencyRates

With a script that looks like that :

def get_exchange_rate(from_currency: str, date_ts: int, to_currency: str = "USD"):
    """
    This function returns the historical exchange rate between two currencies
    """
    cr = CurrencyRates()

    date = datetime.datetime.fromtimestamp(date_ts)
    rate = cr.get_rate(from_currency, to_currency, date)
    return rate

The issue is that it returns an error: forex_python.converter.RatesNotAvailableError: Currency Rates Source Not Ready and when I looked it up people were saying it's not a bug it's just that the distant server the library tries to query is not up right now.

Thanks for help

lyeaf
  • 23
  • 6
  • how about you look for a ***download*** option that retrieves the entire series at once? I can't imagine why you'd even consider calling some API for individual data points, if the goal was to fetch everything – Christoph Rackwitz Jun 14 '23 at 06:25

1 Answers1

0
  1. In this situation i would recommend to obtain publicly available information sources from relevant websites of financial organizations or banks and then just store the data locally, this is one way to avoid remote APIs, but i guess you want to retrieve all that from one server.
  2. One of the options i checked for you in the net is to check if the API you're using allows batch requests, if yes, it just allows you to get several rates in one API call.

I hope I helped. Good Luck !

Jacob
  • 16
  • 2