Breaking Down How Crypto Exchanges and Order Books Work

Written by Evan Francis, CEO & co-founder of Coygo Inc. which provides tooling for professional cryptocurrency trading and insights. A cryptocurrency advocate since 2010, Evan has years of experience working as a software engineer in fintech before leaving his corporate job to pursue a full-time venture in the cryptocurrency and digital asset space.


Cryptocurrency exchanges process hundreds of millions of dollars worth of trades every day for millions of traders across the world. Most of us know how to fund our accounts and place orders to buy or sell the assets that we want, but do you really know how exchanges and order books work? Having an understanding of the mechanics behind order books can be a useful tool for traders to quickly assess a market and see what other traders are doing and thinking.

So What Is an Order Book?

If you view a market on an exchange, most of the time you’re shown a candlestick chart, an order book table and a depth chart. Candlestick charts allow us to see past trading activity, whereas order books and depth charts let us see a glimpse into the future and the minds of other traders at that current point in time. See the screenshot below from the Coinbase Pro BTC-USD market view, with the order order book on the left highlighted.

exchange orderbook

The order book is a real-time list of all outstanding orders that have been placed by other traders but haven’t yet been filled. That means that for every entry in the order book, there is one or more other traders with an open order for that exact price and amount. On the top in red are all of the open asks, or prices that that other sellers are asking for, and below in green are all of the open bids, or prices that other buyers are bidding to buy at.

Because these are all open orders, they let us see the prices that other people think they can get their orders filled at. This gives us an idea of where the market might go in the near future and what prices other people are speculating that the asset might be worth.

Those other traders have locked their funds up in these orders, meaning that if they have a buy order for 0.1 BTC at a rate of $9,000, that trader has $900 dedicated to that order that can’t be traded or transferred elsewhere. They’re putting their money on the line, so you can be sure that they are likely confident that the price will move in the direction they’ve predicted.

What Happens When You Place an Order?

Now that we have a basic understanding of what an order book is, let’s go through an example of what happens when you place two different types of orders, a market order and a limit order.

Market Orders

A market order is a simple type of order that will be executed immediately at the current market price. This doesn’t allow you to speculate about any specific price, you’re just buying or selling immediately at whatever the best available price is. As soon as you submit the order your trade will occur.

So how does the exchange know how to give you the best available price? It does this by using the order book. Let’s use the following example of a BTC-USD order book.

table1.jpg

We can see that at this moment the lowest ask selling price by another trader is $8,900 (they’re looking to sell 1.5 BTC), and the highest bid buying price is $8,890. The last price, which is the price that the latest order on this market filled at recently, is $8,900. Let’s see what happens when we place a market order to buy 2 BTC.

The exchange is going to start at the ask order with the lowest price and fill that first, in order to ensure you get the best possible price. So you will buy all of the 1.5 BTC being sold for $8,900, but you placed an order for 2 BTC so there is still 0.5 BTC left in your order.

Since you filled the order for 1.5 at $8,900 (and some trader walked away with $13,350 given a price that they were happy to sell 1.5 BTC for), the exchange will now move on to the ask order with the next lowest price. Looking at the order book, we can see that is now the order selling 0.6 BTC at a rate of $8,950. Since you have 0.5 BTC left in your order, you will buy 0.5 of that 0.6 BTC, leaving 0.1 still open on the order book. Below is a demonstration of those orders by other traders that you will fill:

table 2.jpg

And here is what the order book will look like after your order is complete (although in the real world traders and trading bots are constantly submitting new orders, so the order book can potentially be updating tens or hundreds of times per second on an active market):

table 3.jpg

At this point we’ve purchased the 2 BTC that we wanted. We purchased 1.5 BTC at $8,900, and 0.5 BTC at $8,950, giving us a total cost of (8900 * 1.5) + (8950 * .5) which equals $17,825. If we average the two orders, we bought at an average rate of $8,912.50. The last price has now changed to $8,950 since that was the price of the latest order that you filled.

Limit Orders

A limit order is another type of order that is a bit more sophisticated than a market order. Unlike market orders, which just buy or sell at whatever the best possible rate is immediately, limit orders allow traders to specify a price that they want to buy or sell at, allowing them to speculate on what the price may be in the future. For example, a buying bid limit order for BTC at rate of $9,000 will only execute at a price of $9,000 or better (lower). In contrast, a selling ask limit order will for BTC at a rate of $9,100 will only execute at a price of $9,100 or better (higher).

Limit orders have their advantages and disadvantages. The advantage is that you get to specify the price you want. The disadvantages are that there’s no guarantee the order will ever be filled (if the price never reaches that point then it can’t ever be filled), that your money or coins will be locked up in this order (you won’t be able to use it for anything else), and that there’s no guarantee your entire order will be filled. You might have placed a limit order to buy 0.5 BTC, but only end up buying 0.3 BTC.

For this example we’ll use the same order book that we started with previously:

table 4.jpg

Say your order is to buy 1 BTC with a bid limit order at a price of $8,800. Since the current lowest ask selling price is $8,900 (which is above $8,800) your order will not be filled because the price hasn’t reached the level that you want. So your order will be inserted into the order book like below.

