An Introduction to Limit Order Books

41 minute read
Subscribe to the mailing list, or follow me on twitter!

banner

All the views expressed below are the personal views of the author, and are not financial or investment advice.

Throughout the time I have spent working in the finance industry, I’ve often been asked the question of how exactly trading works. While to those in the know this might seem obvious, I have found that quite frequently the concept of how order books and trading actually work, is not well understood.

In this article I want to go into the concept of Limit Order Books and their operation. Starting from the absolute basics, and later going into some of the more advanced features. In addition, I will try to define relevant terminology and shorthand where appropriate.

What Makes a Market?

In any functional market, there must be both buyers and sellers. Just as in any farmers market, in a stock (or any securities) market there are both the buyers (customers coming to buy) and sellers (the merchants in the stands) willing to make a trade (buy/sell produce) at a price that makes sense to them.

The purpose of exchanges is to pool all of this activity in one place, and efficiently facilitate two very important things:

  1. Liquidity
  2. Price Discovery

Liquidity is defined as:

The ease with which an asset, or security, can be converted into ready cash without affecting its market price.

This can be visualised in real life by looking at the recent PlayStation 5 shortage and the consequences on the price. Since there is a very limited supply of PS5’s (low liquidity) the more people that buy, the more the price starts to go up. Indeed, the very fact that there were so few available, caused scalpers to take already bought playstations, and offer to sell them again at an exorbitant price. Because there are not enough products to satisfy demand, any purchases will reduce the number available even further, meaning that the remaining products will become even more expensive to buy.

This example goes both ways, since liquidity can be viewed from the sellers perspective also. If you are a manufacturer making widgets and there are not many buyers in your market, you will quickly run out of buyers to buy your product. After that you will need to keep lowering your price just to attract more customers to buy your product. Liquidity can really be viewed as the ability of the market to absorb sales/purchases without the price moving drastically. Many exchanges in fact tout that they “have the most liquidity” in order to signal that trading there, will result in the best and most stable prices.

We will touch on this topic in more depth later in the context of order books, but suffice to say that from a trading perspective, the higher the liquidity, the better.

Price Discovery is defined as:

The process by which the spot price of an asset is set.

Going back to the market example. If you want to buy some tomatoes, you might go around each of the stalls asking how much their tomatoes cost. One important thing is making sure the tomatoes you are comparing are the same ones, for instance, cherry tomatoes are quite different to plum tomatoes, and comparing their prices doesn’t really make sense. In markets, if two products (such as two shares of the same company) are the same, they are said to be fungible.

Assuming you are comparing the same tomatoes, you can ask each stall how much they are charging. Assuming everything is the same (quantity, quality, etc) then it is logical to go and buy from the seller with the lowest price. The act of walking around and asking sellers for their prices can be considered to be price discovery. For the seller however, the task is a bit harder; there are way more customers than you can possibly ask, and you need to look after your stall after all! You will need to figure out what price to set. Set your price too low, and you will be taken advantage of, set it too high, and no-one will buy from you.

There are a few ways you could try and figure this out. Maybe you send your assistant out to pretend to be a customer, and see what the other sellers are charging? Maybe you ask customers coming to you what they are willing to pay? This information gap between the buyer and the seller is sometimes referred to as information asymmetry because one side has more information to make a good decision than the other.

What if there was a way to make all of this information available to everyone equally (both buyers and sellers)? With order books, this can be achieved in quite a simple way.

The Structure of a Limit Order Book

The fundamental purpose of an order book is to encapsulate all of the information required for both buyers and sellers to trade. With the arrival of crypto exchanges, more people are becoming familiar with what these books look like since in traditional markets most regular consumers would rarely see the full book.

A live orderbook (L2) from the BitMEX cryptocurrency derivatives exchange

A live orderbook (L2) from the BitMEX cryptocurrency derivatives exchange

For each stock or security in question, there will be one order book representing it. Each participant in the market can place multiple orders into the book. An order is simply an intention to trade with someone else. Each order will usually contain four things:

  1. side: Whether the order is to Buy or to Sell the security.
  2. quantity: The amount of the security you want to buy/sell. eg. 100 shares.
  3. limit price: The price at which you are willing to trade at. eg. $15. It is called a “limit” price because this is the highest price that you will buy at, and lowest price that you will sell at depending on the side of your order. Market orders do not require this.
  4. submission time: The time at which the order was submitted to the exchange. The user sending the order will not specify this, but the exchange will.

So for instance, a buyer might place a Buy order for 1000 shares of AAPL (Apple stock) at \$149. Likewise a seller may place a Sell order for 2000 shares of AAPL at \$150. Functionally this is the equivalent of a seller in the market stall shouting that they will sell a bunch of bananas for \$2, and a customer shouting back that they will only buy at \$1.50. It is a public advertisement of how much and at what price you are willing to trade at. Interestingly, while virtually all markets are now electronic, this open outcry method of trading is still in use in some exchanges.

