AMM stands for **auto market maker**. It is a type of decentralized exchange (DEX) governed by smart contracts. **Think of this as trading tokens without finding someone who wants to buy or sell them.** Trade using pools of tokens controlled by smart contracts. **But if there are no buyers and no sellers, who decides the prices of the sellers and buyers?**

That’s a good question. The price of tokens in the pool is determined by a formula according to the number of tokens in the pool. The most basic expression is called: **constant product formula,** and it looks like this:

where **x * y = k**`x`

and `y`

is the amount of two tokens in the pool, and `k`

is a constant. This means that if you increase the amount of one token in the pool, you should decrease the amount of another token you hold. `k`

same. This also means that the price of one token over the other is equal to the ratio of their amounts in the pool.

For example, given the following pools: **ethereum** and **USDT**and there is **100** ETH (`x = 100`

) and **200,000** USDT (`y = 200,000`

) to the pool.constant `k`

is 100 * 200,000 = `20,000,000`

. The price of 1 ETH in USDT is 200,000 / 100 = 2,000 USDT.

If you want to buy 10 ETH from the pool (i.e. remove 10 ETH), you will need to add USDT to hold it. `k`

same. Here is the amount of new ETH and USDT in the pool: **90** and **222, 222.22,** Each. Applying simple supply and demand logic, what would happen if someone bought his ETH and no one sold it?

That’s right, that price will go up, and that will happen with our pool as well. The new price for 1 ETH in USDT is: **222,222.22 / 90 = 2,469.13 USDT**. As you can see, the price of ETH increased as we reduced the supply of ETH in the pool.

This formula ensures that there is always enough liquidity in the pool for any trade and that prices change according to supply and demand. However, it also **Slip** When trading large amounts of tokens, this is the difference between the expected price and the actual price obtained from the pool. The bigger the trade, the bigger the slippage. **This is why liquidity providers take the risk of price fluctuations and therefore earn commissions and rewards for supplying tokens to pools.**

Let’s look at an example to understand how slippage affects trading.

For example, let’s say you want to trade 100 ETH with USDT on an AMM platform that uses a constant product formula.

To determine the price of an asset. Since the current price of ETH is 2,000 USDT, we expect to get 200,000 USDT for 100 ETH. **x * y = k****However, when I execute the trade, I see that I only get 198,000 USDT.**. but why? This is because your trade changed the ratio of his ETH and USDT in the pool and therefore the price of ETH in terms of USDT. The new price for ETH is 2,020 USDT. This means we paid a higher price than expected. **Slippage is the difference between 200,000 USDT and 198,000 USDT**.

Slippage can be positive or negative depending on whether you buy or sell an asset and whether the price moves in your favor or against it. Slippage can also vary depending on the AMM platform, token pair and market conditions. Slippage can be reduced by trading smaller amounts, choosing more liquid pools, or using platforms that offer lower slippage rates.

Slippage is the financial risk traders face when using AMM-based DEXs. Always check your slippage before confirming a trade and prepare for price volatility.

That’s a legitimate concern. His ETH price in the pool is not necessarily the same as his ETH price on other exchanges as it is determined by different factors. However, there are mechanisms that help keep prices in sync. **Arbitrage**. **Arbitrage is the exploitation of price differences between different markets to make a profit**.

For example, let’s say the price of ETH in your pool is 2500 USDT, but the price of ETH on another exchange is 2100 USDT. An arbitrageur can buy his ETH from other exchanges and sell it to the pool at a higher price, earning a profit of 400 USDT per ETH. **However, doing so will also change the amount of ETH and USDT in the pool and thus the price of ETH in the pool. The more ETH you sell to the pool, the lower the price of ETH until it reaches equilibrium with the rest of the market.** In this way, arbitrage traders help balance prices across different markets and reduce arbitrage opportunities.

Of course, arbitrage trading is not a perfect solution as it comes with costs and risks such as transaction fees, network congestion and price volatility. Therefore, there may still be some differences between prices in different markets at a particular point in time. However, arbitrage is a powerful force that tends to minimize these discrepancies and increase market efficiency.