admin

Understand Order Matching

Economy & Market


The article discusses the importance of an order book, and how trade orders are matched during Continous Trading Session (CTS) and Closing Auction Session (CAS), and the algorithm generally adopted by exchanges for determining the Indicative Equilibrium Price (IEP).


What is an order book?

An order book refers to a list of outstanding buy and sell orders for a financial instrument. An order to buy is called a "bid" while an order to sell is called an "ask". The list presents the number of shares being bid on or offered at each price point. These lists help improve market transparency to

  • provide market depth information (also called 'Level 2 data')
  • identify the market participants behind the buy and sell orders (some exchanges keep it anonymous)

Market Practice

In most of the trading systems, order books are usually presented as follows.

1. Top of the Book

The order book is separated into bid-book and ask-book, where bid orders are sorted in descending of price while ask orders are sorted ascendingly. The highest bid and the lowest ask are referred to "the top of the book". The difference between the highest bid and the lowest ask is called the "bid–ask spread".

orderbook1

2. Order Ledger

The order book is listed in a sorted price ledger, which can be ascending or descending. The longer the price ledger is, the more liquidity an instrument provides. It is also called "market depth".

orderbook2

3. Cummulative Order Book

For each of the bid and ask book, order size accumulates from the top of the book. In visual presentation, the cummulative area provides insights about market supply and demand. For example, if the area of the cummulative bid book is much larger than that of the ask book, it implies more demand in current market.

orderbook3

Order Types

Most exchanges/brokers support at least these 2 order types:

  • Market Order:
    • A market order will buy or sell a security immediately when market is open.
    • This type of order guarantees that the order will be executed, but does not guarantee the execution price.
    • A market order generally will execute at or near the current bid (for a sell order) or ask (for a buy order) price.
  • Limit Order:
    • A limit order allow matching only at the specified price.
    • The sell order input price cannot be made at a price below the best bid price, whereas the buy order input price cannot be made at a price above the best ask price.
    • Any outstanding limit order will be put in the price queue of the input price.
    • An order book is mainly contructed by Limit Orders

Order Matching in Continuous Trading Session (CTS)

Suppose the original order book of a particular stock is:

Price Volume Price Volume
Bid Ask
$30100,000$30.0580,000
$29.9590,000$30.170,000
$29.980,000$30.15160,000
$29.8560,000$30.250,000
$29.8180,000$30.2560,000
$29.7534,000$30.350,000
$29.7100,000$30.3540,000
$29.65150,000$30.445,000
$29.618,000$30.4525,000
$29.5536,000$30.570,000
$29.5200,000$30.5580,000
$29.45150,000$30.655,000
$29.450,000$30.6550,000
$29.3520,000$30.725,000

A trader submit a limit order to buy 500,000 shares at $30.50. Then, the executed trades would be:

  • 80,000@ 30.05
  • 70,000@ 30.10
  • 160,000@ 30.15
  • 50,000@ 30.20
  • 60,000@ 30.25
  • 50,000@ 30.30
  • 30,000@ 30.35

Also, the order book after execution becomes:

Price Volume Price Volume
Bid Ask
$30100,000$30.3510,000
$29.9590,000$30.445,000
$29.980,000$30.4525,000
$29.8560,000$30.570,000
$29.8180,000$30.5580,000
$29.7534,000$30.655,000
$29.7100,000$30.6550,000
$29.65150,000$30.725,000
$29.618,000$30.7520,000
$29.5536,000$30.870,000
$29.5200,000$30.8520,000
$29.45150,000$30.910,000
$29.450,000$30.9570,000
$29.3520,000$3115,000


Order Matching in Pre-opening Session and Closing Auction Session (CAS)

Before market opens (or right after market closes), traders can start input orders during the order input period. An Indicative Equilibrium Price (IEP) refers to the reference price for potential order matching during such periods. IEP does not necessarily exists if there is no cross book. If IEP exists, it is determined following these criterias:

  1. maximum of tradeable quantity
  2. minimum of normal order imbalance
  3. depending on order imbalance direction
  4. cloest to the last nominal price at the end of the continuous trading session

i. Maximum of Tradeable Quantity

