Bitcoin btc
$ usd

What Is an Automated Market Maker (AMM)?

14 mins
Updated by May Woods
Join our Trading Community on Telegram

Over the past few years, many innovative financial tools have graced the decentralized crypto space. Yet, only some are as innovative as an AMM. Unabbreviated as the automated market maker, AMMs ensure trustless transactions and trades across decentralized exchanges (DEXs), focusing on democratizing finance. 

As a technology, an automated market maker involves smart contracts, ensuring that trade facilitation is handled by code and not by humans. Simply put, it orchestrates a harmony in the DeFi space, where price discovery, trades, transactions, token swaps, and other components move in sync with each other. Powered by blockchain technology and suitable for the financial crypto markets, an AMM has several components running the behind the curtains.

In the subsequent sections, we review the entire AMM premise, looking at its diverse components, simplifying the modus operandi, and even covering real-world applications.

The history of AMMs

Long before AMMs or even DEXs were around, trades across traditional markets were facilitated by the order book system. You can consider the order book as a diary that records the interest of buyers and sellers for a given asset.

These legacy market makers provided liquidity to traditional markets, profiting from bid-ask price spread. For the unversed, the price spread signifies the difference between what is being asked by the seller and what is being paid by the buyer. These market makers buy low and sell high, offering assets to either category of trade participants for a small profit.

History of AMM: BIC
History of AMMs: BIC

While traditional market makers are still useful across other high-beta assets like equities, they do not work that well across crypto markets. Crypto markets are highly volatile, and liquidity is often an issue, especially for the more elusive token pairs.

The rise of AMMs

AMMs emerged officially in 2017 with Bancor. However, Uniswap made AMMs popular, surfacing in 2018. Built on Ethereum, Uniswap is powered by smart contracts and automates the process of market making. Since 2018, many things have happened in the AMM space, especially regarding liquidity provisioning, price discovery, and handling risks like impermanent loss. 

Yet, a lot more is desired by the crypto community.

Hayden Adams (hayden.eth) creator of the Uniswap Protocol: Twitter

However, Hayden’s take is not a unanimous perspective and did face some backlash from the Twitter community:

Post UniSwap, several AMM-powered DEXs like PancakeSwap and SushiSwap have also surfaced. New and improved automated market maker models, like Probabilistic AMMs, Constant Product AMMs, and more, have come to the fore, with new possibilities for the DeFi space. And in 2023, even layer-2 solutions like Polygon have started deploying AMMs, in the form of UniSwap V3, with a focus on lowering the crypto trading fees. 

Understanding automated market makers: the concept

A simple way of looking at an AMM is to consider a specialized DEX protocol. Governing the protocol is a mathematical algorithm, pricing each asset and governing how it moves within the DeFi space. 

The concept behind AMM: BIC
The concept behind automated market maker: BIC

You can think of an automated market maker as an engine fuelling the operations of the DEX in sight. Let us understand this a bit better with a traditional way of defining things. 

Here is a detailed thread that captures the concept of AMMs.

What is an automated market maker (AMM)?

An automated market maker doesn’t depend on buy-sell orders like a traditional order book-led exchange. Instead, it relies on liquidity pools. A set of these pools make an automated market maker, with each pool filled with a wide range of tokens for facilitating trades. The number of tokens in a given pool determines the price of the trade. 

Here is a quick example to understand this better:

Imagine there is a fish market where the prices of fish fluctuate depending on demand and supply. If a higher number of a particular fish floods the market, the supply increases, pushing the prices down. If the supply turns scarce, the price surges. AMMs operate similarly, with the concept of price discovery dependent on the supply-demand mechanics. 

Unlike traditional order books, where humans handle the buying and selling, AMMs support automated trading with liquidity providers, DeFi users, and more intertwined with smart contracts.

AMM vs. Exchanges
AMM vs. exchanges: BIC

How does AMM work?

Here is another example to understand how an automated market maker works:

Imagine there is a self-functioning car wash where you select the washing service, pay for it right into the machines, and sit back while the machine takes care of the work. As for an automated market maker, paying into the machines is synonymous with depositing a token in a DEX or a standalone liquidity pool.

