gmx.retry

Documentation for eth_defi.gmx.retry Python module.

GMX API Retry and Failover Logic

Centralized retry and backup failover handling for all GMX API calls.

Functions

make_gmx_api_request(chain, endpoint[, ...])

Make a GMX API request with retry logic and automatic backup failover.

make_gmx_api_request(chain, endpoint, params=None, timeout=10.0, max_retries=2, retry_delay=0.1)

Make a GMX API request with retry logic and automatic backup failover.

This is the SINGLE centralized function for all GMX API calls. It handles: - Retry with exponential backoff - Automatic failover from primary to backup API - Proper error logging and reporting

Parameters
  • chain (str) – Chain name (e.g., “arbitrum”, “avalanche”)

  • endpoint (str) – API endpoint path (e.g., “/tokens”, “/signed_prices/latest”)

  • params (Optional[dict[str, Any]]) – Optional query parameters

  • timeout (float) – HTTP request timeout in seconds

  • max_retries (int) – Maximum retry attempts per URL

  • retry_delay (float) – Initial delay between retries (exponential backoff)

Returns

Parsed JSON response

Raises

RuntimeError – If all retries and backup attempts fail

Return type

dict[str, Any]