What is CLOB? What Helps DYDX Lead the Perp DEX Industry

This article is machine translated
Show original

In the DeFi market, there are two most basic types of asset trading mechanisms: AMM-based and Order Book Book-based. From these two basic mechanisms, many different variations have been developed. In this article, we will learn about CLOB - Central Limit Order Book, a transaction matching model that early protocols like DYDX brought from the traditional financial world of TradFi into DeFi.

To have an overview of the content of the article, you can refer to the following articles:

What is Central Limit OrderBook?

The Central Limit Order Book can be called a centralized limit Order Book , a model for matching transaction orders between buyers and sellers in a market. This is the method used by almost all centralized exchanges in the crypto market and in TradFi.

CLOB is applied to both spot and Derivative transactions.

Structure of an Order Book

When traders want to buy or sell assets on the exchange, they must make a pending order (limit order). This order is recorded in the Order Book (OrderBook) including information about the bid or ask price, along with the buy or sell volume of the order.

An Order Book is a list that aggregates and lists buy and sell orders for the same asset. These orders are arranged sequentially according to price levels surrounding the current price of that asset. Below are a few illustrations of Order Book that are very familiar to CEX users or stock traders:

Cấu trúc của một sổ lệnh

With the Order Book model, the price of the traded asset will be the lowest offered price on the Orderbook. In other words, the current price of the asset is the Ask price, which is the lowest price at which people are willing to sell the asset to others on the market. Conversely, the highest price a trader is willing to pay to buy that asset is called the Bid price.

Usually, the Order Book will list sell orders in ascending order by price from the Ask Price, located at the top of the Order Book, and also list sell orders in descending order by price from the Bid price. , located in the lower half of the Order Book.

The difference between the Bid and Ask prices is called the Bid-Ask Spread , in fact it is often shortened to Spread . This difference always exists and it is beneficial to the exchange, directly bringing revenue to the exchange. With the BTCUSDT trading pair and parameters as shown above, an example can be given as follows:

  • If person A buys BTC with USDT on Crypto.com, this person will have to buy at the lowest price of 18,782.14 USDT per BTC. If that person wants to sell immediately, the selling price must be 18,782.14 USDT per BTC. That is an immediate loss of 0.01 USDT per BTC.

Spread can be considered a hidden fee that users are required to accept when trading on an exchange using OrderBook.

In addition, with the Order Book model, all matched transactions will be recorded in the transaction history, with information about matching time, matching price, and matching volume.

Order Matching System

Order Matching System, Matching System or Matching Engine are common names for order matching systems. Basically, the Order Book is a tool for arranging orders, and the matching engine is responsible for matching buy orders and sell orders together. An exchange that uses order books must also have a matching engine.

Matching engines differ in the algorithms they use to match sales transactions. The two most popular algorithms are FIFO and pro-rata .

Limit-stop/pending orders and market orders

The Order Book model allows traders to execute all types of orders, which are divided into two main types: pending orders and market orders .

A market order is very simply a trading order that will be executed immediately, at the lowest price in the market that has sufficient liquidation to match the requested volume.

For example: A person wants to buy 1 BTC with market order matching mode when the price of Bitcoin on the exchange is currently 18,000 USDT per BTC. This buy order will be matched with one or more other sell orders at the same price of 18,000 USDT per BTC, so that the volume of BTC on both sides buying and selling is equal.

On the other hand, a pending order is an order that must wait to be executed when the market price of the asset meets certain conditions. There are two types of pending orders: limit orders and stop orders . The meaning of these types of trading orders is as follows:

Lệnh limit-stop/lệnh chờ và lệnh thị trường
  • Buy limit order : Order to buy at a price lower than the market price of the asset. When the market price drops to the threshold required by the order, the order will be matched.
  • Sell ​​limit order : An order to sell at a price higher than the market price of the asset. When the market price increases to the exact threshold required by the order, the order will be matched.
  • Buy stop order : Order to buy at a price higher than the market price of the asset. When the market price increases to the exact threshold required by the order, the order will be matched.
  • Sell ​​stop order : An order to sell at a price lower than the market price of the asset. When the market price drops to the threshold required by the order, the order will be matched.

Above are the basic contents of CLOB. Exchanges can change the names of Order Book components or the names of trading order types, but they are all based on these basic foundations.

First DEX Order Book Built by DYDX

Versions V1 and V2 of DYDX are built on Ethereum . According to DYDX white paper 2017, at that time, DYDX provided two types of products: Margin Trading and Options.

At version V3, DYDX has transformed into a Layer 2 Validium of Ethereum, supported by StarkWare and only offering Perpetual trading products.

In all three initial releases, DYDX 's CLOB and matching engine were operated off-chain on servers operated by DYDX Trading Inc. and their other partners (namely Amazon Web Services - AWS) operate. That is, trading orders will be recorded in the off-chain Order Book , matched off-chain and managed by DYDX, while still being executed onchain. This is a trade-off between decentralization and protocol efficiency.

DYDX V4 hit mainnet at the end of October 2023 and has a big change when it moves to being a Layer 1 on Cosmos. In addition, version V4 will completely decentralize the Order Book and matching engine. This version was introduced by DYDX in 2022 and gave birth to a variation of CLOB called d-CLOB (Decentralized CLOB) or in some places called DLOB (Decentralized Limit OrderBook).

DEX Order Book Đầu Tiên Được Xây Dựng Bởi dYdX

When DYDX becomes Layer 1, validators will take on the Vai of operating the OrderBook. DYDX Trading Inc. will no longer have the right to participate in the process of monitoring and operating the Order Book. This is a big step forward in decentralizing DYDX's model.

CLOB With AMM

In the DeFi space, CLOB and AMM have always been the two extremes in the debate about which tool is more suitable to use for decentralized trading. CLOB is applicable to Spot Trading and Derivative transactions, while AMM only supports Spot Trading.

However, there are many projects that have also relied on the AMM principles of Uniswap V2 and Uniswap V3 to build Perp DEX products. You can learn about AMM in the article What is vAMM (Virtual AMM)? Overview of Virtual Automated Market Maker .

In fact, although CLOB can support Spot Trading , AMM DEXs are the dominant force in terms of Spot Trading in DeFi. This can come from many reasons, both in terms of user experience, economic model, decentralization, ... etc.

However, in terms of Perpetual Trading, CLOB is still the most popular (through the case of DYDX). Currently, DYDX is still the largest Perp DEX in terms of volume, while in terms of TVL, it is not larger than GMX. As for Perp DEXs operating on the vAMM (virtual AMM) model, they appear to be ineffective and do not attract users.

Currently the next biggest step that CLOB DEX/Perp DEX can take is to decentralize the operation of the Order Book. This forces these DEX/Perp DEX to follow the Application Specific-chain trend. In addition, Perp DEXs that use liquidation pools and are based on oracle prices likeGMX or vAMMs like Perpetual Protocol are still continuing to research and develop products.

Conclude

Above is an overview article about CLOB as well as new variations of this trading mechanism. The Perpetual Trading game on DeFi is not over yet and we will need to look forward to the next changes.

The post What is CLOB? What Helps DYDX Lead the Industry Perp DEX appeared first on HakResearch .

Source
Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
5
Add to Favorites
2
Comments