Pendulum-Chain
Published in

Pendulum-Chain

What is an Automated Market Maker (AMM)?

How AMMs work, how they differ from traditional order books and why they are one of most important crypto innovations to date.

Amber is now developing an AMM on Amplitude — follow @0xamberHQ to track the progress or apply for funding to buidl on Pendulum.

In the DeFi space, many decentralized exchanges (DEXes) operate differently from the traditional order book on a centralized exchange. So what are the differences? To answer this, let’s look at how traditional exchanges work, before diving into how AMMs work.

How a traditional exchange works

In a traditional exchange, whether it be stocks, commodities, or centralized crypto exchanges, the price of an asset is based on an order book. There is a clear bid price and ask price with the current market price in the middle. Let’s explain this concept by looking at an order book on BTSE, a centralized exchange:

You can see all of the buy and sell orders

The display shows all current buy orders and sell orders happening for an asset (in this example BTC) at a given moment. In this snapshot, for example, we can see that there is a pending order to buy 0.3355 BTC at a price of $23,386 and a pending order to sell 3.1554 BTC at a price of 23,387.

Remember that with traditional order book trading, every time someone is buying, there is someone on the other side who is selling, and vice-versa. Traditional order book markets generally have market-makers, in order to ensure a constant and smooth flow of orders. The market makers make money by performing arbitrage. Arbitrage means taking advantage when there is price inefficiency between the bid and the ask. Using the example above, a market maker might see that there is 3.1 BTC trying to be sold at $23,387 and only 0.3355 BTC of purchase orders at $23,386. So, a fast savvy market maker might buy the 0.3355 BTC at $23,386 and sell it immediately for $23,387. So, how are AMMs different?

How AMMs work

As explained in the name, an Automated Market Maker (AMM) is a market maker that operates automatically, using code and algorithms. With AMMs there is no need for an active market maker. The most famous AMM, Uniswap, operates on a simple formula to determine the price of an asset:

Let’s break down this formula. Instead of the traditional order book where we can see every buy and sell order, AMMs do not have an order book. They determine prices through a liquidity pool. A liquidity pool is essentially a box with two or more assets in it. Uniswap’s pioneering technology allows users to create a liquidity pool with any pair of ERC-20 tokens with a 50/50 ratio. This has become the most enduring AMM model on Ethereum. Most of the time, a liquidity pool consists of a trading pair but we have seen more complicated liquidity pools on Balancer with 5 or more assets in it. To keep it simple, however, let’s focus on a liquidity pool that only has two assets in it like a ETH/USDT liquidity pool:

To start out, let’s assume that there are equivalent amounts of ETH and USDT in the liquidity pool. To make it easy, let’s say that we pair 2000 USDT with 1 ETH as the initial liquidity pool. Remember that the formula is x * y = k, with k being a constant and therefore never changing value. Going to our ETH/USDT liquidity pool, this means that:

1 ETH * 2000 USDT = k

If someone was to buy 0.1 ETH from this liquidity pool, then the pool would have:

0.9 ETH * 2200 USDT = k

Because there is less ETH and more USDT in the liquidity pool now, the price of ETH goes up. Inversely, if we were to sell ETH to the AMM, the liquidity pool would receive more ETH and have some USDT removed, then the price of ETH would go down. A great advantage of AMMs is they work while eliminating market makers and middlemen and have all the benefits of decentralization and censorship resistance. However, one downside to AMMs is impermanent loss.

Impermanent loss

Impermanent loss can occur to people who provide liquidity to the liquidity pool. In the case of Uniswap, anyone can provide liquidity to any liquidity pool (LP). The advantage of depositing into an LP is that you get LP fees, in the case of Uniswap it is 0.3% of the trade amount. An impermanent loss is a net difference between the value of two cryptocurrency assets in a liquidity pool-based automated market maker. So if the price of an asset in the liquidity pool is volatile, liquidity providers can experience a loss. This loss is not necessarily permanent as the prices can recover and rebalance, hence the term impermanent loss. Learn more about impermanent loss on the Finematics Youtube channel:

Summary

The AMM innovation takes a huge step towards permissionless decentralized trading being available for everyone. But the innovations have only just begun and the Amber AMM being developed for Pendulum utilizes a system that removes impermanent loss (for real!). More information about Amber can be found in the whitepaper.

Following the successful Amplitude parachain auction on Kusama, all future Pendulum dApps have the option of utilizing a development testing ground with real financial consequences. Remember to follow Pendulum & Amplitude on our socials for more useful content as well as the latest updates on our progress towards building a forex optimized blockchain that brings fiat to DeFi!

About Amplitude

Pioneering the internet of fiat. Amplitude is the sister network of Pendulum on Kusama. It will act as a testing ground for Pendulum applications and network parameters and be powered by the AMPE token. Developed by SatoshiPay.

About Pendulum

Building the missing link between fiat and DeFi through a fiat-optimized smart contract blockchain based on Polkadot’s Substrate. Allowing traditional finance fiat services to integrate with DeFi applications such as specialized forex AMMs, lending protocols, or yield farming opportunities. Developed by SatoshiPay.

Keep your eyes on the Pendulum!

Twitter | Telegram Announcements | Telegram Community | Discord | Reddit

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store