Understanding Price Impact and Price Slippage in DeFi
This article covers the basics of decentralized exchanges, as well as the mechanics of automated market makers, price impact, and price slippage.
TL;DR
- Decentralized exchanges (DEXs) are one of the key driving factors to decentralized finance's growth, and automated market makers (AMMs) are the most common DEXs. AMMs suffer from price impact and price slippage.
- Price impact is the effect a trade has on the price of an asset. It is often proportional to the size of the order.
- Price slippage is the difference between the final execution price and the expected price.
- DEXs and AMMs will continue to evolve to mitigate both price impact and price slippage.
From several budding protocols in 2017 to the flourishing ‘DeFi summer’ in 2020, from MakerDAO that predates Ethereum to over 2,000 protocols across dozens of chains, decentralized finance (DeFi) has emerged as a significant sector within the blockchain and cryptocurrency industry. DeFi platforms have introduced novel financial services that operate without intermediaries, providing users with greater control over their assets and more accessible financial products. Central to DeFi's growth are decentralized exchanges (DEXs) and automated market makers (AMM) DEXs, where everyone can exchange digital assets instantly by interacting with protocols.
DEXs and AMMs
Traditional centralized exchanges (CEXs) rely on order books and matching engines to facilitate trades. However, these centralized entities are often subject to strict regulations. To provide inclusive and private financial services, DEXs were introduced. Built around smart contracts, DEXs rely on liquidity pools funded by users who deposit digital assets. In return, these users (liquidity providers) will receive a share of the trading fees generated by the platform.
Anyone can trade with these liquidity pools by depositing one asset and withdrawing another at the same time. The exchange ratio of these 2 assets (i.e., their price) is determined by mathematical formulas, ensuring that trades are executed instantly and at a relatively fair price. Popular AMM DEXs include Uniswap, SushiSwap, and Balancer.
First-generation AMMs are constant function market makers with constant product market makers (CPMMs) being the most common ones. These AMMs are built around one simple function: x*y = k where x and y are the quantity of both assets in a liquidity pool and k is an arbitrary constant.
This simple function results in something close to an order-book-based exchange: buying pumps an asset’s price and selling tanks it. The more you buy, the higher your per-unit cost, and vice versa.
But CPMMs are not without their flaws - quite a few, in fact. Price impact and price slippage are the 2 most obvious.
Price impact
Price impact refers to the price change in the market when a trader buys or sells an asset. For CPMMs, price impact is determined by the size of the trade relative to the size of the liquidity pool. Large trades will have a more significant price impact, causing the value of both tokens to deviate from their market price.
For example, if a trader attempts to swap a large amount of USDT for ETH in an ETH-USDT liquidity pool, the price of ETH (in this pool) will increase. This occurs because the constant product formula must remain balanced, and the increase in USDT's supply in the pool must be offset by a decrease in the amount of ETH. And since these pools are automated, they won’t adjust their token supply or ‘price’ in a proactive fashion. As a result, there’s nothing stopping the ETH price in this liquidity pool to deviate from its price out in the market until someone else comes and places an order in the opposite direction.
Price slippage
Price slippage occurs when the final execution price of a trade differs from the expected price. In the context of CPMMs, price slippage is mostly caused by price impact. It’s quite possible that when you're submitting your order, someone else has already fulfilled a trade and caused some price impact on the assets. They could be innocent traders or malicious front runners who found your order in the public mempool and decided it would be profitable to pay extra gas fees to submit their calculated order before you and profit off of your slippage.
Slippage is a common concern for many DEXs, particularly when executing large trades or trading illiquid assets. To mitigate this, users can set a maximum slippage tolerance on their trades. If the slippage exceeds this threshold, their transaction will not be executed. However, this may result in failed transactions and increased gas fees, as users must resubmit their trades with a higher slippage tolerance or wait for more favorable market conditions.
Closing thoughts
Price impact and price slippage are two of the greatest tradeoffs when you enjoy AMM DEXs’ instant trading experience. As the DeFi ecosystem continues to evolve, other solutions such as concentrated liquidity, proactive market makers, and formulated market makers emerge and put their meticulously designed mechanisms to the test. Projects like Sei are even trying to put an entire order-book-based decentralized exchange on chain.
But there is one simple solution that gives you the best of both worlds: Bitget and Bitget MegaSwap. You can dive into our robust collection of trading products and enjoy the best trading experience CEXs can offer, or switch to our MegaSwap product to instantly trade almost any token you have in mind with the best price you can find across most DEXs.
Start trading on Bitget MegaSwap now
- Guide to Bitget Spot Profit and Loss (PnL) Analysis2024-10-11 | 15m