An order book is simply a big list of all of these orders that have been submitted to the exchange, with some extra mechanics attached. A book consists of two sides. The Bid side contains all of the Buy orders that have been submitted, while the Ask or Offer (these names are often used interchangeably) side contains all of the sell orders that have been submitted.

Each book will typically set some constraints as to how orders can be placed. The tick size is the minimum price difference between price levels. That means that if the tick size is 0.5, you can send an order with a price of 100, 100.5, 101 etc, but you cannot send an order with a price of 100.2. The lot size is the minimum quantity difference that you can send for orders. Any quantity that you send must be a multiple of the lot size. That means that if the lot size is 100, you can send orders with a quantity of 100, 200, 300 etc, but you cannot send an order of 150.

Order books can be visualised in several ways but the most common are vertical (sometimes called ladder), and side-by-side. In a vertical view, the order book is sorted by price from highest at the top, to lowest at the bottom. This means that asks are at the top, and bids are at the bottom. In a side-by-side view, the bids and ask order lists are side by side, with the highest price for the bids at the top, and the lowest price for the asks at the top. In addition, the usual color convention is green for bids, and red for asks.

A vertical order book on Binance and a side-by-side order book on FTX

A vertical order book on Binance and a side-by-side order book on FTX

From now onwards we will use the side-by-side view for diagrams as this is easier to display on the web. The below diagram outlines the anatomy of the book as described. One difference to note, is that we will be displaying individual orders rather than price levels so that things are clearer. We will go into more detail on this in the section on market data.

The anatomy of an order book

The anatomy of an order book

For simplicity both our tick size and lot size will be 1. In the examples we will generally refer to the securities being traded as shares, since this is the security people are most familiar with. In practice there are many types of instruments/securities that are traded using order books.

Price/Time Priority

All orders in the book are sorted according to a concept called price/time priority. The reason for this is that when someone wants to trade, they want to quickly know who has the best price on offer. That is why the order book bids (buy orders) are sorted with the highest price on top (the highest price someone is willing to buy at) and the asks (sell orders) are sorted with the lowest price on top (the lowest price someone is willing to sell at).

Whichever order is at the top of the book is considered to be best. That means that the highest priced buy order and the lowest price sell order are called the best bid and best ask respectively. All of the orders at the best possible price are collectively referred to as the top of the book or TOB.

The top of the book is the level with the best price for both bids and asks

The top of the book is the level with the best price for both bids and asks

Orders in the book are always sorted by price, with better priced orders being nearer the top of the book. What happens however, if two orders are submitted with the same price? In this case, the book falls back to the second sorting condition which is the time when the order was submitted. Orders that were submitted earlier, will have higher priority than orders that were submitted later. The book below illustrates this concept.

Time priority ordering of orders with the same price

Time priority ordering of orders with the same price

We add the order ID column which uniquely identifies each order. On the bid side, orders A, B and C all have the same best price of $99. Their ordering amongst themselves is based on which order had the earlier time. Order D has a lower priority as even though it has an earlier submission time than all three, it has a lower price, and therefore lower priority in the bid queue. The time based priority is also sometimes referred to as queue priority due to the fact that the orders “queue up” on the price level.

In certain markets it is possible to get slightly modified priority rules. For instance, it is possible to get size priority as well, where orders with larger sizes have priority. One exchange - Investors Exchange (IEX) - even had broker priority where certain participants had a higher priority than others, though this was later changed. In general though, we will be focusing only on price and time priority, since this is the most ubiquitous system.

Order Book Operations

A basic order book will have 3 core actions that you can perform as a participant:

New Order

To place a new order you submit a new order instruction to the exchange. Depending on the type of order you are sending you might need to provide different parameters.

Cancel Order

On a real exchange, whenever you place a new order, you will get the Order ID of the order (NOTE: there are other ways of doing this). Sending a cancel instruction with the ID of a specific order will cancel that order, removing it from the book. Even if the order is partially filled the remaining quantity will be canceled, and removed.

Amend Order

If you want to change something about your order, you could cancel the existing order and place a new changed order in its place. This technique is called Cancel and Replace, and can be quite inefficient due to having to send multiple instructions. It can also lose you queue priority due to the new order having a later submission time than the original order. That means other people with the same price as you will now get filled first.

In order to avoid this, some exchanges provide the facility to amend an order. For our purposes we can only modify the price and the quantity, and different exchanges may treat the amending of different fields in different ways. For instance, on BitMEX amending an order’s quantity to be larger, will cause you to lose priority, while decreasing it leaves it as is.

Executing Trades

When an order is placed, it will always be in one of two states: passive or aggressive. All of the orders that we have seen so far have been passive orders. This means that at the limit price that they have, they do not cross with the other side of the book. What this means is that if they are a buy order, their limit price is not greater or equal than the best ask price, and if they are a sell order then their limit price is not lower or equal than the best bid price. A passive order will rest in the book at their limit price, on the correct side (bids for buys, asks for sells). Such orders are also sometimes called resting orders.