The services returned by the car wash are synonymous with the swapped tokens, which a specific liquidity pool of the concerned AMM gives in return for the deposits. 

Mathematics governing market makers: BIS
Mathematics governing market makers: BIS

As liquidity providers manage the liquidity pools by offering specific quantities of tokens, one smart contract-powered arm of the automated market maker is concerned with incentivizing them by giving the provider a portion of the crypto trading fees. Note that every liquidity pool or even DEX works as a crypto trading platform, and users must pay trading fees to access the services. A portion of these trading fees is given to the liquidity providers. What portion goes where is decided by the AMM smart contracts.

The role of gas fees

Another component is involved when it comes to making AMM-specific transactions. This involves the gas fees — more like the fuel users must pay for using the blockchain technology associated with a given ecosystem. Notably, the gas fee isn’t a direct function of the AMM’s smart contract and is determined by the blockchain itself.

To sum it up, here are the activities that a typical automated market maker handles as part of an end-to-end DeFi protocol:

  1. Facilitating token swaps using trading pairs 
  2. Helping with price discovery by trading supply-demand
  3. Allocating crypto trading fees to the liquidity providers
  4. Managing liquidity provisioning across pools
  5. Managing impermanent loss by putting certain conditions in smart contracts
  6. Enabling yield farming conditions 
  7. Interacting with other protocols
Top market maker pools: KPMG
Top market maker pools: KPMG

As seen, AMMs are in charge of considerably more than just handling trades and swaps. 

The mathematics behind AMM 

Let us now look at a pretty simple formula for an automated market maker and implement the same practically:

The standard formula for an AMM remains:

x* y = k

Where,

x represents the amount of asset A, y represents the amount of asset B, and K is the AMM-defined constant.

AMM function
Automated market maker function: BIC

As in any liquidity pool, two tokens (A and B) are involved; we consider the token swaps as trading pair swaps.

It is worth noting that the K needs to be constant. There if the amount of X changes within the pool, the amount of Y will also need to change in a specific ratio to ensure that the K remains the same. Let us take the DAI/WBTC example here.

Did you know? The mathematical base of how an AMM operates dates back to 1996. Professor Othmar M. Lehner proposed a model for the market maker in his detailed dissertation on “Forecasting and Hedging in the Currency Market.”

Suppose a DAI/WBTC pool has 10,000 DAI and 10 WBTC, making the constant 10,000 x 10 = 100,000.

The example 

Now if a person withdraws 1 WBTC from the pool, changing the Y, the value of X will also change per the k/y ratio. Therefore, the new amount of DAI that should be present within the pool is 100,000/9 = 1,111.11.

Therefore, a trader who wants to withdraw 1 WBTC should deposit 1,111.11 DAI tokens into the pool. Another way of looking at it is equating 1 WBTC (pool-specific) price to 1,111.11 DAI tokens. This is how an AMM works, especially in regard to liquidity provision and token swaps. 

Note that while x * y = k is the standard formula, different AMMs have different versions to justify pool health. For instance, Balance follows a weighted approach with k = (balance 1 / weight 1) * (balance 2 / weight 2)…… * (balance n / weight n).

Curve Finance follows D = A * S + S^N / N^N as the go-to formula where D is the constant, S is the sum of all reserves, A is the special coefficient meant for amplification, and N is the number of pool-specific assets.

Even the likes of Uniswap V3 and Bancor have specific mathematical calculations backing their algorithms.

What are the different Types of AMM?

Automated market makers can vary depending on the algorithms they use and the purpose they serve. Here are the different types to be aware of:

Virtual AMMs

These are automated market makers without any actual assets in pools. Instead, all there is a mathematical model governing the prices. These market makers can be complex. One such example would be Perpetual Protocol, where event outcomes are traded.

Another way of looking at virtual AMMs is to consider them loaded with virtual balances to lower the impact of large trades. Bancor’s V2 is an example of where virtual balances are used. 

Probabilistic AMMs

