# Getting GM and GLV token prices

> Use this page when you need a GM or GLV token price and need to choose the right integration surface. The best method depends on whether you need a standard oracle feed, direct GMX valuation for a specific block and price context, or off-chain display data.

# Getting GM and GLV token prices

Use this page when you need a GM or GLV token price and need to choose the right integration surface. The best method depends on whether you need a standard oracle feed, direct GMX valuation for a specific block and price context, or off-chain display data.

## Quick answer

| If you need | Use | Notes |
| --- | --- | --- |
| Current GLV display price | [Oracle API `/prices/tickers`](./rest-api/oracle-prices.mdx#tickers) | Use [`/tokens`](./rest-api/oracle-prices.mdx#tokens) to get the exact GLV symbol and address for the network |
| Current GM market-token display price | Direct Reader call, or Chainlink Data Feed where available | GM market tokens are not exposed as first-class `GM [...]` Oracle API tickers |
| Exact GMX GM valuation | [`Reader.getMarketTokenPrice`](./contracts/reader.md#getting-gm-token-price) | Requires supplied token prices, min/max handling, and the correct PnL factor context |
| Exact GMX GLV valuation | [`GlvReader.getGlvTokenPrice`](./contracts/glv-reader.md#getting-glv-token-price) | Requires supplied token prices and min/max handling |
| GLV composition or GM balances | [Oracle API `/glvs/info`](./rest-api/liquidity.mdx#glv-info) | Returns vault metadata, market exposure, GM balances, and GM balance values, not a `glvPrice` field |
| External on-chain oracle integration | [Chainlink Data Feeds](https://data.chain.link/), where available | Best fit when a public GM or GLV feed exists for your chain and token |

## Overview

GM and GLV are liquidity tokens, not simple underlying market tokens.

- **GM tokens** represent shares of one GM market. Their value depends on pool value, borrowing fees, capped trader PnL, impact pools, total supply, and the token prices you pass into the valuation.
- **GLV tokens** represent shares of a GLV vault. Their value is aggregated across the GM markets held by that vault.

For the liquidity-provider mental model, see [Token pricing](../providing-liquidity.md#token-pricing). For contract-level lookups, see [Reader](./contracts/reader.md#getting-gm-token-price) and [GlvReader](./contracts/glv-reader.md#getting-glv-token-price).

## Chainlink Data Feeds

Use Chainlink Data Feeds when your integration needs a standard oracle interface and a GM or GLV feed exists for the token you need.

Check availability on [data.chain.link](https://data.chain.link/) for the chain and token address you plan to integrate. Feed availability can differ by chain and can change over time, so do not hardcode assumptions from this page.

Data Feeds are the highest-level integration path for external protocols because they avoid reproducing GMX's internal valuation inputs. They may not match a same-block Reader valuation because the Reader calculation includes current pool state, capped pending PnL, borrowing fees, impact pools, and caller-supplied min/max token prices.

## Oracle API price endpoints

Use Oracle API price endpoints when you need off-chain display prices for GLV ticker symbols supported by that network. These endpoints are public HTTP endpoints on `gmxinfra.io`; they are not on-chain oracle feeds and are not the same as direct Reader valuation.

For current GLV prices, use [`/prices/tickers`](./rest-api/oracle-prices.mdx#tickers). The response includes token ticker objects with `tokenSymbol`, `tokenAddress`, `minPrice`, `maxPrice`, `timestamp`, and `updatedAt` fields. Use [`/tokens`](./rest-api/oracle-prices.mdx#tokens) to get the exact GLV symbol and address for the network, then use that `tokenSymbol` for ticker and candle lookups.

For historical GLV display data, use [`/prices/candles`](./rest-api/oracle-prices.mdx#candlesticks) with the GLV `tokenSymbol`.

These API endpoints are useful for off-chain UI and analytics. For external on-chain protocol integrations, prefer Chainlink Data Feeds where available. For exact GMX valuation at a specific block and price context, use the Reader contracts.

## GMX Reader contracts

Use direct Reader calls when you need GMX's valuation formula for a specific block and supplied price context, or when a Chainlink Data Feed is not available for the token you need.

Reader methods are not standalone oracles. They are deterministic contract valuation helpers. Your integration supplies the market data, encoded token prices, PnL factor type, and min/max direction.

For direct calls, you usually need:

- The `DataStore` contract address.
- The `Reader` or `GlvReader` contract address.
- The GM market or GLV token address.
- The relevant `Price.Props` values for index, long, and short tokens.
- The PnL factor context for GM token pricing.
- Two calls when you need both min and max valuation.

Contract addresses are listed in [Contract addresses](./contracts/addresses.md). The Reader parameter encoding is documented in [Price and amount encoding](./contracts/reader.md#price-and-amount-encoding).

## GM price example

Use `Reader.getMarketTokenPrice` for a direct GM token valuation. The function returns one side of the valuation range, so call it with both `maximize=false` and `maximize=true` when you need min and max prices.

```typescript
const market = await reader.getMarket(dataStoreAddress, marketAddress);

const [gmPriceMin, poolInfoMin] = await reader.getMarketTokenPrice(
  dataStoreAddress,
  market,
  indexTokenPrice,
  longTokenPrice,
  shortTokenPrice,
  MAX_PNL_FACTOR_FOR_TRADERS,
  false
);

const [gmPriceMax, poolInfoMax] = await reader.getMarketTokenPrice(
  dataStoreAddress,
  market,
  indexTokenPrice,
  longTokenPrice,
  shortTokenPrice,
  MAX_PNL_FACTOR_FOR_TRADERS,
  true
);
```

Use the `pnlFactorType` that matches your context:

| Context | PnL factor type |
| --- | --- |
| Trading or general pool valuation | `Keys.MAX_PNL_FACTOR_FOR_TRADERS` |
| Deposit simulation | `Keys.MAX_PNL_FACTOR_FOR_DEPOSITS` |
| Withdrawal simulation | `Keys.MAX_PNL_FACTOR_FOR_WITHDRAWALS` |

## GLV price example

Use `GlvReader.getGlvTokenPrice` for a direct GLV token valuation. The market address list and `indexTokenPrices` array must use the same order.

```typescript
const glvInfo = await glvReader.getGlvInfo(dataStoreAddress, glvAddress);
const marketAddresses = glvInfo.markets;

const indexTokenPrices = marketAddresses.map((marketAddress) => {
  return indexTokenPricesByMarket[marketAddress];
});

const [glvPriceMin, glvValueMin, totalSupply] = await glvReader.getGlvTokenPrice(
  dataStoreAddress,
  marketAddresses,
  indexTokenPrices,
  longTokenPrice,
  shortTokenPrice,
  glvAddress,
  false
);

const [glvPriceMax, glvValueMax] = await glvReader.getGlvTokenPrice(
  dataStoreAddress,
  marketAddresses,
  indexTokenPrices,
  longTokenPrice,
  shortTokenPrice,
  glvAddress,
  true
);
```

GLV markets in the same vault share the same long and short token pair. Pass one `longTokenPrice` and one `shortTokenPrice`, plus the index token price for each underlying GM market.

## Precision and decimals

GM and GLV tokens use 18 decimals. The price returned by `Reader.getMarketTokenPrice` or `GlvReader.getGlvTokenPrice` is a 30-decimal USD price per full GM or GLV token.

```typescript

const displayPrice = formatUnits(gmPriceMax, 30);
```

This return-value format is different from the input `Price.Props` format for underlying tokens. Input token prices use:

```
priceValue = usdPrice * 10^(30 - tokenDecimals)
```

For example, `$1` USDC with 6 token decimals is encoded as `1 * 10^24`, while `$1` WETH with 18 token decimals is encoded as `1 * 10^12`.

Oracle API ticker and candle responses use their own endpoint response formats. Do not mix Oracle API ticker fields with Reader return values without applying the endpoint-specific scaling documented in [Oracle Prices](./rest-api/oracle-prices.mdx).

## Min and max price handling

The `maximize` parameter selects one side of the valuation.

- For GM, `maximize=true` uses the higher valuation path and `maximize=false` uses the lower valuation path.
- For GLV, `maximize=true` and `maximize=false` select the high or low valuation across the underlying GM markets.
- Each call returns one price, not a min/max pair.

For price ranges, call the Reader twice and label the results explicitly in your integration.

## API and SDK limitations

The Oracle API exposes current prices for supported token tickers through `/prices/tickers`, including configured GLV symbols on networks where those symbols are part of the API token list. Other API and SDK surfaces expose related GM and GLV data, but not every GM or GLV valuation as a first-class high-level field or method.

- Oracle API `/prices/tickers` can expose configured GLV ticker prices for off-chain display. It does not expose every GM market token as a `GM [...]` ticker.
- Oracle API `/markets/info` exposes market state such as token amounts, liquidity, open interest, funding, borrowing, disabled status, and the GM market token address. It does not expose a `gmPrice` field, and GM market tokens are not exposed as `GM [...]` tickers in `/prices/tickers`.
- Oracle API `/glvs/info` is a GLV composition endpoint. It exposes GLV vault metadata, market exposure, GM balances, and balance values, but not a `glvPrice` field. Use `/prices/tickers` for current GLV display prices and `/tokens` for the exact GLV symbol.
- SDK v1 `sdk.markets.getMarketsInfo()` returns `marketsInfoData`, `tokensData`, and pool values. It does not expose `getGmPrice()` or `getGlvPrice()` as high-level methods.
- SDK v1 exports low-level ABIs that can be used for direct contract calls, but those are not the same as a high-level SDK price method.

Use API or SDK data for off-chain displays when the exposed fields are sufficient. Use Chainlink Data Feeds where available for a standard oracle interface. Use direct Reader or GlvReader contract calls when you need the GMX valuation formula for a specific block and price context.
