Comparison of AMM and CLOB Trading Models

BeginnerOct 11, 2024
Explore the key differences between Automated Market Maker (AMM) and Central Limit Order Book (CLOB) trading models in decentralized exchanges (DEXs). This comprehensive comparison delves into their principles, advantages, disadvantages, pricing mechanisms, liquidity provision, and user experiences. Understand how these models shape the DeFi landscape, from Uniswap's dominance to emerging innovations in concentrated liquidity and market-making algorithms.
Comparison of AMM and CLOB Trading Models

Introduction

The development of DEX (Decentralized Exchange) remained dormant until June 2020, when trading volumes in the sector began to surge dramatically. Today, DEX has evolved into critical infrastructure in the DeFi (Decentralized Finance) sector, with daily trading volumes reaching $2.88 billion. Initially, DEX trading followed an order book model, but liquidity stagnated until the rise of the AMM (Automated Market Maker) model. This innovation triggered rapid growth in both trading volume and user numbers.

Bancor, launched in 2017, pioneered the AMM concept. Major projects like Uniswap followed in 2018, along with Sushiswap, Balancer, and the stablecoin-focused Curve Finance. Now, most mainstream on-chain DEXs operate on the AMM mechanism. Uniswap leads the pack, boasting daily trading volumes of $1.2 billion and commanding over 44.5% of the DEX market share.


Source: dune.com

Order books and AMM are two trading models in the crypto field, each with its own characteristics and applicable scenarios. The main difference between the two lies in how they match buyers and sellers, price assets, and provide liquidity. This article will compare these two trading modes, including their working principles and pricing methods, and analyze their respective advantages and disadvantages.

Principles

Central Limit Order Books (CLOB): This model is widely used in traditional finance and centralized exchanges (CEX). It consists of a transparent list of bids and offers, where trades are matched at the best price. Orders are provided by regular traders or market makers, with the latter able to post more orders to the order book, thereby increasing market liquidity and reducing spreads.

dYdX uses a typical CLOB trading model. Its v3 employs StarkEx technology, backed by Starkware, as the trading engine for v2 perpetual contracts. This allows for off-chain matching via the StarkEx engine, on-chain settlement, and liquidity provision by professional market makers for asset custody. Users transfer assets to StarkEx and send them to the Stark Contract (smart contract). Once the StarkEx contract accepts the funds, they can be used off-chain on Layer 2 without further user signatures. Users only need to send transactions to the Ethereum mainnet when moving funds in and out of margin accounts. Data isn’t recorded on-chain during trading, reducing slippage and boosting trading speed. v4 has shifted away from Ethereum, opting for Cosmos SDK, whereas previously, Starkware’s trading and execution engines depended on centralized service providers.

Automated Market Maker (AMM): This refers to managing liquidity pools through algorithms, automatically adjusting prices based on predefined rules to provide trading opportunities. The basic algorithm uses the constant product formula x*y=k, giving users real-time exchange rates. Liquidity providers only need to deposit assets into the liquidity pool, and traditional market makers can also participate. The liquidity pool becomes the trading counterparty for users.

Advantages and Disadvantages

The CLOB trading model matches prices between buyers and sellers with multiple counterparties. It’s ideal for large trades and provides high transparency through publicly visible orders. However, it has drawbacks: order matching efficiency is low, and when orders are scarce, takers may encounter significant price spreads. The model also faces a “cold start” challenge. Moreover, Ethereum’s transaction processing speed (TPS) can’t support real-time updates of order books in this mode.

The AMM mechanism pools liquidity from market makers and avoids cold start issues. However, it can suffer from slippage on large orders, and liquidity providers (LPs) risk impermanent loss (IL). IL is the difference in value between depositing tokens in an AMM and simply holding them in a wallet. This loss occurs when the market price of tokens in the AMM changes in either direction. As AMMs don’t automatically adjust exchange rates, arbitrageurs must buy underpriced assets or sell overpriced ones until the AMM’s price aligns with the overall market price. These arbitrageurs profit at the expense of LPs, resulting in losses for the latter.