These AMMs use probabilistic mathematical formulas to govern the price of the trades. These are smart contract-led AMMs where complex mathematical models are used. These AMMs can serve as benchmarks for other AMMs which require assistance with proprietary formulas. Tokemak is one such example of a probabilistic AMM.

Constant product AMMs

These are the most common form of AMMs, usually represented by the x * y = k formula. In these AMMs, if the price of one asset goes up due to lower supply, the other asset’s price must go down to maintain balance. Uniswap is an example of a constant product AMM.

Uniswap has recently launched the UniswapX protocol — a better way to trade across AMMs, offering improved liquidity, zero transaction failure, and even gas-free swapping. This is set to take the concept of constant product AMMs to a whole new level.

Hybrid AMMs

Hybrid automated market makers are capable of changing their operating principle based on scenarios. They can work as constant product AMMs for standard trades, but when the price of an asset becomes way too volatile, driving the risks of liquidations, they can turn into probabilistic AMMs. Balancer works as a hybrid AMM.

Weighted average price AMMs

The operating principle of these AMMs relies on a special formula where the price of an asset is represented by the amount of both the assets in the pool and not just one asset. One such example is Curve Finance, a platform used to trade stablecoins.

Custom mean AMMs

There is a custom mean formula governing the price of assets within these automated market makers. This way, it is possible to customize the price of assets to meet specific AMM requirements. Notional is an example of a custom mean AMM.

Dynamic AMMs

These automated market makers, per their name, change the ecosystem parameters in response to market conditions. 1inch is an example of this.

NFT AMMs

These are specialized market makers meant to simplify NFT trades. These AMMs are meant to infuse liquidity into the otherwise illiquid NFT space. NFTX is an example of such an NFT AMM.

SeaCows is yet another project that aims to ramp up NFT liquidity by making NFTFi more accessible to people.

Lending AMMs

These AMMs, at their core, are meant to facilitate lending and borrowing. Users supply or deposit assets into pools, earning interest in the process. On the other hand, borrowers can loan out assets at pre-determined interest rates. Aave and Compound are prime examples of lending AMMs.

Insurance AMMs

The pooling nature of assets to ensure the ones that belong to others is at the heart of insurance AMMs. Nexus Mutual is one example of this.

Option AMMs

Per the name, these AMMs allow options trading, where not the asset but the derivative of the same is used for trading. Opyn is an example of an option AMM.

Prediction AMMs

There are a few AMMs that allow you to trade specific scenarios or even bet on specific event-related outcomes. Augur is one such widely popular prediction AMM.

Liquidity-as-a-service AMMs

These AMMs are good at aggregative liquidity from diverse DeFi protocols. 1inch offers liquidity-as-a-service as part of its AMM offering.

Synthetic AMMs

If you wish to trade synthetic assets that represent real-world assets like stocks or even gold, you can consider Synthetic AMMs like Synthetix.

Market maker according to application: KPMG
Market maker according to application: KPMG

Applications in DeFi

If you are planning to explore AMMs further, here are a few DeFi-specific applications that you must keep in mind:

Market maker for traders and liquidity providers: KPMG
Market maker for traders and liquidity providers: KPMG

Yield farming

This is where liquidity providers deposit specific assets into pools, earning yields and fees in the process. There are several yield farming platforms in play, including the likes of Compound and SushiSwap.

AMM and yield farming
How yield farming works: BIC

Liquidity provision

This leg, or rather the use-case of automated market makers, is at the core of liquidity pools. Liquidity providers provide liquidity, which they build on top of for generating higher yields via yield farming. If you are solely looking at liquidity provisioning as a use case, platforms like Cure Finance and Uniswap are the ones to focus on.

Trading fee incentivization

Another application of automated market makers would be to use the platform for incentivizing liquidity providers. The market maker protocol works as a standard trading interface, with each transaction incurring some kind of trading fee. AMMs have a built-in trading fee-sharing schedule with the liquidity providers, which keeps them interested and incentivized. 

Arbitrage trading

