get_oracle_price_usd

Documentation for eth_defi.gmx.price_sanity.get_oracle_price_usd function.

get_oracle_price_usd(oracle_data, token_decimals)

Extract USD price from oracle data.

Calculates the median of maxPriceFull and minPriceFull from oracle data and converts it to USD based on token decimals.

Parameters
  • oracle_data (dict) – Oracle price data dictionary with maxPriceFull and minPriceFull

  • 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