In all books there will be a gap in price between the best ask and the best bid price. The size of this gap is called the bid/ask spread or just the spread. If an order is submitted with a limit price that goes beyond the best price of the opposite side, that order is considered to have crossed the spread and therefore be aggressive. From the perspective of the order being submitted, the best bid/ask are often referred to by touch. The top of the book which is the same side as the order (eg. best bid if you are a buy order) is referred to as the near touch. The top of the book which is the opposite side of the order (eg. best ask if you are a buy order) is called the far touch.

Whenever there is an aggressive order, the result is one or more trades. A trade is a notification that an exchange has occurred between two parties. One party has bought, and another party has sold the same quantity of security at a set price. When your order trades, it is often referred to as getting filled or getting fills. In some terminology a trade is also sometimes called a match or a fill as you are matching your order against someone elses.

The general procedure for matching a limit order is to loop over the orders on the opposite side of the book, and at each passive order X assess the following:

  1. Is the price of X more or equally passive than our orders limit price?
  2. Do we still have quantity left to match on our order?

If both of those are true, then we trade against X for either its full quantity, or whatever quantity we have remaining on the order - whichever is smaller. If X is fully filled, it gets removed from the book. We keep doing this until any of the two conditions above is not satisfied.

Single Level Trade

Take the following book:

The best bid is \$99, and the best ask is $101 with a spread of \$2. Let’s say that we want to buy. We send a buy order with a quantity of 500, and a limit price of \$101. Because the best ask is \$101, we know that our order will be aggressive as it is equal to the best ask price. The quantity available from order B is 1,000 shares, which is enough to satisfy our order of 500. Therefore, we and the owner of order B trade. Our trade is for 500 shares at a price of \$101. After all of this, our book looks like so:

Notice that order B has its quantity reduced by 500 because we traded with it. Because it has some quantity remaining, it is called partially filled. Likewise, the trade feed shows one trade for 500 shares at a price of \$101. Note also that the side of the trade is Buy. What does this mean? In all trades there are actually two sides: one that bought, and one that sold the same quantity. However, in a trade feed that you see on most exchanges only one trade is printed. By convention the side of the trade is the side of the order that initiated the trade. In this case, it was a buy order that initiated the trade, and therefore the trade is marked as a buy, and highlighted in the traditional green.

A trade feed on BitMEX. Note the different coloring for the trades depending on their side. The arrows indicate whether the price moved up or down as a result of this trade.

A trade feed on BitMEX. Note the different coloring for the trades depending on their side. The arrows indicate whether the price moved up or down as a result of this trade.

Multiple Level Trade

Here’s a more complicated example. Let’s assume the book looks like this:

We want to sell a large quantity, 5,500 to be exact. We submit an order with a quantity of 5,500 and a limit price of \$97. The first order we encounter on the bid side is A with 2000 at \$99. That is not enough to satisfy our order however, but we trade anyway. A trade for 2000 at \$99 is created, and we remove order A as it has no quantity remaining. When an order is fully traded out, and has no quantity remaining it is called filled and is removed from the book.

We go down the list of orders, and the next order we encounter is B. We have 3,500 left to fill, but order B has only 3000. We trade with them, and create a trade for 3000 at \$98. Order B is also filled, and is removed. Finally, with 500 quantity remaining, we reach order C. Order C has 1000 quantity, which is enough to cover our 500. Just like in the first example, we trade creating a trade for 500 at \$97. After all of this our book and trade feed looks like this:

Orders A and B on the bid side have been fully filled and removed from the book. Order C has been partially filled, and has 500 quantity remaining. Our aggressive order has been fully filled (for 5,500). In this case however, our fill for our order came from multiple trades. Our original limit price was \$97, however we got some fills for a price that was better than the limit price we requested. This highlights the “limit” part of the limit price, since it is not possible for us to get any fill for a lower price than this. Often when this happens, we want to know what was our average fill price on the order. This is typically the volume weighted average price or VWAP of all of the fills we got. This is simply the price * the quantity of each trade, divided by the total we sold. In our case:

$$ AvgPx = \frac{(99 * 2000) + (98 * 3000) + (97 * 500)}{5500} = 98 $$

So overall we sold at a price that was \$1 better than what we set as our limit. Looking at the book, we see that due to the fact that orders A and B are gone, order C is now the best bid. Due to our trade, we have also widened the spread because before it was \$99 bid/\$101 ask (a \$2 spread) and now it is \$97 bid/\$101 ask (a \$4 gap).

Leaving a Remainder

Consider the below order book:

Let’s say we submit a buy order for 3,000 shares, with a limit price of \$102. Our limit price is above the best ask price of \$101, and therefore is aggressive. As before we match off against the orders in the opposite side (the asks). The first trade is against order B for 1400 at \$101. The second trade is against order C for 800 at \$102. Both B and C are fully filled, and are therefore removed from the book.

