We have released the CCXT and FreqTrade adapters for GMX. Now you can do algorithmic trading on your favourite decentralised futures exchange.
Purpose
The goal was to enable algorithmic trading on GMX using familiar tools algorithmic traders use on centralised exchanges. Some of the most adapted packages for this purpose are the CCXT connector middleware and the FreqTrade framework integration for backtesting and live execution of algorithmic strategies.
Both the CCXT adapter and the FreqTrade integration are now available for GMX.

These were delivered as part of the Arbitrum DAO developer ecosystem grant. See the grant here.
Delivered items
The following have been delivered as part of the grant:
- CCXT adapter for GMX (Github)
- CCXT middleware for GMX for non-Python programming languages
- FreqTrade algorithmic trading tutorial for GMX
Bonus we delivered
- The adapter has been updated to the latest GMX 2.2 version
- GMX data collector: we developed an additional infrastructure application to get higher-quality data out of GMX markets for backtesting of algorithmic strategies (more on this later)

Bonus we could not get
- CCXT baseline merge: currently stuck. This was not part of the grant, but something we wish would happen. The current open-source module works as a drop-in replacement until the CCXT team is ready to maintain the GMX adapter as part of the baseline.
Why trade on GMX?
GMX is one of the closest perpetual futures exchanges to self-custodial and true DeFi trading.
GMX offers dozens of perp trading pairs for popular cryptocurrencies like BTC, ETH and SOL. GMX is a so-called pure onchain market with a high degree of decentralisation. Thus, GMX is highly composable with other decentralised finance protocols. This allows users to go long or short on different asset prices with onchain leverage, which then pairs well with lending protocols, looping, and so on.

GMX often offers the most attractive funding rates due to its composability and special fee model, especially for mid- and long-term positions.
Live trading on GMX
For all exchange adapters, middleware, and trading algorithms, the devil is in the details. The only way to build trading software is to trade with the software.
Trading Strategy deployed a directional trading vault which trades on GMX. It has been running for a few months in so-called forward testing.
- This directional strategy combines mean reversion, trend following, and short-term BTC/ETH price prediction into a multi-strategy approach.
- The vault is deployed on the Lagoon vault protocol, taking trades directly on GMX
- Due to onchain nature of GMX, any of the multiple vault protocols can take positions on GMX, unlike other exchanges that often need a centralised custodian to deposit and withdraw assets in the exchange

The returns have hovered between 0% and 30% annually since the strategy launch. During the forward testing, we found and covered plenty of execution issues (more below). Both live trade execution and strategy performance are reaching a level of quality at which we will feel comfortable opening this vault to the public.
Developing trading algorithms for GMX
You can now develop trading algorithms for GMX as you would do for any FreqTrade-supported exchange.
We provide a tutorial here for a basic ADX-based breakout strategy.

You can find the tutorial here.
Trading firm adoption
Some trading firms have privately expressed interest in trading on GMX. However, the GMX's 4 bps/6 bps fee structure is not always competitive for their strategies.
Because of GMX's AMM nature, it does not have an internal price; instead, it uses a special fee structure in which the trade fee depends on whether you increase or decrease the open interest. This may make GMX attractive for certain funding-rate strategies, but it also makes it more difficult to run existing strategies built for more conventional exchanges.
As competition among new perpetual futures exchanges heats up, many newcomers are offering very attractive fee and airdrop schemes. This has hurt GMX, known for its deep liquidity for major coins like BTC and ETH. The real-world asset (RWA) boom has also changed the market landscape: as of this writing, GMX offers six TradFi assets.
Quality and testing
Our GMX directional vault on Arbitrum has executed 1000+ orders across ~100 positions. All packages include a continuous integration test suite to ensure that future maintenance work can be delivered easily.
Challenges and lessons learnt
The actual onchain smart contract execution for GMX is robust and quite easy to manage. There have been some other gaps that may make algorithmic trading on GMX difficult.
- Offchain data was not readily accessible: At the time of our integration, GMX market data required more integration work than conventional exchange feeds. Data was distributed across its APIs, GraphQL indexer and onchain Reader contracts rather than exposed through a single standardised exchange interface. GMX also does not use a single oracle source for every market: Chainlink Data Streams are the primary source for most tokens, while other configured providers may be used as well. Standardised live and historical data are critical for algorithmic trading, so we developed an additional GMX data collector to normalise these sources.
- GMX’s accounting and business logic differ from those of other exchanges in some unexpected ways. By default, profits from long positions are paid in the market’s long pool token. For example, profits from a BTC/USD long backed by WBTC and USDC may be paid in WBTC unless they are explicitly swapped into another token.
- GMX offers various trading-pair denominations; GMX perpetual markets are USD-denominated, but they are not simple base-and-quote pairs. Each market has an index token, a long pool token, a short pool token and a collateral token. Depending on the collateral deposited and the desired receive token, opening or closing a position may involve additional token swaps.
Next steps
If you need any help with FreqTrade, CCXT or GMX, please hop into our Discord.
We will also be opening up the GMX algorithmic trading vault - if you are interested in this, please follow us on Twitter, newsletter, YouTube, and LinkedIn.
