Fundamentals: What is price impact?
A brief introduction to price impact.
The price impact of a trade is the influence that a single buy or sell order can have on the market price of the asset being traded. Price impact is directly correlated to an asset's liquidity, but is also dependent on a variety of other factors, including the size of the trade and the volatility of the asset.
In DeFi, price impact is especially relevant because some trading pairs might have limited liquidity, meaning that price impact can be particularly high. When trading on a decentralized exchange, price impact is directly correlated with the amount of liquidity available in the liquidity pool for that trading pair. This means that price impact will be high on more illiquid assets and large trades on an illiquid asset could lead a trader to lose a large portion of their funds. A similarly large trade on a more liquid asset might not have as much of an effect.
What’s the difference between price impact and price slippage?
Price impact and slippage are similar, but there is some nuance.
Price impact refers to how an individual trade influences the market price of an asset in between that trade’s execution and completion. Price slippage also refers to the change in the price of an asset, but is used when those changes are caused by external market factors and not your individual trade. For example, because crypto markets are volatile, trading activity could cause a shift in price between someone placing their order, and it being completed. That would lead to price slippage on that trade. Similar to price impact, price slippage is also heavily dependent on the liquidity of the asset being traded.
How can I avoid price impact?
Since price impact is directly correlated to the liquidity of an asset there is only so much you can do if you’re trading an asset with low liquidity. You can either wait for more liquidity to enter that asset you’re looking to trade, or lower the size of your trade to reduce its price impact. As a developer, you can protect your users from price impact by using the 0x Swap API's feature called Price Impact Protection.