Skip to main content

Useful modules

The GMX SDK exports constants, types, and utility functions that you can import directly without going through the GmxSdk class. These exports are organized into three top-level categories:

  • configs/ — chain IDs, contract addresses, token metadata, market parameters, oracle keeper URLs, and fee factors
  • utils/ — fee calculations, price impact, swap routing, position sizing, number formatting, error parsing, and other computation helpers
  • types/ — type-only entrypoints for SDK configs, markets, tokens, orders, positions, fees, price candles, trade flows, referrals, TWAP, trade history, and Subsquid schema types

Additional public utility subpaths are available for lower-level integrations, including @gmx-io/sdk/utils/orderTransactions, @gmx-io/sdk/utils/express, @gmx-io/sdk/utils/subaccount, @gmx-io/sdk/utils/rpc, @gmx-io/sdk/utils/signer, and @gmx-io/sdk/utils/metrics. These are lower-level building blocks used by SDK v2 order and subaccount flows; prefer GmxApiSdk from @gmx-io/sdk/v2 unless you need to compose those primitives directly.

Use these exports to implement custom logic or to pre-compute values before passing them to SDK methods. Import any export directly from its module path, for example:

import { getOracleKeeperUrl } from "@gmx-io/sdk/configs/oracleKeeper";
import { getFundingFactorPerPeriod } from "@gmx-io/sdk/utils/fees";
import { formatUsd } from "@gmx-io/sdk/utils/numbers";
import type { MarketsInfoData } from "@gmx-io/sdk/types/markets";

See the sub-pages in this section for the full API reference for each module.