GMX launched on Arbitrum in September 2021 and Avalanche in January 2022, introducing a novel model for decentralised perpetual futures that solved the core problem of prior DEX perp designs: liquidity fragmentation. Rather than relying on AMM pools for each trading pair or on-chain order books (which required deep, coordinated liquidity), GMX created the GLP (GMX Liquidity Pool) — a single diversified pool of assets (BTC, ETH, LINK, UNI, USDC, USDT) that acts as the counterparty to all trades on the platform. Traders trade against GLP; GLP profits when traders lose and absorbs losses when traders profit. GLP holders earn 70% of trading fees (in ETH/AVAX) plus the accumulated losses of traders. This "real yield" model — fees paid in actual revenue assets rather than inflationary token emissions — made GMX the most revenue-generating DeFi protocol per TVL during the 2022 bear market, when most protocols saw fee revenues collapse.
The GLP Model: Trading Against a Diversified Pool
GLP is a basket of assets with target weights: approximately 25–30% BTC, 25–30% ETH, 15–20% USDC, 10–15% USDT, and smaller allocations to other assets. The weights are maintained through dynamic fee incentives: if BTC is underweight in GLP, buying BTC with stablecoins is discounted (lower fees); if BTC is overweight, selling BTC for stablecoins is incentivised. This creates organic rebalancing without forced rebalancing transactions. When a trader opens a long BTC position: they're effectively borrowing BTC from GLP and agreeing to settle in USD. GLP's BTC allocation backs their position. If the trader profits, GLP pays them from GLP's BTC allocation; if the trader loses, the loss adds to GLP's assets. GLP holders bear the risk of being on the wrong side of aggregate trader profitability — in bull markets, profitable traders can erode GLP NAV; in bear markets, losing traders boost GLP NAV. Historically, on GMX, aggregate trader losses have exceeded gains — GLP has been a profitable position for patient holders willing to accept the counterparty risk exposure.
GMX V2: Isolated Markets and GM Pools
GMX V2 (launched August 2023) moved away from the single GLP pool toward isolated GM (GMX Market) pools — individual liquidity pools for each trading pair, with long and short token assets paired. A BTC/USD market has a BTC "long token" pool and USDC "short token" pool; liquidity is isolated between markets, eliminating the cross-market risk of V1's GLP. V2 also introduced a funding rate mechanism (similar to perpetual futures on CEXes) to balance open interest between longs and shorts. V2 trades have up to 50x leverage (vs V1's 50x cap), lower swap fees, and support for more assets. The migration from GLP to GM pools gives liquidity providers more choice: they can provide liquidity specifically to the BTC, ETH, or SOL market based on their risk preference, rather than holding a diversified basket.
Smart Contract Integration for Automated Trading on GMX
GMX V2 trades are executed via its Router and Exchange Router smart contracts on Arbitrum. Unlike CEX APIs, integration requires blockchain transaction signing.
Step 1 — Set up a Web3 connection to Arbitrum.
from web3 import Web3; w3 = Web3(Web3.HTTPProvider("https://arb1.arbitrum.io/rpc"))
Or use a private RPC (Alchemy, Infura, QuickNode) for higher rate limits and reliability in production.
Your account: account = w3.eth.account.from_key(os.environ["PRIVATE_KEY"])
Step 2 — Load GMX V2 contract ABIs.
GMX V2 contracts are available on GitHub at gmx-io/gmx-synthetics. Key contracts:
ExchangeRouter— main entry point for creating orders (increase/decrease position, swap).Reader— view functions for reading market state, positions, and prices (no gas cost).DataStore— stores all protocol state (market configs, position data).Oracle— GMX V2 uses a signed price feed (Chainlink + GMX own oracle network) — prices are submitted as signed data alongside order execution transactions.
Step 3 — Read market data.
Use the Reader contract's getMarket() and getMarketTokenPrice() functions to get current GM pool pricing. For position data: reader.getPosition(dataStore.address, position_key). GMX's price oracle (Chainlink-backed) can be queried off-chain at https://synthetics-api.gmx.io/prices/tickers — returns signed price data that must be included in order execution transactions.
Step 4 — Create an order via ExchangeRouter.
GMX V2 uses a two-step order process: create the order (step 1, in one block), execute the order (step 2, performed by a keeper or by anyone, in the next block after the oracle price update). This prevents price manipulation on order creation. The createOrder() function on ExchangeRouter takes a CreateOrderParams struct including market, collateral token, size delta in USD, trigger price, acceptable price (slippage control), order type (MARKET_INCREASE, LIMIT_INCREASE, MARKET_DECREASE, etc.), and is_long flag. Include a small execution fee in ETH to compensate the keeper who executes your order in step 2.
Step 5 — Monitor positions and automate stop losses. GMX V2 supports on-chain stop-loss and take-profit trigger orders — create STOP_MARKET_DECREASE orders alongside your position to automate risk management without active monitoring. For bots that actively manage positions, poll the Reader contract every block (via WebSocket subscription to Arbitrum block events) to check position health and react to market moves.
Who GMX Is Best For
GMX suits: derivatives traders who want decentralised perps with strong liquidity on major assets (BTC, ETH, SOL) and acceptable execution; yield-seekers who want real yield (ETH/AVAX fees) from providing liquidity as GLP or GM pool LPs; and developers building automated trading strategies who are comfortable with smart contract interaction. Not suited for: traders who need the full range of perp markets available on Bybit or Binance; high-frequency traders where the two-step order execution process adds unacceptable latency; or beginners who find smart contract interaction overwhelming.
GLP Pool and GMX V2
GMX's GLP pool model allows liquidity providers to supply a basket of assets (ETH, BTC, USDC, etc.) and earn trading fees from all GMX traders — LPs are effectively the counterparty to all GMX trades, collecting fees when traders lose and absorbing losses when traders win. This peer-to-pool model differs fundamentally from order book DEXs: GLP LPs assume market risk but earn consistent fee yield from high-volume trading activity. During trending markets where traders profit consistently, GLP LP returns can suffer, while ranging markets typically benefit GLP holders through fee accumulation.
GMX V2 introduced isolated synthetic markets for long-tail assets using a two-token GM pool model (GM = GMX Market token) — each market has dedicated long and short liquidity isolated from other markets, eliminating systemic risk from a single large trade impacting all GLP holders. V2's synthetic oracle-based markets (using Chainlink price feeds) allow GMX to list assets that don't have on-chain liquidity, dramatically expanding GMX's tradeable asset universe. Compare with dYdX for order book perps, Hyperliquid for appchain perps, and Drift Protocol on Solana. Use our crypto tools and DennTech blog for GMX and DeFi perps analysis.