However having filled 1,400 + 800 = 2,200 out of an order quantity of 3,000, our aggressive order is now left with a remaining quantity of 800. After having filled the first two orders, the next order in the queue is D at a price of \$103. Remember however that the limit price of our order is \$102, and that means we cannot trade against orders that have a higher (worse) price than this.

Where does the remaining quantity (800) of the order go? Because it is a buy order with a remaining quantity greater than 0, we place it on the bid side. By definition, this order must be the top of the book, because its price already had to be aggressive, and there could be no other bids above us. Therefore, the new best bid increases from \$99 to \$102, since that is the limit price of our order. The bid/ask spread is now \$102 bid/\$103 ask. The book and the trade feed currently look like this (the order we just submitted has an ID of F):

Another important price that we can measure for the order book is the mid price. This is the theoretical price which is half way between the best bid and best ask.

$$ MidPrice = \frac{Bid_{best} + Ask_{best}}{2} $$

While it is not a price we can trade at, it does serve as a useful marker of where the market is since it is always right in the middle of our spread. The mid price of our initial book was $\frac{99 + 101}{2} = 100$. After the trade, our mid price is $\frac{102 + 103}{2} = 102.5$ Our trade has therefore shifted the spread up by \$2.5. We have also tightened the spread to \$1.

Trading Terminology

There are several terms that are useful / used when it comes to the action of trading in an order book. A few are defined here.

Basis Points
Basis points (bps) are a unit of measure for a percentage. 1% is equal to 100 basis points, so 0.01% is 1bps, and so on. Due to the relatively small changes that can occur inside order books, bps is often used as it makes writing out small percentages easier.
Hitting the Bid / Lifting the Ask
The act of submitting an aggressive order against the bid side (a sell order) is called to hit the bid. Conversely, submitting an aggressive order against the ask side (a buy order) is called to lift the ask/offer.
Volume
If you follow crypto, you will often see that the topic of who has the most volume? is a common one. volume refers to the amount of shares traded in a certain time period. It also sometimes interchangeably refers to the amount of monetary value traded.
Adding and Removing Liquidity
As mentioned before, orders can either be passive (don’t trade), and aggressive (do trade). For example, when you submit a buy order and it is aggressive, you will trade against the ask side. Doing this means that the amount of shares available on the ask side has decreased, and therefore an order doing this is is said to be removing liquidity or taking because you have taken some of the liquidity that was available on the ask.

In order for there to have been a trade, we must have traded against someone elses passive order for that quantity (we bought the shares from someone). Because this person was the one that “provided” the liquidity for our trade, that order is said to be adding liquidity or making.

Trading Fees

Most exchanges will make money by charging trading fees. The structure of these can vary quite a lot in complexity, with certain operators using a flat fee, others offering scaling fees, while others operate other mechanisms. Fundamentally though, exchanges can generate revenue by charging fees on trades that occur on the exchange.

Fees for FTX (top) and BitMEX (bottom) on 16th of July, 2021

Fees for FTX (top) and BitMEX (bottom) on 16th of July, 2021

Of importance are the terms Maker Fee and Taker Fee. As described in the section above, you take when you submit an aggressive order and trade, and you make when you provide a passive order which someone trades against. Once the trade completes, each participant pays/is paid their respective fee for the trade. Takers pay the taker fee, and the makers pay the maker fee. The fee quoted is usually quoted as a percentage (eg. 10bps, so 0.1%) and applies to the full value of the trade. So for instance, consider a trade for 100 Bitcoin on FTX at a price of \$34,000 at fee tier 1.

The value of the trade is 100 * \$34,000 = \$3.4M. The taker participant in the trade pays the taker fee (0.07% or 7bps of the value of the trade): 0.07% * \$3.4M = \$2,380. For the maker, the maker fee is slightly lower (0.02% or 2bps), meaning the maker pays \$680.

Taking a closer look at BitMEX’s fees, we can see that for certain products the maker fee is actually negative. This is called a maker rebate, and is essentially a fee that the exchange pays to the maker to reward them for providing liquidity. So if for the trade above the maker rebate was 0.025% (2.5bps), the maker would receive \$850 into their trading account.

Ultimately fees can have a big effect on the order book. One of the reasons for the popularity of maker rebate programs is that it encourages participants to provide passive orders (liquidity) so that they can benefit from the rebate.

Order Types

When submitting orders to the exchange there a several order types to choose from.

Limit Order

This is the order that we have been primarily discussing so far. The key feature of this order type is that you provide a limit price which is the worst price you are willing to trade at. When you trade you may get a slightly better price than your limit price, depending on the structure of the book.

Market Order