Orders can be inputed during the Order Input Period. The order book closes at the commencement of Order Matching Period and traders will not able to input, modify or cancel any order. Suppose the order book at the commencement of order matching period shows:

Trader Input Time Quantity Price Price Quantity Input Time Trader
Bid Ask
I16:092000At-auctionAt-auction100016:08H
A16:0620024.0523.9540016:07D
B16:051000242460016:06E
C16:0140023.9524.0540016:03F
24.0540016:05G

The highest bid price of the buy at-auction limit orders is equal to or higher than the lowest ask price of the sell at-auction limit orders (i.e. the order book is crossed). IEP shall be one of the bid prices or ask prices at which the aggregate size of the trades is maximised.

Price Aggregate Bid Quantity Aggregate Ask Quantity Tradeable Quantity
24.05220028002200
24320020002000
23.95360014001400

Therefore, $24.05 is taken as final IEP and the following trades are concluded.

Trader on Bid Side Trade Quantity Trader on Ask Side
I1,000@$24.05H
I400@$24.05D
I600@$24.05E
A200@$24.05F

ii. Minimum of Normal Order Imbalance

Suppose the order book at the commencement of order matching period shows:

Trader Input Time Quantity Price Price Quantity Input Time Trader
Bid Ask
A16:0750003.22At-auction2000016:09E
B16:0450003.213.19500016:06F
C16:02150003.23.2500016:04G
D16:02100003.193.21500016:05H
00:003.221000016:01I

Price Aggregate Bid Quantity Aggregate Ask Quantity Tradeable Quantity Normal Order Imbalance
3.22500045000500040000
3.2110000350001000025000
3.22500030000250005000
3.1935000250002500010000

This example has more than one price with the maximum tradeable quantity. The second criteria applied. Hence, $3.20 is taken as the IEP as it offers the maximum tradeable quantity and minimum order imbalance.


iii. Order Imbalance Direction

Suppose the order book at the commencement of order matching period shows:

Trader Input Time Quantity Price Price Quantity Input Time Trader
Bid Ask
A16:015000At-auctionAt-auction5000016:07F
B16:02150003.213.175500016:06G
C16:03150003.23.193500016:05H
D16:03200003.193.25000016:03I
E16:03100003.183.223500016:01J

Price Aggregate Bid Quantity Aggregate Ask Quantity Tradeable Quantity Normal Order Imbalance
3.212000019000020000170000
3.23500019000035000155000
3.19550001400005500085000
3.18650001050006500040000
3.17650001050006500040000

In this example, as there is more than one price which generates the maximum tradeable quantity and minimum order imbalance, the third criterion applied which looks at the direction of normal order imbalance at such prices. Since the normal order imbalance at both $3.18 and $3.17 is on the ask side, it means that there is a greater supply than demand. Hence, the algorithm will choose the lower price (ie $3.17) as the IEP.


iv. Closest to the last nominal price at the end of the CTS

Suppose the order book at the commencement of order matching period shows:

Trader Input Time Quantity Price Price Quantity Input Time Trader
Bid Ask
A16:095000At-auctionAt-auction1500016:03G
B16:0750003.223.172000016:06H
C16:07150003.213.18500016:05I
D16:03100003.23.19500016:01J
E16:0150003.193.21000016:01K
F16:0250003.183.21500016:04L

Price Aggregate Bid Quantity Aggregate Ask Quantity Tradeable Quantity Normal Order Imbalance
3.2210000600001000050000
3.2125000600002500035000
3.235000550003500020000
3.194000045000400005000
3.184500040000400005000
3.1745000350003500010000

In this example, there is still no conclusion following the criteria (i) to (iii). Hence, the algorithm continues to choose the price which is the closest to the last nominal price at the end of the continuous trading session.

$3.19 will be selected as the IEP if the last nominal price is equal to or higher than $3.19. On the other hand, if the last nominal price is less than or equal to $3.18, IEP will be $3.18.


Conclusion

After reading this article, you should have more understanding about how order matching works in exchanges. Analyzing the micro structures and changes in order book might provides useful insights about the short term trend. These trading strategies will be discussed in the coming posts!



 
Gupta
As a retail investor, I never thought about how exchanges perform order matching. 
It's quite interesting to know the mechanism behind!