fetch_rates_for_date
Documentation for eth_defi.currency_api.client.fetch_rates_for_date function.
- fetch_rates_for_date(session, date, base_currency, quote_currencies, source, timeout=30.0)
Fetch and classify the exchange rate document for a single date.
Tries the jsDelivr host first, falling back to the pages.dev host on a 404 or transient failure. A date is only declared
unavailablewhen both hosts return a definitive 404.- Parameters
session (requests.sessions.Session) – Shared requests session from
create_currency_api_session().date (datetime.date) – UTC calendar date to fetch.
base_currency (str) – Lower-cased base currency code; interpolated into the URL (never hardcoded
usd).quote_currencies (tuple[str, ...]) – Quote currency codes to extract from the document.
source (str) – Provider identifier stored on the returned
DateRates.timeout (float) – Per-request timeout in seconds.
- Returns
A
FetchResultclassifying the outcome.- Return type