Limit order execution prices are inconsistent?
The different trading mechanisms of on-chain trading (DEX) and centralized exchanges (CEX) lead to the difference between the pending order price and the final transaction price during on-chain trading. ⢠Order book mechanism of centralized exchanges: In CEX, trading is conducted through the order book mechanism. When buyers and sellers place orders, the price is directly determined by the pending orders on the order book. When you place a limit order, such as a buy order of $0.001, as long as the sell order meets this price, the transaction will be completed at your pending order price. The price is fixed in this case, and the price at the time of transaction is the price of your pending order, and the order will be matched according to the quantity, and there will be no slippage when the transaction is completed. ⢠Decentralized exchange automatic market maker (AMM) model: In on-chain trading, DEX mostly uses the automatic market maker (AMM) model. This model determines the price through a liquidity pool, and the price changes dynamically according to the proportion of tokens in the pool. Common AMM models such as Uniswap or Sushiswap use the "constant product" formula (x * y = k), where x and y are the number of two tokens and k is a constant. Due to the mechanism of AMM, the price at the time of placing an order depends on the current ratio of tokens in the liquidity pool, not the price at which you place the order. Therefore, when you place an order of $0.001, the actual price at the time of the transaction may change, especially if you trade a large amount, the ratio of tokens in the pool is significantly changed, and the final transaction price may be higher/lower than the price you expected (such as $0.0015).
Slippage Definition of slippage: Slippage refers to the difference between the actual transaction price and the price you expected when you initiate a transaction. Slippage is very common in decentralized exchanges, especially when you make large transactions, the slippage is more obvious. Causes of slippage: Slippage occurs because the price in the AMM model changes dynamically based on the ratio of tokens in the liquidity pool. When you trade, your trade affects the ratio of tokens in the pool, so the price changes. If the liquidity in the pool is insufficient (fewer tokens in the pool), your trade will have a greater impact on the price, resulting in a lower transaction price than expected. Control of slippage: Most DEX platforms allow you to set a slippage tolerance. If you don't set a high enough slippage tolerance, the transaction may fail, or the final transaction price may be significantly different from the order price. Usually the slippage setting can be between 0.1% and 50%. If the slippage tolerance is high, your transaction may be executed at a lower price.
Liquidity issues Liquidity depth: The transaction price of on-chain transactions is closely related to the depth of the liquidity pool. If the number of tokens in the liquidity pool is sufficient, your transaction will not significantly change the token ratio in the pool, and the transaction price is also closer to your order price. But if the liquidity is insufficient, your transaction will significantly affect the ratio of tokens in the pool, causing the price to change rapidly. Liquidity pool: The price of the AMM model is determined by the number of two tokens in the pool. When you buy or sell in the pool, the ratio of tokens in the pool will change, and the price will fluctuate accordingly. This is why when you place an order of $0.001, the actual transaction price may be $0.0015.
Gas fee and transaction priority The impact of gas fees: When trading on the chain, gas fees affect the speed and priority of transactions. If you set a low gas fee, it may cause transaction delays, which means that in a market with large price fluctuations, your transaction may be executed in a later block, and the price is different from when the order was placed. On-chain confirmation time: The execution time of on-chain transactions depends on the congestion of the network and the gas fee you pay. During the transaction time, the price may change, especially in markets with small liquidity pools and high volatility.
Price impact in the AMM model The impact of large transactions on prices: If you make large transactions in the AMM model, it will significantly affect the token ratio in the pool, causing price deviation. Suppose you want to buy a large amount of tokens at $0.001, the token ratio in the pool will change due to your purchase, resulting in a lower actual transaction price. The impact of the price curve: The price change of AMM is not linear. When the transaction volume is small, the price change is small; but as the transaction volume increases, the price will change in a curve, so large transactions will cause the price to move away from the price you originally placed. So it is normal for the limit order transaction price to be inconsistent with the setting. If you want to reduce price deviation when trading on the chain, you can: Choose a pool with sufficient liquidity. Set acceptable slippage (may cause trade failure). Trade small amounts. Choose ultra-fast mode.