Why Is My Limit Order Filled at a Different Price?

When trading on decentralized exchanges (DEXs), the way orders are executed differs from centralized exchanges (CEXs), which can lead to differences between your limit order price and the actual transaction price. • Order Book Model on Centralized Exchanges (CEXs): On CEXs, trades are processed through an order book system, where prices are determined by the active buy and sell orders. When you place a limit order—say, to buy at $0.001—the trade will go through at that price as long as there's a matching sell order. The price is fixed, and your order will be filled exactly at the price you set, with no slippage. • Automated Market Maker (AMM) Model on Decentralized Exchanges (DEXs): Most DEXs, like Uniswap and Sushiswap, use an AMM model that relies on liquidity pools to determine prices. These pools use a formula (x * y = k) where the price is based on the ratio of tokens in the pool, and this ratio changes dynamically with each trade.Because of this system, when you place a limit order, the price you set depends on the current token ratio in the liquidity pool, not your order price. For example, if you try to buy at $0.001, the actual price may change by the time your trade is executed, especially if you're trading a large amount that impacts the pool's balance. This could result in a final price of $0.0015.

  1. Slippage

What Is Slippage? Slippage is the difference between the expected price of a trade and the actual price at which it's executed. This is common on DEXs, particularly for large trades. • Why Does Slippage Happen? Slippage occurs because the AMM model continuously adjusts the price based on changes in the liquidity pool. If the pool has low liquidity, your trade can have a bigger impact on the price, causing slippage. • Managing Slippage: Most DEXs allow you to set a slippage acceptance. If the slippage is set too low, your trade might fail or execute at a obviously different price than expected. You can typically set slippage from 0.1% to 50%. Higher slippage increases the likelihood of your trade going through but at the risk of a worse price.

  1. Liquidity Issues

Liquidity Depth: The depth of liquidity in a pool is crucial for maintaining price stability. If the pool has enough liquidity, your trade won't cause much price movement, so the actual price will closely match your order. However, in shallow pools, larger trades can push prices away from your set limit. • Liquidity Pools: In AMM systems, prices are determined by the ratio of two tokens in a pool. As you trade, this ratio shifts, and so does the price. This is why a limit order at $0.001 may end up being filled at a higher price, like $0.0015.

  1. Gas Fees and Transaction Priority

Impact of Gas Fees: On-chain trades require Gas fees, which affect the speed and priority of your transaction. If you set a lower Gas fee, your trade may be delayed. In volatile markets, this delay can lead to price changes by the time your trade is processed. • Block Confirmation Time: The time it takes for a trade to be confirmed on the block depends on network congestion and the Gas fees you're willing to pay. During this period, prices can fluctuate, especially in low liquidity pools or volatile markets.

  1. Price Impact in AMM Models

Large Trades and Price Impact: In AMM systems, large trades can obviously alter the token ratio in the pool, moving the price further from your original order. For example, if you place a large buy order at $0.001, the token ratio might shift, causing the actual trade to be executed at a lower price than expected. • Price Curve Impact: Prices in AMMs don't change in a straight line. For smaller trades, the price moves slightly, but larger trades cause more obvious shifts. This can lead to bigger differences between your limit order price and the final price. How to Reduce Price Discrepancies:

  1. Choose liquidity pools with deeper liquidity.

  2. Set an appropriate slippage (though this may increase the risk of trade failure).

  3. Split into multiple small transactions

  4. Use higher Gas fees to speed up

Last updated