Automated market makers also allow you to take arbitrage trading positions as the price of an asset within an AMM’s liquidity pool might vary from the market due to the inclination to adhere to the constant value, k. For example, if you plan to buy ETH, trading at $1,900 on most exchanges, on an AMM, you might have to consider the ETH/USDT balance before moving in. 

Note: This is considering we are dealing with an ETH/USDT pool.

Now, if the supply of ETH is higher in the pool due to people buying a lot of USDT for ETH, the price of ETH might be lower than the market’s $1,900. This price difference is what gives rise to an arbitrage trading opportunity.

Loss management

Impermanent loss is a unique issue that plagues most AMMs.

Impermanent loss in market making: BIC
Impermanent loss in market making: BIC

This concerns when the price of assets supplied by the liquidity providers moves in another direction, pushing them towards liquidation risks. Despite being a source of impermanent loss, AMMs also offer solutions to the same. These can be in the form of probabilistic AMMs with specialized mathematical algorithms in play.

AMMs like Balancer have weightage-specific solutions in place, lowering the price sensitivity and inherent volatility of assets. Then we have Curve Finance, where the pools primarily deal in stablecoins — which are intended to hold steady values. 

Automated trading

AMMs eliminate the need for traditional market markers and order books, enabling P2P, automated trades. Order size and middlemen issues aren’t encountered as smart contracts govern the entire trading scenario. 

Price oracle

Some AMMs like Uniswap serve as decentralized price oracles, allowing other DeFi protocols to access real-time price-based info.

Cross-chain trading

Several popular cross-chain market makers, like the Synapse Protocol, THORChain, Ren Protocol, and more, allow users to swap tokens across chains. This functionality makes AMMs suitable as cross-chain bridges.

Asset creation

AMMs are also good for asset creation, provided you can locate the right one. The likes of Synthetix can help create synthetic assets by mimicking real-world ones.

What are the benefits of AMMs?

Here is a quick list of benefits, per our discussion, that capture the true essence of automated market makers:

  1. They are permissionless
  2. There are no order book-related complications
  3. They allow liquidity providers to earn rewards
  4. Highly transparent
  5. Highly price efficient as they ensure proper price discovery due to constant mathematical equations in play
  6. Interoperable as AMMs can let you interact cross-chain

The risks of AMMs

Despite the crazy potential, automated market makers do come with their share of risks and challenges. These include:

  1. Impermanent loss
  2. Smart contract-related security vulnerabilities
  3. High gas fees 
  4. Regulatory risks
  5. Low liquidity risks
  6. Volatility risks

The path ahead for AMMs 

Automated market makers are revolutionizing DeFi. At first glance, they infuse liquidity into the DeFi ecosystem, making it easier for users to buy and sell crypto. Yet, the functionality of AMM’s exceeds this one use case. As seen throughout our discussion, the right AMM can help with arbitrage trading, yield farming, and more.

Still, the potential of AMM remains untapped. Over time, we might see DeFi experts using AMM and related technology to create and trade new financial assets, make the small-cap token space more liquid, and put across more innovative DEXs. And NFT AMMs and virtual AMMs with specialized smart contracts are already making their presence felt. In all, AMMs are venturing seamlessly into lending, insurance, real-asset, and other spaces. It will be interesting to see how far and deep they foray. 

Frequently asked questions

What is the full form of AMM?

Who created AMM?

How does an AMM work?

What are the benefits of on-exchange trading?

What does a market maker do in crypto?

What is a virtual AMM?

What is liquidity pool crypto?

What is an NFT AMM?

Disclaimer

In line with the Trust Project guidelines, the educational content on this website is offered in good faith and for general information purposes only. BeInCrypto prioritizes providing high-quality information, taking the time to research and create informative content for readers. While partners may reward the company with commissions for placements in articles, these commissions do not influence the unbiased, honest, and helpful content creation process. Any action taken by the reader based on this information is strictly at their own risk.

Ananda.png
Ananda Banerjee
Ananda Banerjee is a technical copy/content writer specializing in web3, crypto, Blockchain, AI, and SaaS — in a career spanning over 12 years. After completing his M.Tech in...
READ FULL BIO
Sponsored
Sponsored