A market order is a special order type that does not require you to provide a limit price. It is an instruction to buy or sell a certain quantity of shares at any price available. Market orders are therefore by definition always aggressive. If a market Buy order is submitted to the exchange, the exchange will start matching against orders on the ask side of the book regardless of the price until the order is filled, or there is no more quantity remaining.

Sending market orders can be quite risky, because after you send it you have no control of what price you will match at, and this is an easy way novice traders can get caught out. Take the following example:

A casual observer might glance at the top of the book and think “\$101 sounds like a good price to buy, I’ll just send a market buy order”. They send a market buy order for 2000 shares, without taking a closer look at the book. Remember, a market order will keep matching until the order quantity is filled, irrespective of the price that liquidity is offered at. After matching, the book and trade feed will look like this:

Notice that while the first few trades were at reasonable prices, there really was not much liquidity near the top of the book (this is sometimes referred to as a thin book). Deeper in the book however there were other orders such as the deep \$120 order, and the extremely deep \$200 order. Our market order was obliged to trade against these orders, even though their prices were quite unfavourable. In fact, the average price of our order works out to be \$155! We went in thinking we would pay around \$101, but actually ended up paying \$54 more on average. This difference is referred to as slippage.

Because market orders can get a worse or better price that you were expecting, they can have both negative slippage and positive slippage. However they do have the advantage that they will always get you the trade that you want, though you have some risk with the price. Limit orders on the other hand can only have positive slippage compared to their limit price, since it is not possible for it to trade beyond that price. The downside however is that you may not get filled, since no opposite side orders may be within your limit price.

Stop Order

A stop order can be either a market or a limit order (sometimes called a stop and stop limit order respectively). When submitted, a stop order will not enter the book. Instead, it will wait around until a certain condition is met (usually some price being reached) and will only then activate. These orders are often used for risk management, and setting stop losses. Once a stop order is activated, it behaves in the exact same way as a normal market or limit order.

Time In Force

Time In Force or TIF is an additional instruction that can be provided on an order to specify how long you want your order to be active for, and under what conditions it remains active. Some common options are defined below.

Good Till Cancel (GTC)

This is usually the default TIF for most orders. In essence it means that your order will be active until it gets filled, or you decide to cancel it.

Day

Similar to GTC, except that at the end of the trading day these orders will be canceled. The definition of a “day” differs between exchanges, though usually it will be some set time every day (e.g. BitMEX uses 12:00UTC as the end of the trading day).

Immediate Or Cancel Order (IOC)

This instruction can be set on a limit order. If the order on arriving to the exchange ends up being passive not aggressive, the order will be immediately canceled. If the order is aggressive, then the order will be either fully or partially filled. Any remaining quantity left after matching will be canceled, and not left behind passively.

Fill Or Kill Order (FOK)

This instruction indicates that if the order cannot be fully filled in the current book, the order will be canceled. Essentially either you fill the entire order, or none of it is filled.

Post Only Orders

Certain exchanges allow users to set the post only flag on an order. Any order with this flag set, will not be allowed to be aggressive. A post only order submitted with a price that ends up being aggressive, will be immediately canceled. This feature can be useful for participants (such as market makers) who only wish to place passive orders (to post is another term meaning to place a passive order), and not run the risk of making an aggressive trade.

Market Makers

Just like sellers at a produce market, electronic markets have their version also. So called market makers are firms that engage in providing liquidity for the taker demand. Many participants simply wish to make a single order to buy or sell some stock, and only plan to trade once. They do not mind paying the taker fee, because they want to take action right away. Market makers step in to provide the other side of the trade. The goal of the market maker is to try and be there when a taker needs their liquidity, and thereby earn the maker rebate. Alternatively, they might try and constantly provide both a bid and an ask so that the market maker buys from some participants at a low price, and sells to others at a high price earning the spread on the difference between the bid and ask price.

Techniques for doing this could fill many books, but market makers generally want to sell as much as they are buying. If they buy/sell too much in one direction, they may end up holding a lot of shares. If the price of this share were to crash, the market maker would be left holding the bag, ie. they would now own a bunch of stock that they do not want. They would rather only earn the commission / spread buy buying and selling back and forth.

Order Book Market Data

For traders and market making firms, visibility of the book is very important in making trading decisions. Different exchanges will provide different data to participants. For order books, market data typically comes in three levels.

Level 1 (L1)

Level 1 data consists of only the top of the book. In the below image you can see that both the bid and the ask are present, as well as the quantity available at that price. For most people, this is the most detailed data that they will see, since it is sufficient to make a single small trade. This data is sometimes called quote data.

Level 1 data from Interactive Brokers for GBPUSD.

Level 1 data from Interactive Brokers for GBPUSD.

Level 2 (L2)

