GMX Guide

Data & developers

Reading time
6 minutes
Last source check
July 26, 2026

GMX API guide

GMX does not have one endpoint for every integration. It publishes an Oracle API, a broader GMX REST API, indexed GraphQL data, direct contract interfaces and TypeScript SDK packages. The best choice depends on whether you need a current snapshot, a historical series or a transaction.

This guide maps each surface to a practical job and calls out the units that most often create incorrect dashboards. All examples use public, read-only data. A production integration should add timeouts, fallback hosts, validation and explicit freshness checks.

In this guide
  1. 01Choose the API by data job
  2. 02Hosts, networks and fallback strategy
  3. 03Decode Oracle prices correctly
  4. 04Decode funding and borrowing units
  5. 05Use rates for history and markets/info for now
  6. 06GraphQL, contracts and the SDK
  7. 07Production validation checklist

Key takeaways

  1. 01Pick the data surface according to freshness, history and transaction needs.
  2. 02Oracle prices require token-decimal-aware decoding.
  3. 03markets/info rates are annualized 1e30 values.
  4. 04Multiple pools can share a base symbol, so market selection must be explicit.
  5. 05Production clients need fallbacks, freshness checks and boundary validation.
01

Choose the API by data job

Use the Oracle API when you need token tickers, listed market metadata or near-live market information. The markets/info response includes open interest, available liquidity, funding and borrowing values. The price ticker response includes minPrice and maxPrice rather than a guaranteed trade price.

Use the GMX API for convenient normalized resources such as pairs, hourly rates, APY and weekly buyback statistics. Use GraphQL for indexed event history, orders, positions and referrals. Use contracts or the SDK when the application must construct or submit a transaction.

Official GMX data surfaces
SurfaceBest forImportant limitation
Oracle APIPrices, markets, funding, OI and liquidity snapshotsMany values use protocol fixed-point units
GMX REST APINormalized pairs, rates, APY and protocol statisticsEndpoint cache windows differ
GraphQLIndexed historical entities and referral dataIndexed state can lag the latest block
ContractsCanonical state reads and transaction executionAddresses and transaction flows require careful version handling
TypeScript SDKFrontend-compatible data and transaction helpersPackage methods can change across releases
02

Hosts, networks and fallback strategy

Direct GMX markets currently run on Arbitrum, Avalanche and MegaETH. Oracle hosts follow a network prefix, such as arbitrum-api.gmxinfra.io. GMX documents additional fallback hosts for resilience. The normalized API uses hosts such as arbitrum.gmxapi.io.

Do not silently mix networks. Store network name, chain identifier, market token and token addresses with every record. Retry a documented fallback only for network errors, timeouts or retryable status codes. A malformed successful response should fail validation instead of being accepted.

  • Send an identifiable User-Agent with a project URL or contact route.
  • Set a finite request timeout and limit retry count.
  • Record the source host and retrieval time with each snapshot.
  • Treat an empty array as suspicious when the previous snapshot contained active markets.
  • Cache public data according to the endpoint freshness needed by the product.
03

Decode Oracle prices correctly

Oracle ticker prices are represented with 30-decimal USD precision adjusted for the token's own decimals. The decoding rule is raw price divided by 10 raised to the power of 30 minus token decimals. Read token decimals from the official token list rather than assuming 18.

A ticker provides minPrice and maxPrice. A dashboard can label their midpoint as a mark-price estimate, but GMX execution uses the relevant side according to order direction. Never describe the midpoint as a guaranteed quote.

Decode a GMX Oracle pricetypescript
function decodePrice(raw: string, tokenDecimals: number): number {
  return Number(raw) / 10 ** (30 - tokenDecimals);
}

const min = decodePrice(ticker.minPrice, token.decimals);
const max = decodePrice(ticker.maxPrice, token.decimals);
const midpoint = (min + max) / 2;
04

Decode funding and borrowing units

