make_gmx_api_request
Documentation for eth_defi.gmx.retry.make_gmx_api_request function.
- make_gmx_api_request(chain, endpoint, params=None, timeout=10.0, retry_config=None, max_retries=None, retry_delay=None)
Make a GMX API request with full-cycle retry.
This is the SINGLE centralised function for all GMX API calls. It handles:
Retry with exponential backoff per endpoint
Automatic failover from primary to backup to fallback APIs
Full-cycle retry: primary → backup → fallback → fallback-2 → wait → repeat
Retry flow:
Try primary API (max_retries attempts with exponential backoff)
Try backup API (max_retries attempts with exponential backoff)
Try fallback API (max_retries attempts with exponential backoff)
Try fallback-2 API (max_retries attempts with exponential backoff)
Wait initial_delay, then repeat full cycle
After full_cycle_retries full cycles, raise RuntimeError
- Parameters
chain (str) – Chain name (e.g., “arbitrum”, “avalanche”)
endpoint (str) – API endpoint path (e.g., “/tokens”, “/signed_prices/latest”)
timeout (float) – HTTP request timeout in seconds
retry_config (eth_defi.gmx.retry.GMXRetryConfig | None) – Retry behaviour configuration. Uses
DEFAULT_RETRY_CONFIGwhenNone.max_retries (int | None) – Deprecated. Kept for backwards compatibility but ignored.
retry_delay (float | None) – Deprecated. Kept for backwards compatibility but ignored.
- Returns
Parsed JSON response
- Raises
RuntimeError – If all retries and backup attempts fail
- Return type