Level 2 data consists of an orderbook with more than just the top level. In this case we are provided a list of price levels, and the quantity of shares available on each one. Both bid and ask sides are provided up to some specific depth. Typically this will be 10-25 levels, with some exchanges offering the full book without this cap. This book is said to be aggregated because we don’t see the individual orders at the price level, just the total quantity. Depending on the quantity, there could be any number of orders at each price level. Outside of crypto, L2 market data is usually quite expensive to purchase, and often requires a good technology setup as the bandwidth required to stream this data real time can be high.

Level 2 data from Deribit for the BTC Perpetual contract.

Level 2 data from Deribit for the BTC Perpetual contract.

Level 3 (L3)

Level 3 data shows not only the price levels, but all of the individual orders in them as well. It gives you the full and most detailed view of the order book. In general this data would only be used by more technical quantitative trading firms, and market makers. Not always available for all markets, and somewhat rare even in the crypto space (as of the time of writing).

Depth of Liquidity

As you go down from the top of the book on either the bid or the ask side, you are said to be going deeper into the book. As such, the number of price levels you are from the top of the book is called the depth in the book.

Impact Prices

In the market order example we saw how placing a large market order into a thin book (not much liquidity) can cause you to get a bad price on your order. Bear in mind that whenever we place an order that fills through a price level and changes the best bid or best ask price, we cause what is known as price impact. As in, our order has impacted the current price of the security, due to the fact that we traded.

One metric that can be used to assess how deep (how much liquidity) the book is, is calculating impact prices. This is defined as what would the best bid/ask be for a market order of a certain quantity. For example, consider the following book:

Both the impact bid price and impact ask price are listed for different quantities. These are calculated by looking at the cumulative quantity as you go deeper in the book, and seeing what best bid/ask price would be left if a certain quantity were to be removed from the book. Note that the larger the quantity, the more price impact you will have.

Depth Visualisation

Quantity on the book is sometimes shown in the form of a depth chart which visually shows the cumulative quantity at each price level. The lines start from 0 at the mid price, and then go up in steps as liquidity from deeper price levels is added cumulatively. This can give a good idea of the liquidity conditions in the book at a glance.

A depth chart from BitMEX for the XBTUSD swap. Note how as we move outwards in the chart in price, each side gains more cumulative liquidity, thereby increasing the height of the line.

A depth chart from BitMEX for the XBTUSD swap. Note how as we move outwards in the chart in price, each side gains more cumulative liquidity, thereby increasing the height of the line.

Order Visibility

Some exchanges allow submission of special orders that have different visibility to normal orders. An order is visible when it can be seen by market participants in the market data, and hidden if it is not visible.

Hidden Order

A simple hidden order is an order which works the same way as a limit order, but is not visible to market participants. That means that anyone looking at eg. the L2 or L3 order book will not see a hidden order contribute to the quantity available at a price level. Other than not appearing in the order book view, the hidden order behaves exactly the same as any other limit order.

A book with hidden orders (marked with H). Note how in the L2 view, the hidden orders do not contribute to the visible liquidity

A book with hidden orders (marked with H). Note how in the L2 view, the hidden orders do not contribute to the visible liquidity

Certain market participants may use these orders if they don’t want their orders to be seen by others, and potentially give away what they are doing. Typically there is cost/downside to using such orders, which can vary between exchanges such as charging higher fees, or decreasing queue priority. For instance, on BitMEX hidden orders will always pay the taker fee even if they were the passive participant.

Iceberg Order

Imagine that you own 1 million shares in a stock, and need to sell them. The book for the stock shows that if you were to execute 1 million shares with a market order, the price impact would be very expensive. You could place a limit order for 1 million shares, but with the book showing that most price levels have 10k shares or so, you might be worried that placing a 1M sell order would make the market panic, and cause the price to move even more. In this case, just revealing that you have the intention of selling 1 million shares can cause participants to lower their bids, assuming that you are desperate, and will sell at a lower price!

What you want to do, is slowly sell your 1 million shares by placing small orders on the ask side (say 10k) and wait for them to be passively filled. When one of these orders is filled, you can place another 10k order, and keep doing this until you have sold the entire million. That way, your full 1M shares will blend in with the usual market activity, 10k at a time, over a longer time period. An iceberg order allows the participant to achieve this functionality without having the manually place and replace the smaller orders.

An iceberg order is a limit order which has an additional parameter called the display quantity. This quantity controls how much of the order is visible in the orderbook, while the remaining quantity remains hidden. The naming comes from the fact that with most real icebergs, the visible part above the water is only a small section of the full iceberg, which is mostly hidden below the water.

Iceberg image designed by Freepik

Iceberg image designed by Freepik

The detailed mechanics of how iceberg orders work vary between exchanges, and are out of scope for this article. In general though, participants can match against an iceberg order much the same way as any other limit order, and the visible quantity will decrease as expected. When the iceberg order trades against something that decreases its visible quantity below 0, it will refill its visible part from the remaining quantity hidden. Once this is all filled, the iceberg order is filled, and is removed.

