fetch_all_gmx_markets

Documentation for eth_defi.gmx.whitelist.fetch_all_gmx_markets function.

fetch_all_gmx_markets(web3)

Fetch all available GMX markets from the blockchain.

This function queries the GMX Reader contract to get a complete list of all available perpetual markets with their metadata.

Example:

from web3 import Web3
from eth_defi.gmx.whitelist import fetch_all_gmx_markets

web3 = Web3(Web3.HTTPProvider("https://arb1.arbitrum.io/rpc"))
markets = fetch_all_gmx_markets(web3)

for address, info in markets.items():
    print(f"{info.market_symbol}: {address}")
Parameters

web3 (web3.main.Web3) – Web3 instance connected to Arbitrum or another GMX-supported chain.

Returns

Dictionary mapping market addresses to MarketInfo objects.

Return type

dict[eth_typing.evm.HexAddress, eth_defi.gmx.core.markets.MarketInfo]