original_docstring: Downloads daily or historical data. Defaults to daily.
docstring: Downloads daily or historical data. Defaults to daily.
docstring_tokens: Downloads daily or historical data . Defaults to daily .
code: async def download_rates(daily=True):
      """Downloads daily or historical data. Defaults to daily."""
  
      euro_forex_daily_url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref.zip"
      euro_forex_all_url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip"
  
      if daily:
          zip_file = "eurofxref.zip"
          zip_file_path = f"data/{zip_file}"
          r = requests.get(euro_forex_daily_url)
          if r.status_code == 200:
              with open(zip_file_path, "wb") as f:
                  for chunk in r.iter_content(chunk_size=128):
                      f.write(chunk)
              f.close()
              await import_data(zip_file_path)
      else:
          zip_file = "eurofxref-hist.zip"
          zip_file_path = f"data/{zip_file}"
          r = requests.get(euro_forex_all_url)
          if r.status_code == 200:
              with open(zip_file_path, "wb") as f:
                  for chunk in r.iter_content(chunk_size=128):
                      f.write(chunk)
              f.close()
              await import_hist_data(zip_file_path)
code_tokens: async def download_rates ( daily = True ) : euro_forex_daily_url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref.zip" euro_forex_all_url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip" if daily : zip_file = "eurofxref.zip" zip_file_path = f"data/{zip_file}" r = requests . get ( euro_forex_daily_url ) if r . status_code == 200 : with open ( zip_file_path , "wb" ) as f : for chunk in r . iter_content ( chunk_size = 128 ) : f . write ( chunk ) f . close ( ) await import_data ( zip_file_path ) else : zip_file = "eurofxref-hist.zip" zip_file_path = f"data/{zip_file}" r = requests . get ( euro_forex_all_url ) if r . status_code == 200 : with open ( zip_file_path , "wb" ) as f : for chunk in r . iter_content ( chunk_size = 128 ) : f . write ( chunk ) f . close ( ) await import_hist_data ( zip_file_path )
short_docstring: Downloads daily or historical data.
short_docstring_tokens: Downloads daily or historical data .
comment: """Downloads daily or historical data. Defaults to daily."""