The near-live markets/info endpoint returns funding and borrowing rates as signed annualized values scaled by 1e30. Divide the raw value by 1e30 to obtain an annual fraction. Multiply by 100 for annual percentage rate. Divide the annual fraction by 8,760 and multiply by 100 for an hourly percentage estimate.

Funding rate signs carry direction. A positive long funding value means the long side pays under the documented convention; a negative value means it receives. Long and short fields can differ because of claim-factor and collateral accounting, so do not force them into a perfectly symmetric display. Borrowing is a separate cost and should not be merged into a funding label.

Convert a 1e30 annualized ratetypescript
const annualFraction = Number(rawFundingRate) / 1e30;
const aprPercent = annualFraction * 100;
const hourlyPercent = (annualFraction / 8760) * 100;
05

Use rates for history and markets/info for now

The rates endpoint provides hourly historical values and is appropriate for charts or backtests. The markets/info endpoint is the better source for a current market snapshot and is documented with a shorter cache period. Label a chart according to the endpoint actually used.

A base asset can have more than one GM market because collateral combinations differ. A market-wide funding table should either expose every pool or choose one transparently. Our live funding page selects the listed pool with the greatest combined long and short open interest for each network and base symbol, then applies a minimum open-interest threshold. It does not use trading volume as a proxy for market depth.

06

GraphQL, contracts and the SDK

GraphQL is useful when the question begins with who, when or how many: historical trades by account, position changes, orders, referral records or volume intervals. Paginate deterministic fields, handle indexer lag and store stable identifiers. Do not use an indexed response as proof that a just-submitted transaction has finalized.

Direct contract reads are appropriate when an application needs canonical onchain state. GMX identifies DataStore and RoleStore as permanent deployments, while logic contract addresses may change. The frontend integration guide and SDK reduce transaction-building work, but the application still needs network checks, simulation, acceptable-price controls and user confirmation.

07

Production validation checklist

Validate types at the boundary. JavaScript can parse a large fixed-point string into an imprecise Number before you notice the error. Keep integer values as strings or bigint until scaling, and test conversion against known examples.

Monitor freshness separately from availability. A 200 response containing old data is not healthy for a trading screen. Compare source timestamps with local time, expose a stale state, and keep the official GMX interface as the execution destination unless your integration has been independently reviewed.

  • Pin and review SDK versions before upgrading.
  • Log host, status, duration and source timestamp without logging wallet secrets.
  • Verify marketToken and token addresses per chain.
  • Test negative funding values, zero borrowing and unusually small prices.
  • Separate read-only analytics credentials from any transaction signer.

Primary sources

These sources were checked on July 26, 2026. Protocol parameters can change.

  1. 01GMX Docs: API overview
  2. 02GMX Docs: Integration guide
  3. 03GMX Docs: Markets REST API
  4. 04GMX Docs: GraphQL
Read our verification methodology →

Referral disclosure

10% off eligible GMX position fees

Code PRO maps to GMX's tier-2 discount on eligible opening and closing position fees. The link is sponsored; the discount and protocol risks are unchanged.

Open GMX

Frequently asked questions

Is the GMX API free?

GMX publishes public API endpoints without an API key for common price and market-data use. Consumers should cache responsibly, use documented fallbacks and avoid abusive request rates.

Which GMX API has live funding rates?

The Oracle API markets/info endpoint provides near-live funding, borrowing, open-interest and liquidity fields. The rates endpoint is intended for hourly historical data.

Does the GMX price API return a trade quote?

No. Oracle tickers report minPrice and maxPrice. Actual execution depends on the relevant oracle side, price impact, fees, order parameters and successful keeper execution.

Should I use REST or GraphQL for GMX?

Use REST-style endpoints for current snapshots and normalized resources. Use GraphQL for indexed historical entities and account activity. Some applications need both.

Can the GMX API submit trades?

Market-data endpoints are read-only. Transaction integrations use GMX contracts or supported SDK and frontend-integration patterns, with wallet signing and network-specific addresses.

Continue learning

Related GMX guides