AMMs, made easy

Samson inekigha
5 min readAug 29, 2021

Have you ever wondered how decentralized exchanges (DEX) handle trades and price discovery? In contrast to traditional exchanges, a DEX employs an automated market maker (AMM) to provide a fluid trading system that straddles the line between autonomy, liquidity, and automation. Continue reading to learn about automated market makers and how they work to fuel decentralized exchanges.

What Is Market Making and How Does It Work?

Before we go into the mechanics of AMMs, it’s important to understand how market makers work together in the financial world.

Market making, as the name implies, refers to the process of determining asset values while also providing liquidity to the market. A market maker, in other words, creates liquidity for a financial asset. It must find a mechanism to meet the selling and buying orders of traders, which has an impact on the asset’s pricing.

To enable Bitcoin trades, a Bitcoin exchange, for example, uses an order book and an order matching mechanism. The order book keeps track of and displays the prices at which traders want to purchase or sell Bitcoin.

On the other side, the order matching system matches and settles sell and buy orders. At any given time, the most recent price at which Bitcoin was purchased will be automatically displayed as the digital asset’s market price.

The market is said to be illiquid or prone to slippage when there aren’t enough counterparties to trade with. Slippage happens when the processing of enormous order volumes causes an asset’s price to fluctuate.

To avoid this, several crypto exchanges use professional traders — like as brokers, banks, and other institutional investors — to provide liquidity on a constant basis. By matching traders’ orders with bid-ask orders, these liquidity providers ensure that there are always counterparties to trade with. The practice of providing liquidity is referred to as market making, and the businesses that provide liquidity are referred to as market makers.

It’s easier to comprehend the workings of an automated market maker now that you know what market making is.

What Then Is an Automated Market Maker?

It is evident from the preceding explanation that crypto market makers work around the clock to prevent price volatility by providing adequate liquidity. What if there was a way to make this process more democratic, allowing the average person to act as a market maker? This is where the automated market makers come in.

Uniswap, Sushi, Curve, and Balancer are examples of decentralized trading protocols that do away with order books, order matching systems, and financial firms functioning as market makers. The idea is to remove the need for third-party input, allowing users to trade directly from their personal wallets. As a result, smart contracts are used to perform and govern the bulk of processes.

To put it another way, AMMs allow traders to interact with smart contracts that are programmed to provide liquidity and price discovery. While this summarizes the notion of AMM, it does not go into detail into the processes and technologies that enable it.

How Do AMMs Work?

To begin, keep in mind that AMMs employ pre-programmed mathematical algorithms to discover and maintain the prices of paired cryptocurrencies. It’s also worth noting that AMMs make it possible for anyone to supply liquidity for paired assets. Anyone can become a liquidity provider thanks to the protocol (LP).

Let’s use Uniswap as an example to demonstrate this. The protocol employs the well-known x*y=k equation, in which X represents Asset A’s value and Y represents Asset B’s. K is a fixed number. As a result, regardless of how much the value of assets A and B varies, their product must always equal a constant.

While there are many different approaches to AMMs, such as Uniswap and Balancer, they all require liquidity to function correctly and avoid slippages. As a result, these protocols reward liquidity providers by allocating a portion of the commission generated by liquidity pools and governance tokens to them. In other words, when you give funds to manage liquidity pools, you collect transaction fees.

You will earn liquidity provider tokens, which represent your part of the liquidity put in a pool, once you have staked your fund. These tokens also allow you to earn passive money from transaction fees. For extra yield farming options, you can deposit these tokens on other protocols that accept them. You’d have to give in your LP tokens to remove your liquidity from the pool.

Another thing to keep in mind about AMMs is that they are perfect for arbitrageurs. Arbitrageurs, for those unfamiliar with the term, profit on inefficiencies in financial markets. They purchase assets at a reduced price on one exchange and immediately sell them on a platform with somewhat higher rates. Arbitrageurs can sell or buy pooled tokens when there are price differences between them and the exchange rate of external marketplaces until the market inefficiency is eliminated.

Impermanent Loss

Although AMMs provide considerable returns to LPs, they are not without risk. Impermanent loss is the most common. When the price ratio of assets in a liquidity pool changes, this phenomena occurs. LPs who have placed funds in the concerned pools will suffer a temporary loss. The greater the price ratio shift, the greater the loss.

This loss, however, is referred to as impermanent for a reason. It is still possible to lessen this loss if you do not withdraw deposited tokens when the pool is suffering a price ratio adjustment. When the values of the tokens return to the original value at which they were placed, the loss is gone. Those that withdraw money before the prices revert will lose it forever. However, the income received through transaction fees may be sufficient to compensate such losses.

Conclusion

AMMs have shown to be creative solutions for facilitating decentralized exchanges in recent years. We’ve seen the birth of a host of DEXs over this time, all of which are fueling the ongoing DeFi craze. While this does not imply that the method is without flaws, the progress made in the last year demonstrates the wide range of possibilities that AMMs offer. It will be interesting to watch where we go from here.

stay updated with persistence

https://twitter.com/PersistenceOne https://t.me/PersistenceOneChat
https://t.me/PersistenceOne
https://discord.gg/SaBKpjbnhH
https://www.reddit.com/r/PersistenceOne/

https://www.youtube.com/channel/UC5wqI1ZRdkCjWWVOCQdhxLQ/featured
https://medium.com/persistence-blog
https://www.linkedin.com/company/persistenceone/

--

--