Pricing Mechanisms

In the order book trading model, prices match supply and demand between buyers and sellers. Market makers play a vital role in traditional trading markets. They continuously provide buy and sell quotes, enhancing liquidity for other participants. This allows users to trade assets at optimal prices with minimal slippage, facilitating price discovery. However, traditional financial regulations and competitive barriers have limited individuals and small traders from becoming market makers. The cryptocurrency industry, in contrast, offers market access to all participants, making market-making and liquidity provision more accessible. Nevertheless, Ethereum’s inherent performance limitations have hindered the significant development of on-chain order books and market makers.

The AMM trading mechanism significantly reduces the need for market-maker quotes by using algorithms to calculate trading prices automatically. This innovation eliminates the role of traditional market makers; instead, liquidity providers simply need to continuously supply assets to the platform, allowing users to trade freely. Throughout its evolution, the AMM model has proven to be one of DeFi’s most transformative innovations, attracting nearly all the liquidity in decentralized exchanges.

The x*y=k algorithm determines the price of a specific token based on the balance between two tokens and their supply and demand relationship. The value moves along the curve of this formula, as shown in the figure below:


Source: www.paradigm.xyz

To illustrate Uniswap’s constant product algorithm XY=k, let’s consider an MKR/ETH pool with 100 MKR and 152 ETH. Here, K=XY=100*152=15200. If you want to buy MKR with 1 ETH, it’s equivalent to adding 1 ETH to the pool (i.e., Y=Y+1). To maintain K constant, you can get m MKR, where m=100-K/(152+1)=0.654. You’ll receive 0.654 MKR, making your purchase price 1.529 ETH/MKR, plus a small fee (e.g., 0.3% trading fee + Gas fee). In reality, since Uniswap charges a 0.3% trading fee added to the pool as a reward for liquidity providers, the k value will increase slightly.

Another model similar to CPMM (Constant Product Market Maker) is CSMM (Constant Sum Market Maker), which is more suitable for scenarios where price changes are close to zero during trades. However, when off-chain prices mismatch with tokens in the pool, this design allows traders and arbitrageurs to deplete the pool’s reserves, destabilizing the liquidity pool and concentrating assets into a single type, rendering the pool dysfunctional. Thus, this algorithm has limited applications.

Balancer later introduced the Constant Mean Market Maker (CMMM). In this AMM, unlike the traditional system, each liquidity pool can have more than two asset types. It also allows different asset weightings, departing from the classic 50:50 weight system, but requires maintaining a constant weighted geometric mean of each asset’s reserves. Although it can accommodate up to eight assets, it still doesn’t solve some drawbacks of the AMM model, such as impermanent loss.


Source: Balancer White Paper

The core market-making algorithm determines a DEX’s capital efficiency and trading experience. Concentrated liquidity is the mainstream trend for efficient market-making by LPs in the AMM trading model. Constant product market-making curves are known for evenly distributing liquidity along the curve, resulting in low capital efficiency for AMMs. To address this, leading DEXs have adopted concentrated liquidity methods to improve LP capital efficiency. Curve v2, based on the Stableswap curve, introduced a market-making curve adjusted by internal oracle prices, concentrating liquidity near the oracle price. Uniswap v3 introduced range orders, allowing LPs to provide liquidity within selected price ranges and earn fee income. DODO innovatively proposed the PMM (Proactive Market Maker) algorithm, using external market maker quotes to concentrate prices near market prices. Many protocols built on Uniswap v3 use rebalancing methods to re-concentrate liquidity. As a result, competition among DEXs is becoming increasingly fierce.


Source: www.paradigm.xyz

Liquidity

The completion of a transaction depends on four roles: trader, aggregator (DEX or aggregator), DEX protocol, and liquidity provider. The most critical role in DEXs is the liquidity provider, which is the primary resource that various protocols compete for. Liquidity providers, also known as market makers, play a key role in trading. They continuously post buy and sell prices, increasing market liquidity and allowing users to trade at optimal prices with minimal slippage.

Currently, DEX market makers can be divided into two types:

  • Professional market makers primarily provide buy and sell orders in order book-based DEXs.
  • Individual market makers contribute liquidity by depositing assets into liquidity pools, with buy and sell prices determined by algorithms. A significant portion of liquidity in AMM-based DEXs comes from individual market makers.

The introduction of AMM was a disruptive innovation for DEXs, eliminating the need for market makers to quote prices manually. Instead, AMM algorithms automatically calculate trading prices, allowing anyone to provide liquidity and improve on-chain liquidity. However, challenges like low capital efficiency and impermanent loss still exist. Capital efficiency measures how much trading volume can be supported with less total value locked (TVL), resulting in lower slippage and better market depth. The core market-making algorithm determines the capital efficiency of a DEX and the trading experience it offers. As market liquidity trends towards consolidation, competition among DEXs is intensifying. Protocols continuously refine market-making algorithms and trading experiences to attract more liquidity, thereby capturing a larger market share in the aggregation process.

User Experience

In terms of user experience, the order book trading model offers high transparency. Users can see matched prices and the order book, and it supports both limit and market orders.


Source: Gate.io’s trading platform

AMM-based trading platforms only display the total value locked (TVL) of liquidity pools, giving users insight into the pool’s liquidity size. However, they cannot view current trading prices, as trades are generally executed at the market price.


Source: app.uniswap.org

Author: Minnie
Translator: Sonia
Reviewer(s): KOWEI、Piccolo、Elisa
Translation Reviewer(s): Ashely、Joyce
* The information is not intended to be and does not constitute financial advice or any other recommendation of any sort offered or endorsed by Gate.io.
* This article may not be reproduced, transmitted or copied without referencing Gate.io. Contravention is an infringement of Copyright Act and may be subject to legal action.

Comparison of AMM and CLOB Trading Models

BeginnerOct 11, 2024
Explore the key differences between Automated Market Maker (AMM) and Central Limit Order Book (CLOB) trading models in decentralized exchanges (DEXs). This comprehensive comparison delves into their principles, advantages, disadvantages, pricing mechanisms, liquidity provision, and user experiences. Understand how these models shape the DeFi landscape, from Uniswap's dominance to emerging innovations in concentrated liquidity and market-making algorithms.
Comparison of AMM and CLOB Trading Models

Introduction

The development of DEX (Decentralized Exchange) remained dormant until June 2020, when trading volumes in the sector began to surge dramatically. Today, DEX has evolved into critical infrastructure in the DeFi (Decentralized Finance) sector, with daily trading volumes reaching $2.88 billion. Initially, DEX trading followed an order book model, but liquidity stagnated until the rise of the AMM (Automated Market Maker) model. This innovation triggered rapid growth in both trading volume and user numbers.

Bancor, launched in 2017, pioneered the AMM concept. Major projects like Uniswap followed in 2018, along with Sushiswap, Balancer, and the stablecoin-focused Curve Finance. Now, most mainstream on-chain DEXs operate on the AMM mechanism. Uniswap leads the pack, boasting daily trading volumes of $1.2 billion and commanding over 44.5% of the DEX market share.


Source: dune.com

Order books and AMM are two trading models in the crypto field, each with its own characteristics and applicable scenarios. The main difference between the two lies in how they match buyers and sellers, price assets, and provide liquidity. This article will compare these two trading modes, including their working principles and pricing methods, and analyze their respective advantages and disadvantages.

Principles

Central Limit Order Books (CLOB): This model is widely used in traditional finance and centralized exchanges (CEX). It consists of a transparent list of bids and offers, where trades are matched at the best price. Orders are provided by regular traders or market makers, with the latter able to post more orders to the order book, thereby increasing market liquidity and reducing spreads.

dYdX uses a typical CLOB trading model. Its v3 employs StarkEx technology, backed by Starkware, as the trading engine for v2 perpetual contracts. This allows for off-chain matching via the StarkEx engine, on-chain settlement, and liquidity provision by professional market makers for asset custody. Users transfer assets to StarkEx and send them to the Stark Contract (smart contract). Once the StarkEx contract accepts the funds, they can be used off-chain on Layer 2 without further user signatures. Users only need to send transactions to the Ethereum mainnet when moving funds in and out of margin accounts. Data isn’t recorded on-chain during trading, reducing slippage and boosting trading speed. v4 has shifted away from Ethereum, opting for Cosmos SDK, whereas previously, Starkware’s trading and execution engines depended on centralized service providers.

Automated Market Maker (AMM): This refers to managing liquidity pools through algorithms, automatically adjusting prices based on predefined rules to provide trading opportunities. The basic algorithm uses the constant product formula x*y=k, giving users real-time exchange rates. Liquidity providers only need to deposit assets into the liquidity pool, and traditional market makers can also participate. The liquidity pool becomes the trading counterparty for users.

Advantages and Disadvantages

The CLOB trading model matches prices between buyers and sellers with multiple counterparties. It’s ideal for large trades and provides high transparency through publicly visible orders. However, it has drawbacks: order matching efficiency is low, and when orders are scarce, takers may encounter significant price spreads. The model also faces a “cold start” challenge. Moreover, Ethereum’s transaction processing speed (TPS) can’t support real-time updates of order books in this mode.

The AMM mechanism pools liquidity from market makers and avoids cold start issues. However, it can suffer from slippage on large orders, and liquidity providers (LPs) risk impermanent loss (IL). IL is the difference in value between depositing tokens in an AMM and simply holding them in a wallet. This loss occurs when the market price of tokens in the AMM changes in either direction. As AMMs don’t automatically adjust exchange rates, arbitrageurs must buy underpriced assets or sell overpriced ones until the AMM’s price aligns with the overall market price. These arbitrageurs profit at the expense of LPs, resulting in losses for the latter.

Pricing Mechanisms

In the order book trading model, prices match supply and demand between buyers and sellers. Market makers play a vital role in traditional trading markets. They continuously provide buy and sell quotes, enhancing liquidity for other participants. This allows users to trade assets at optimal prices with minimal slippage, facilitating price discovery. However, traditional financial regulations and competitive barriers have limited individuals and small traders from becoming market makers. The cryptocurrency industry, in contrast, offers market access to all participants, making market-making and liquidity provision more accessible. Nevertheless, Ethereum’s inherent performance limitations have hindered the significant development of on-chain order books and market makers.

The AMM trading mechanism significantly reduces the need for market-maker quotes by using algorithms to calculate trading prices automatically. This innovation eliminates the role of traditional market makers; instead, liquidity providers simply need to continuously supply assets to the platform, allowing users to trade freely. Throughout its evolution, the AMM model has proven to be one of DeFi’s most transformative innovations, attracting nearly all the liquidity in decentralized exchanges.

The x*y=k algorithm determines the price of a specific token based on the balance between two tokens and their supply and demand relationship. The value moves along the curve of this formula, as shown in the figure below:


Source: www.paradigm.xyz

To illustrate Uniswap’s constant product algorithm XY=k, let’s consider an MKR/ETH pool with 100 MKR and 152 ETH. Here, K=XY=100*152=15200. If you want to buy MKR with 1 ETH, it’s equivalent to adding 1 ETH to the pool (i.e., Y=Y+1). To maintain K constant, you can get m MKR, where m=100-K/(152+1)=0.654. You’ll receive 0.654 MKR, making your purchase price 1.529 ETH/MKR, plus a small fee (e.g., 0.3% trading fee + Gas fee). In reality, since Uniswap charges a 0.3% trading fee added to the pool as a reward for liquidity providers, the k value will increase slightly.

Another model similar to CPMM (Constant Product Market Maker) is CSMM (Constant Sum Market Maker), which is more suitable for scenarios where price changes are close to zero during trades. However, when off-chain prices mismatch with tokens in the pool, this design allows traders and arbitrageurs to deplete the pool’s reserves, destabilizing the liquidity pool and concentrating assets into a single type, rendering the pool dysfunctional. Thus, this algorithm has limited applications.

Balancer later introduced the Constant Mean Market Maker (CMMM). In this AMM, unlike the traditional system, each liquidity pool can have more than two asset types. It also allows different asset weightings, departing from the classic 50:50 weight system, but requires maintaining a constant weighted geometric mean of each asset’s reserves. Although it can accommodate up to eight assets, it still doesn’t solve some drawbacks of the AMM model, such as impermanent loss.


Source: Balancer White Paper

The core market-making algorithm determines a DEX’s capital efficiency and trading experience. Concentrated liquidity is the mainstream trend for efficient market-making by LPs in the AMM trading model. Constant product market-making curves are known for evenly distributing liquidity along the curve, resulting in low capital efficiency for AMMs. To address this, leading DEXs have adopted concentrated liquidity methods to improve LP capital efficiency. Curve v2, based on the Stableswap curve, introduced a market-making curve adjusted by internal oracle prices, concentrating liquidity near the oracle price. Uniswap v3 introduced range orders, allowing LPs to provide liquidity within selected price ranges and earn fee income. DODO innovatively proposed the PMM (Proactive Market Maker) algorithm, using external market maker quotes to concentrate prices near market prices. Many protocols built on Uniswap v3 use rebalancing methods to re-concentrate liquidity. As a result, competition among DEXs is becoming increasingly fierce.


Source: www.paradigm.xyz

Liquidity

The completion of a transaction depends on four roles: trader, aggregator (DEX or aggregator), DEX protocol, and liquidity provider. The most critical role in DEXs is the liquidity provider, which is the primary resource that various protocols compete for. Liquidity providers, also known as market makers, play a key role in trading. They continuously post buy and sell prices, increasing market liquidity and allowing users to trade at optimal prices with minimal slippage.

Currently, DEX market makers can be divided into two types:

  • Professional market makers primarily provide buy and sell orders in order book-based DEXs.
  • Individual market makers contribute liquidity by depositing assets into liquidity pools, with buy and sell prices determined by algorithms. A significant portion of liquidity in AMM-based DEXs comes from individual market makers.

The introduction of AMM was a disruptive innovation for DEXs, eliminating the need for market makers to quote prices manually. Instead, AMM algorithms automatically calculate trading prices, allowing anyone to provide liquidity and improve on-chain liquidity. However, challenges like low capital efficiency and impermanent loss still exist. Capital efficiency measures how much trading volume can be supported with less total value locked (TVL), resulting in lower slippage and better market depth. The core market-making algorithm determines the capital efficiency of a DEX and the trading experience it offers. As market liquidity trends towards consolidation, competition among DEXs is intensifying. Protocols continuously refine market-making algorithms and trading experiences to attract more liquidity, thereby capturing a larger market share in the aggregation process.

User Experience

In terms of user experience, the order book trading model offers high transparency. Users can see matched prices and the order book, and it supports both limit and market orders.


Source: Gate.io’s trading platform

AMM-based trading platforms only display the total value locked (TVL) of liquidity pools, giving users insight into the pool’s liquidity size. However, they cannot view current trading prices, as trades are generally executed at the market price.


Source: app.uniswap.org

Author: Minnie
Translator: Sonia
Reviewer(s): KOWEI、Piccolo、Elisa
Translation Reviewer(s): Ashely、Joyce
* The information is not intended to be and does not constitute financial advice or any other recommendation of any sort offered or endorsed by Gate.io.
* This article may not be reproduced, transmitted or copied without referencing Gate.io. Contravention is an infringement of Copyright Act and may be subject to legal action.
Start Now
Sign up and get a
$100
Voucher!