get_ticker_price_usd

Documentation for eth_defi.gmx.price_sanity.get_ticker_price_usd function.

get_ticker_price_usd(ticker_data, token_decimals)

Extract USD price from ticker data.

Calculates the midpoint of maxPrice and minPrice from ticker data and converts it to USD based on token decimals.

Parameters
  • ticker_data (dict) – Ticker price data dictionary with maxPrice and minPrice

  • token_decimals (int) – Number of decimals for the token (e.g., 18 for ETH)

Returns

Price in USD

Raises

ValueError – If price data is missing or invalid

Return type

float