# TPCourses 21 — About DeFi Slippage

What is slippage?

Slippage refers to the difference between the expected price of a trade and the price at which the trade is executed when trading tokens.

So how does slippage occur? Take Uniswap for example, which is an automated liquidity protocol powered by a constant product formula. This formula, most simply expressed as x * y = k. When I create a new liquid pool of ETH and X tokens in Uniswap, the quantities of ETH and X are 10 and 100 respectively at the time of creation, and the price of X is 0.1 ETH, which means that 1 ETH can purchase 10 X, and x*y=10 ETH*100 X=1000 here. Once created, the user can exchange ETH for X on Uniswap. Suppose someone uses 1 ETH to buy X. At this point, 1 ETH enters the liquidity pool and the number of ETH increases to 11. To keep the product constant, the number of X has to be reduced, and this reduced number of X is the number of X that can be bought with 1 ETH. According to the constant product, 10*100=(10+1)*(100-X’), the calculated X’=9.09, which means that 1 ETH can only buy 9.09 X. Compared to the original price of 1 ETH=10 X, the slippage (price error) is (10–9.09)/10*100%= 9.09%.

Three main factors affect slippage.
Pool size
Market volatility
Speed of block confirmation

--

--