The following book has an iceberg order (A) at the top of the book with a full quantity of 1,000 but a display quantity of 100. The total order quantity is shown as normal, while the visible quantity of the order is shown in brackets.

Let’s say we send an aggressive market sell order for 60 shares, and trade against order A. The book and trade feed now look like this:

The visible quantity is now 40, but order A still has 940 remaining. We now send another market sell order for 40 shares.

We trade again, and this time the visible part of the iceberg order is fully filled. Instead of the order being removed, the visible part of the order “refills” itself back to 100 (the display quantity). Also note that the time for the order has changed to the current time. This is because in most systems the act of refilling an iceberg order behaves similar to placing a new order, and therefore your priority is reset. The exact behaviour here however varies from exchange to exchange.

Auctions

In the crypto space, trading is 24/7, 365 days a year. Most exchanges essentially never have down time unless there is a specific issue, or routine maintenance is being carried out. In equities markets however, most exchanges operate broadly during working hours. In addition to this, there are often two or more trading sessions, with a lunch break in between. Outside of these times however, it is not possible to trade on the exchange.

Trading session schedule for the Hong Kong Exchange (HKEX)

Trading session schedule for the Hong Kong Exchange (HKEX)

One complication that arises from this is that the news cycle is 24 hours, and overnight there might be important information released about a stock. The price at which the trading day starts is called the open price while the price at which the market ends at is called the close price. Because of the overnight time difference, the previous days close price might not reflect what the participants feel that the new open price should be.

Participants wanting to trade in the morning face a difficult situation. The order book is empty since no orders have been placed yet. Just like in a negotiation, no-one wants to be first to state their price. If they place an order first, someone else might know more than they do, and possibly take advantage of their incorrect price. Many participants want to know what everyone else feels like the price should be, before they are comfortable making a trade. This problem repeats itself every time there is a pause in trading eg. for lunch, or overnight.

In order to fix this problem, many exchanges carry out an auction prior to the start of normal trading (called continuous trading). The auction period will usually be a short period of time at the start of the trading session (around 10-30 minutes, or so) where users are free to submit orders. These orders will go into the book, but with a special exception. During an auction, no trades are allowed, even if your order would be aggressive. This allows users to send orders without the risk of accidentally trading at a bad price. During the auction period, users can state their intentions by placing orders, and see how others are positioning themselves also. Amongst themselves, the participants will slowly start to fall into an equilibrium as to where the correct price is for the stock.

Because no matches are allowed, it is quite possible for the best bid to be greater or equal to the best ask. Such a situation is called a crossed book, and under any other circumstances would be considered a fault with the exchange or the order book. Take the following example book:

Notice that the book is crossed because the best ask is \$101, which is lower than the best bid which is \$105. As soon as the auction ends, no more orders are allowed to be sent, and the exchange has to find a way to “uncross” the book by trading everyone who has prices that are crossed. The rules for this vary from exchange to exchange, but broadly they try and choose a single open price that will maximise the total quantity traded.

In our case we can choose any price that is a multiple of our tick size (\$1) between and inclusive of \$101 and \$105 as an open price, since they are our best ask and best bid respectively. The exchange will look at each price available, and calculate how much quantity could be filled if each order could trade at that price. The table below outlines how much quantity would be traded if that price were chosen.

The optimal price and quantity that could be traded are referred to as the Indicative Equilibrium Price or IEP, and the Indicative Equilibrium Volume or IEV. These two values will typically be calculated continuously during the auction session, and published to participants so that they can get an idea of where the market will likely open. In our above example, we choose \$103 as the open price since it maximises traded volume. After the book uncrosses, the book and the trade feed will look like so:

Note that all of the trades occurred at the open price of \$103. In addition, the book that is left behind is now uncrossed (\$103 bid/\$107 ask) and is ready for further orders.

Glossary