table 5.jpg

If the price does eventually reach $8,800 by other people filling the higher priced bid orders, for example if someone placed a market order to sell 4.5 BTC (0.5 + 1 + 3, the sizes of the open bid orders at prices higher than yours in the order book), then your order will now be the highest priced bid.

At that point, if someone were to place a market sell order your buy order for 1 BTC would be the first order that the exchange would fill. If that other trader’s market order were for less than your total order amount, say a market sell order for 0.4 BTC, your order would remain in the order book with 0.6 BTC left to be filled.

Gaining Insights by Analyzing Order Books

That was a lot of information but I hope you now have a better understanding of what’s going on behind the scenes at an exchange when you place an order. The above examples are simplified to demonstrate the high level concepts of what an exchange does, but they should provide you a basic enough comprehension to now be able to understand how we can gain some helpful insights by looking at an order book.

Depth Charts

A depth chart is a very common way to visualize an order book. Let’s look at this example, again from the Coinbase Pro BTC-USD market:

depth chart

This shows all of the open orders, bid buy orders are on the left in green and ask sell orders are on the right in red. The x-axis below the chart shows the price, and the y-axis on the left and right sides is the total cumulative number of BTC locked up in orders.

For each order (or price level if multiple orders exist at the same price) that is found in the order book, the depth chart adds that order’s amount (size) to the y-axis, increasing its height at that order’s price on the x-axis. So each increase in height that you see represents a single entry in the order book, meaning a larger increase in height means there is a larger amount in an order at that price.

If we hover over the bid portion of the chart at the 200 point on the y-axis, we see this:

This shows us that between the current last price of $9,020.10 and the price of $8,947.97, there are a number of different orders that in total contain ~200 BTC (the y-axis value at our cursor). It also shows us that in order to move the price down to $8,947.97 one would have to sell $1,991,329.63 worth of BTC, since that would fill every order between that and the last price.

hovering over depth chart

Buy Walls and Sell Walls

A more interesting example of a depth chart is when we see a buy wall or a sell wall. By searching through the markets on Coinbase Pro I was able to find an example of a buy wall on the XLM-EUR market, see the screenshot below:

In comparison to the BTC-USD depth chart we looked at previously, which had a fairly constant upwards slope on both sides, this chart shows sharp increases in height. On the left bid side we see a large vertical increase at €0.0540 on the x-axis.

That means that there is a significant amount of money tied up in open buy orders at the price of €0.0540, so once the price reaches that level it could potentially take dozens or hundreds of other traders placing sell orders at that price to completely fill that order and move the price past that order’s price level. These walls provide an indicator that this could be a potential area of resistance, as it will take a comparatively large amount of money to move past that price point in the order book.

buy walls and sell walls

Order Book Superiority

Another helpful tool for assessing an order book is order book superiority analysis, such as that available in the Coygo application. Below is an screenshot of Coygo’s order book superiority analysis for the same Coinbase Pro BTC-USD market:

img 5.jpg

In this example, order book superiority is analyzing all open orders in the order book within 5% of the last price. This is done to avoid outliers and provide an analysis of the orders that have potential to be relevant in the near future.

On the left we can see that all bids with a rate within 5% of the last price are shown to have a cumulative total amount of 907.1201 BTC, with 798 different entries in the order book, which is 60.82% of the total amount of all orders (bids and asks combined) within the price range. On the right, all asks with a rate within 5% of the last price add up to a total amount of 584.2782 BTC, with 1347 entries in the order book, which is 39.18% of the total amount of all orders within the price range.

In the center we see that the total amount of BTC in all bids and asks combined is 1,491.3984 BTC, which is equivalent to approximately $11,834,410.7533 given the current last price. Below that we see two horizontal bars representing the total amount of BTC locked up in bid orders in the green horizontal bar and ask orders in the red horizontal bar, and finally below that it shows that the order book superiority favors bids with a difference of 21.64% between the total cumulative amount of BTC locked up in bids compared to asks.

We can learn a number of things from this simplified visualization of the order book. The most obvious is that at this exact moment, traders are committing more money to buy orders than sell orders. This can show us that there may be more sentiment by traders thinking the price might go down to a lower price since they’re hoping to buy, but it can also be deceiving as perhaps only one very wealthy trader placed a larger sized order. That appears to be the case in this example, if we look at the number of entries we see that although there is 21.64% more BTC locked up in bids than asks, the total number of bid order book entries is much smaller, 798 compared to 1347 for asks.

Combining the two tools above, depth charts and order book superiority analysis, can provide a very quick but detailed assessment of the current state of a market’s order book. This in turn can tell you where other traders think the price might be moving, how much money is being committed by other traders at certain price levels, where areas of resistance might exist, and even if a market is potentially being manipulated by a small number of very wealthy traders.

This has just been a basic introduction to how order books operate on cryptocurrency exchanges and how you can read and visualize them to gain insights that put you at an advantage over others who don’t have as good of an understanding of how markets work. Good luck trading!

Featured image via Unsplash.