currency_api.session
Documentation for eth_defi.currency_api.session Python module.
HTTP session factory for the fawazahmed0 Exchange API.
The endpoints are static JSON files served from a CDN (jsDelivr) with a Cloudflare Pages fallback, and the provider documents no rate limit. We therefore only need retry/backoff on the transport, not the SQLite rate-limiter used by the GRVT/Hyperliquid sessions.
Canonical API documentation: https://github.com/fawazahmed0/exchange-api
Module Attributes
Default number of transport-level retries. |
|
Default exponential backoff factor between retries. |
|
Default connection pool size. |
Functions
|
Create a |
- DEFAULT_RETRIES = 5
Default number of transport-level retries.
- DEFAULT_BACKOFF_FACTOR = 0.5
Default exponential backoff factor between retries.
- DEFAULT_POOL_MAXSIZE = 16
Default connection pool size.
- create_currency_api_session(retries=5, backoff_factor=0.5, pool_maxsize=16)
Create a
requests.Sessionconfigured for the Exchange API.Installs an
LoggingRetrypolicy with exponential backoff that retries on429and5xxresponses, and a connection pool sized for the threaded scanner. Host fallback (jsDelivr → pages.dev) is handled by the client, not here.- Parameters
- Returns
A configured session. Safe to share across threads.
- Return type
requests.sessions.Session