Add Liquidity
Be the passive order in a trade.
Aggressive
An order whose limit price is beyond the best price of the opposite side of the book. Market orders are by definition aggressive.
Amend (an order)
Change something (quantity, price, etc) for an existing active order.
Ask Side
The side of the book where passive sell orders sit.
Auction
A special procedure at the start of a trading session where orders can be placed but not matched. At the end of the procedure, the system will match bids and asks together at the open price to uncross the book.
Average Fill Price
The average price per share an order achieved when all of the trades it did are taken into account.
Basis Points
A measure of percentages. 1 basis point (bps) is 0.01%.
Best Ask
The lowest price available from all of the passive sell orders.
Best Bid
The highest price available from all of the passive buy orders.
Bid Side
The side of the book where passive buy orders sit.
Bid/Ask Spread
The difference between the best ask and the best bid.
Cancel and Replace
A technique for changing your active order. The original order is canceled, and a new (changed) order takes its place.
Close Price
The price of the last trade in the trading day
Continuous Trading
The regular trading session where normal trading takes place.
Crossed Book
The situation where the best bid is greater or equal to the best ask. Only occurs during auctions, or if there is a fault with the exchange.
Crossing the Spread
To place an aggressive order and trade against the opposite side.
Depth
The distance in price levels from the top of the book.
Depth Chart
A way to visualise the cumulative liquidity at different book depths.
Display Quantity
The maximum quantity that an iceberg order will allow to be visible in the book at any one time.
Earning the Spread
When you have two passive orders both at the best bid and the best ask. If someone hits you bid and lifts your ask you have earned the spread from their trades, since the amount earned was the spread at the time.
Far Touch
The top of the book which is the opposite side as the order being submitted. Eg. the best ask if you are a buy order.
Filled
An order is filled when all of its quantity is traded out.
Fungible
Two assets that are the same and can be exchanged for each other.
Hidden Order
An order which is active in the book, but invisible to other participants.
Hit the Bid
Submit an aggressive sell order that trades against the best bid.
Iceberg Order
A special order type which only shows a small part of its total quantity. As it gets traded against, it will refill the visible quantity until it is fully traded out.
Indicative Equilibrium Price (IEP)
The estimated price at which the market will open during an auction.
Indicative Equilibrium Volume (IEV)
The estimated quantity that will be traded at the open during an auction.
Impact Ask Price
The price that will be the best ask if a certain quantity of shares is bought.
Impact Bid Price
The price that will be the best bid if a certain quantity of shares is sold.
Information Asymmetry
Where certain participants in a market have more market information than others.
Level 1 Data (L1)
Market data for only the top of the book. Also called quote.
Level 2 Data (L2)
Market data showing the total quantity at each price level in the order book.
Level 3 Data (L3)
Market data showing all of the price levels, and all of the individual orders at those price levels for an order book.
Lift the Ask/Offer
To submit an aggressive buy order that trades against the best ask.
Limit Order
An order with a Limit Price.
Limit Price
The worst price that a limit order will trade at against the other side.
Liquidity
A measure of how many shares can be sold or purchased without a significant effect on the price of that share. In the context of trading can also generally refer to amount of shares in an order book.
Lot Size
The multiple of which order quantity must be to go into the book.
Make
See Add Liquidity
Maker Fee
The fee paid by the participant that added liquidity.
Maker Rebate
A reward paid to the participant that added liquidity.
Market Maker
A participant (usually a firm) that tries to provide liquidity to traders and earn the spread / commission in the process.
Market Order
An order that has no limit price, and will keep matching against the opposite side until it is fully filled.
Match
To trade against another order.
Mid Price
A theoretical price half way between the best bid and the best ask.
Near Touch
The top of the book which is the same side as the order being submitted. Eg. the best bid if you are a buy order.
Offer
See Ask Price
Open Outcry
An older form of exchange trading where traders gather in a “pit” and yell out orders and make trades by voice and hand signals.
Open Price
The price at which a stock starts trading at for the day.
Order
An instruction to the exchange that you wish to buy or sell a certain security in a certain quantity and price. Submitted by market participants.
Order ID
A unique identifier that is used to identify a specific order.
Partially Filled
An order that has had some if its quantity traded out, but still has some quantity left.
Passive
A buy order below the best ask, or a sell order above the best bid.
Post
To post is to place a passive order.
Post Only
An instruction that can be set on an order that will immediately cancel the order if it is aggressive.
Price Discovery
The method by which market participants discover the best price for a security.
Price Impact
The change in price that can occur in a book if an aggressive order is sent.
Price Level
A price which is a multiple of the Tick Size in an order book.
Price/Time Priority
The system by which orders are ordered in a side of an order book.
Quantity
The number of shares an order wants to trade.
Queue Priority
The position an order has relative to other orders in the order book. See also Price/Time Priority.
Remove Liquidity
Being the aggressive order in a trade.
Resting Order
A passive order in the book.
Side
Buy or Sell.
Slippage
The difference in price between the expected price, and the actual achieved price for an order. Can be positive or negative. Especially relevant for Market Orders
Stop Order
A special type of order that is only activated once a specific price condition is reached.
Submission Time
The time when the order is submitted.
Take
To submit an aggressive order
Taker Fee
The fee that is paid by the person that was aggressive, and removed liquidity.
Tick Size
The minimum price change that is possible in the book.
Time In Force (TIF)
A special instruction that can be put on an order to adjust its behaviour and how long it will be active in the market.
Tighten the Spread
To reduce the distance between the best bid and best ask.
Top of the Book
The best bid and best ask.
Trade
To make an exchange of certain quantity securities/cash at a specific price.
Trading Session
A set period of time where auctions, continuous trading, etc can occur. Seen more often in traditional markets such as equities.
Visibility
If an order is visible of hidden.
Volume
The amount of shares traded in a given time period.
Volume Weighted Average Price (VWAP)
A method for calculating the average price of several trades based on their quantity.
Widen the Spread
To increase the gap between the best bid and best ask.

Subscribe to the mailing list: