A Comparison of Exchange Models

A Comparison of Exchange Models

Nahid Ibrahimzade

Nahid Ibrahimzade

MELD Ambassador

May 12, 2022

While the automated market maker (AMM) model has been widely used in decentralized exchanges (DEXs) in crypto, limit order book (LOB) model is used widely in most of the centralized exchanges (CEX) and some of the DEXs. In this article, both the LOB and AMM models are described and then compared. Additionally, some of DEXs that operate or will soon operate on Cardano are mentioned.

What is the LOB model?

Order book is the written record of all actual buy and sell orders for a trading pair within the exchange. Almost all centralized exchanges use this model.

For example, if XYZ is traded at $135 and you would like to buy 100 XYZ stocks at $130, you can add a limit buy (or "bid") order. Once you add it, it will go to the order book. If market price would then go down, and somebody sells 100 XYZ stocks at $130 (an "ask"), then your order will be matched, and the new price will be settled. Hence, by having bids and asks in the order book, also one checks the bid-ask spread. The bid-ask spread is the difference between the highest price a buyer will offer (the bid price) and the lowest price a seller will accept (the ask price).

Additionally, if you just want to buy at the best available price in the given order book, you can set a market order to buy at a market price for a quantity specified by you. But the price will be dependent on the number of open sell orders or concurrent market asks available at the particular time. Hence, market orders are classified as liquidity eaters. 

The more orders that are available in the order book, the more liquid the particular exchange is. Hence, through time, the ones that attract more traders have "deep" order books, which have much higher volume and liquidity. Additionally, it can offer to both buyers and sellers a best route to have the price with minimal impact.

One can pay either a fixed fee per transaction or a certain percentage per transaction executed, which is how most of the exchanges earn their revenue.

What is the AMM model? 

An automated market maker (AMM) model allows one to trade instantly depending on the amount of liquidity provided on the trading pair. In this model, your counterpart is the smart contract, which offers you the price per predefined algorithmic pricing. Let’s go into the details first to understand how it works. Imagine ser Bob has 1000 MELD tokens and 100 ADA coins. If hypothetically, 1 ADA = 10 MELD (or 1 MELD is 0.1 ADA), you can add this amount in increments to provide liquidity. It is important to note that liquidity is needed to be provided in both MELD and ADA, so trading between MELD-ADA pair is possible. Bob decides to add all his holdings to the pool to provide liquidity (LP), so we have 1000 MELD tokens and 100 ADA coins. The liquidity of the pools at the start is 1000 MELD and 100 ADA. Then, Alicia comes and wants to trade 20 ADA to MELD at the available price. So unlike in the LOB model, she will now interact with the smart contract to have her trade executed. But how is the price defined? 

Automated market-making means that prices are set according to a mathematical formula depending on the liquidity. The formula used is as follows:

In our example, x is MELD and y is Ada. 1000*100=k=100,000 and remember that k is constant. We had 100 ADA in our pool prior to the trade (Bob added), now Alicia brings additional 20. We need to know what it means for MELD price. In order to define the price for Alicia’s order, the following logic will be used:

The above formula says that we have 833.33 MELD left in our pools, meaning that 166.67 is taken by Alicia for 20 ADA. Hence, the effective price is:

Meaning that the above order of Alicia made MELD price jump from 0.1 ADA to 0.12 ADA.

This jump can be explained, since Alicia brought 20% of ADA to the pool, which is a significant amount. However, if the initial number of ADA-MELD pair were higher in the pool, the price impact of the order would be smaller. We can conclude that price impact is inversely proportional to the total liquidity. Hence, the more liquidity that is provided, the more stable the pool becomes. 

The difference of 0.02 (0.12-0.1) is known as the "slippage", which is the downside of the AMM model. Because as shown in the example, you never know the final price you will get at the end. However, in limit order book models, you know that your order will only be filled at the predefined price by you. Hence, slippage is not the issue in order book models. Worth noting that liquidity providers also get some amount fees in AMM (the incentive mechanism to provide liquidity), which is not mentioned in this example explicitly for the sake of simplicity.

For the liquidity providers, if the price of your deposited assets changes compared to when you deposited them, then you suffer from Impermanent Loss (IL). Impermanent loss happens no matter which direction the price changes. However, it is not realized until you withdraw your LPs from the pool. And it can be possible that through time, the ratio is restored, and you do not suffer from the IL - that’s why it is called impermanent. 

Additionally, the launch of Uniswap V3 in mid-2021 brought up the concept of concentrated liquidity. Uniswap V3 allows liquidity providers to allocate their capital in specific price ranges for each trading pair. While the price of the pair remains at that range, the liquidity provider earns rewards proportionally to the amount of liquidity allocated and volume traded in that price interval. Also, considering the varying degrees of risk implied by underlying tokens, Uniswap V3 offers multiple fee tiers for liquidity providers.

Why then is the AMM model used so vastly in the crypto world?

At this point, it is clear that both models can be used in the crypto world. Until now, DEXs mostly used AMM models, since matching orders in a LOB model requires specific matching engines, which cannot be executed with the current speed and inherent limitation of a “shared mutable global state” on some blockchains. A shared mutable state means that if two or more parties can change the same data (variables, objects, etc.), and if their lifetimes overlap, then there is a risk of one party’s modifications preventing other parties from working correctly. Due to this inherent nature of the limitation, the AMM model became widely used in account-based blockchains. 

UTXO or unspent transaction outputs, first introduced by Bitcoin, are used in cryptocurrency transactions to track ownership. Cardano is benefiting from the same mechanism, however, by an extension to Bitcoin’s UTXO model that supports a substantially more expressive form of validation scripts, including scripts that implement general state machines and enforce invariants across entire transaction chains. Hence, the model is called "Extended UTXO". 

We can say that LOB model is more suitable to EUTXO-based protocols than the AMM model. However, it is worth noting that at the time of writing, scalability is an issue on the Cardano blockchain. Hence, matching bids and asks at the speed of centralized exchanges on the blockchain is not possible at the moment. Nevertheless, with the help of layer 2 solutions and others outlined in IOHK's 11 ways to scale Cardano in 2022, this issue can also be solved.

Hybridized versions of the AMM and LOB models are currently under development by some Cardano DEXs. This combination could eliminate loss due to slippage since orders can be only executed once the defined price is reached. Even further, an AMM-LOB hybrid model could be designed such that IL is no longer a factor of liquidity provision. 

Further shout out to DEXs on Cardano

MuesliSwap – Introduced in November 2021 was the first functioning exchange on the Cardano blockchain. Even though most of the community members, including me, were suspicious about their launch, they have been able to turn it down.

SundaeSwap - SundaeSwap is a decentralized exchange built for the Cardano blockchain. It allows participants of the blockchain to provide liquidity and create a market for others to exchange their native tokens. The launch in Jan 2022 was one of the expected events in the Cardano community. Even though the launch was bumpy, they have been able to manage expectations about the limitations very professionally.

Minswap - Minswap is a Decentralized Exchange (DEX), which enables permissionless trading of token pairs. For each swap, a fee is taken, which goes to the Liquidity Providers (LPs). Higher total value locked (TVL) on the Cardano blockchain is achieved by Minswap. Even though there was a vulnerability in smart contracts, responsible community members – WingRiders informed the team in time and no loss of funds was experienced.

WingRiders - This native and fast AMM decentralized exchange platform on Cardano went live recently. The project is powered by VacuumLabs, one of the most widely respected developers in the Cardano space.

Maladex - Proposing a revolutionary execution model based on the concept of programmable swaps, without any doubt, Maladex is one of the most exciting projects on Cardano. Their approach should completely eradicate impermanent loss, significantly increase capital efficiency, and is poised to render market making and price discovery much more efficient.

Genius Yield - Designed to address the complexity of navigating yield opportunities in DeFi, their mission is to democratize DeFi for everyone by providing best-in-class automated liquidity management, powered by AI.It is ought to be the first DeFi platform in the industry to combine a concentrated DEX with a liquidity management system.


The opinions shared within this article are those solely of the MELD Ambassador. Note that the content within should not be considered financial, legal, or tax advice. Neither the author nor MELD Labs PTE Ltd. are financial, legal or tax advisors. None of this content should be used to make any form of financial, tax, or legal decisions. Do your own research and consult professionals as needed for official policies, restrictions, and requirements in your jurisdiction.

If you believe in the MELD vision, want to support this initiative, and want to help promote the future of finance then we want you to join the MELD Ambassador Program!

Crypto Concepts 101

MELD with us.