get_gmx_synthetic_token_by_symbol

Documentation for eth_defi.gmx.synthetic_tokens.get_gmx_synthetic_token_by_symbol function.

get_gmx_synthetic_token_by_symbol(chain_id, symbol, cache=LRUCache({}, maxsize=512, currsize=0))

Get a specific GMX token by symbol on a given chain.

This is a convenience function that fetches all tokens and filters by symbol. More efficient than fetching tokens repeatedly when you need just one.

Parameters
  • chain_id (int) – Blockchain chain ID

  • symbol (str) – Token symbol to search for (case-insensitive)

  • cache (Optional[cachetools.Cache]) – Cache instance to use

Returns

GMXSyntheticTokenDetails if found, None otherwise

Return type

Optional[eth_defi.gmx.synthetic_tokens.GMXSyntheticTokenDetails]

Example:

# Get USDC token on Arbitrum
usdc = get_gmx_synthetic_token_by_symbol(42161, "USDC")
if usdc:
    print(f"USDC decimals: {usdc.decimals}")