Slippage, also known as trade price deviation, arises from the variance between the anticipated and actual price of a transaction. This discrepancy is influenced by the temporal gap between order placement and execution, during which market conditions may undergo alterations. Consequently, the time to execute a trade plays a pivotal role in determining the potential risks associated with slippage. Notably, slippage risks are heightened during periods of relative market volatility, wherein asset prices are inclined to experience more rapid fluctuations.
In Automated Market Maker (AMM) decentralized exchanges, trades follow a smooth price curve, causing the market price to shift based on the resulting changes in the token ratio within the pool. However, it is important to note that the price of the pool can change between the order confirmation and final execution if another transaction against the same pool is prioritized.
To address this issue, AMMs have implemented a slippage tolerance parameter. Instead of failing the order, which would lead to a cascade of failed orders, transactions can still be executed as long as the final price falls within the specified boundaries set by the slippage percentage. This approach enhances transaction processing efficiency at the application layer and allows traders to protect their trades.
While it is advisable to keep the slippage setting as low as possible for optimal trade rates, it is important to consider that transactions with lower slippage settings may have a higher failure rate during periods of extreme market volatility. On the other hand, setting a higher slippage increases the likelihood of transaction success but comes with the risk of potentially worse rates due to market volatility and the presence of front-running opportunities.
How to protect our users and our integrators?
To protect our users and integrators, we have implemented various measures. We offer clear warnings and prompts to ensure users are aware of the potential slippage and can confirm their actions.
For our integrators, we provide comprehensive documentation and support to help them understand and implement slippage protection mechanisms in their applications.
The Quote API also offers slippage protection for trades through the slippageProtectionPercentage parameter, the default value is 0.5 (50%). This parameter allows integrators to customize the threshold for slippage protection according to their specific needs and tolerance. By adjusting this parameter, integrators can ensure that only DEXs with valid slippage protection are included in the results. This helps maintain the accuracy of trade execution and minimizes the risk of the variance between the anticipated and actual price of a transaction.