# DSR - Automated Market Makers (AMM), what they are, how they work and how they are used in DeFi

The Order Book

In order to understand how the Automated Market Maker works, it is necessary to remember what the Order Book is and how it is used by traders.

The Order Book is the list of all the orders to buy and sell an asset, sequenced in ascending order.

Through the Order Book it is possible to "give an orientation" to the market (ATTENTION: this practice is illegal!!!).

But we are not interested in this phase (and afterwards), because almost all traders know the Exchange bots, it is quite easy to recognize them: usually there are very low orders and sometimes they do not reach the minimum threshold.

Going back to the Order Book, with the analysis of these orders we can define the market trend and define with a certain precision the support and resistance zones.

Through the Order Book you give a price to an asset.

Ok

With the AMM the Order Book does not exist, the price is defined in an algorithmic way following a formula.

The simplest mathematical model of AMM follows this formula:

### x*y=k

Where:

- x is the quantity of one token present in the liquidity pool;

- y is the quantity of the other token present in the liquidity pool;

- k is a fixed constant that represents the total liquidity of the pool (which obviously must remain unchanged)

There are others of mathematical models that vary according to what is demanded to the protocol that manages the AMM.

But if the Order Book does not exist, how is it possible for the AMM to trade?

The operation is similar to the centralized trading with Order Book, with one difference: instead of another trader selling what you buy (or vice versa), the AMM interacts with a Smart-Contract.

This Smart-Contract is the liquidity pool.

On Dex the operations take place directly between the wallets of the users, in practice we can define this type of exchange as a Peer-To-Peer transaction, while the one managed by the AMM protocol, since it involves a wallet and the liquidity pool (which in reality is a Smart-Contract), we can define it as a Peer-To-Contract transaction.

Obviously, liquidity is the key part for the whole process to work properly.

Also, the higher the liquidity, the less chance of slippage on large orders.

Remember, however, that the price is determined by an algorithm, simplifying we can say that it depends on how much the ratio of tokens present in a liquidity pool changes after an operation.

If the ratio changes significantly, the slippage will be considerable.

Other attention that must be paid is relative to the Impermanent Loss.

In practice the Impermanent Loss is a loss that derives from the variation of the price of the tokens of the trading pair.

The problem of this loss can occur both in upward and downward movement of the tokens.

This loss is defined Impermanent because it is assumed that the price can return to the levels of when we opened the farm, but this is not said.

As we know the farms as they are active lose their original yield and therefore it is not said that the price can return to the "native" values within the exhaustion of the farm.

Impermanent Loss, I will speak in the future with numerical examples.

MikeZillo

Daily Trader, Mining Farm Project Manager, Blockchain consultant, Cryptocurrency evangelist. You can find more videos here https://www.youtube.com/channel/UCvyXx6I1C__zmLAYUXNZwQQ? Telegram: @mikezillo

DSR - DeFi Secrets Revealed

DSR - DeFi Secrets Revealed

Send a \$0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.