Finding hidden patterns in the Bitcoin order book

ChainSlayer
ChainSlayer
Published in
8 min readSep 7, 2020

Cryptocurrency markets are known for their high volatility and a lack of regulation. Because of this, institutional investors are still somewhat wary of investing into the market. In order for cryptocurrencies to succeed in the long term, investors need more clarity and transparency about the actual demand and value of these assets. Technical analysis of the available market data can provide us with interesting insights into the trading activity on cryptocurrency exchanges and can help us identify hidden patterns as well.

Processing the Order Book Data

Cryptocurrency exchanges are very similar to other financial markets. They use order books to keep track of the supply and demand of a particular asset. These order books are essentially a list of buy and sell orders, which are organized by price level. Order book manipulations, such as placing an order without an intention of ever executing it in order to drive the price in a certain direction, seem to be fairly common. Analysis of the order book data specifically is still mostly uncharted territory. As such, we thought it would be interesting to dive deeper into this data and see if we could identify certain patterns, which are not necessarily obvious at first glance.

Order books are continuously updated and they can be very large. As the order books contain information about potential trades yet to happen, the amount of activity is much higher in comparison to the actually executed trades. This makes it somewhat difficult to analyze every individual order. Additionally, most exchanges only allow users to request a limited amount of order book entries from their API.

Because of these challenges, we wanted to look for a method that could summarize the order book behavior at certain time intervals. Our chosen approach consists of collecting order book snapshots and analyzing the changes between two snapshots. We took a snapshot of the order book every 12 seconds. Changes between subsequent snapshots were captured using objects called order book events. There are three types of order book events, for both the Buy and Sell side:

  • Created Event: This event shows that there is a new entry in the order book at a new price level p with a volume v.
  • Deleted Event: This event shows that the volume v of the orders at a price level p has decreased. This could mean that an order has been executed or that it was removed by the user.
  • Updated Event: This event shows that the volume v of the orders at an existing price level p has increased. This could mean that an additional order has been placed at this price level or that a user increased the size of their order.

Consider the following (simplified) example of two subsequent order book snapshots:

Snapshot 1 contains two Buy order book entries (at prices 7000 and 7100) and one Sell order book entry at price 7150. Snapshot 2 shows that some of the entries have changed in the time period between the two snapshots. Comparing these two snapshots, the following order book events can be identified:

  1. Buy-Created event at price ’7130’ with volume ’30’
  2. Buy-Deleted event at price ‘7000’ with volume ‘50’
  3. Buy-Updated event at price ‘7100’ with volume ‘10’

Naturally, there are much more order book entries in a real order book snapshot. As such, there will be many different order book events at every time step as well. In order to summarize the behavior of these order book events at every time step, we decided to use several different statistics. Examples of statistics that we used are:

  • The total volume of the order book events
  • The maximum volume of the order book events
  • The average price of the order book events

Analysis of order book events

Plotting these statistics over time often results in interesting figures, which can potentially reveal hidden patterns in the order book. We pre-processed about 2 months worth of BTC-USDT order book data for the Bittrex exchange, which was collected between December 2019 and February 2020. We ended up with a data set containing 483,104 observations. Each observation corresponds to a unique time step and has 48 different features. Every feature is a different statistic. In other words, there are 48 statistics about the behavior of the order book events at time steps with ~12 second intervals.

We noticed strange behavior in some of the features. The most interesting feature was the maximum order event volume over time. The figure below shows this feature over the whole 2 month time period.

A number of distinct horizontal lines can be observed in this figure. This implies that order book entries with very similar volumes are created very frequently. The most notable example here is the (mostly) horizontal line around 15 BTC, which seems to slightly decrease in volume over time. In the first three weeks, we can see a horizontal line around 15 BTC. Around New Year’s Eve, this horizontal line is lowered to around 14 BTC and a few weeks later, the volume of this line decreases to around 13 BTC. Similar behaviour can be seen around 7.5 BTC and 5 BTC.

In a market with human trading activity, we would expect a much bigger range of values in this figure. Our first instinct was that this figure seems to point to activity from trading bots (placing orders of a specific value periodically) or perhaps even attempts from users to manipulate the price. We decided to look at more statistics to find out what was going on here.

Firstly, we wondered why the volume was often around ~15 BTC and ~7.5 BTC specifically and why it decreased over time. These numbers seemed a bit random, until we took the price into account as well. In December 2019, the average Bitcoin price was around $7000. Two months later, the price had increased to $9500. We suspected that there might be a link between the height of the price and the volume of these unnatural order events. Multiplying the maximum order event volume with the average price at the same time step results in an approximation of the value of these order book entries. This is shown in the figure below.

In this figure, the order book entries with the highest volumes have been translated to USD values. For the ~15 BTC orders, we see that the value was around $100,000 throughout the whole time period. Similarly for the ~7.5 BTC orders, the value was mostly around $50,000. Looking at 10+ BTC order events specifically, we get the following figure:

Based on the order book data alone, we cannot confirm whether these order book entries have actually been executed or whether they were deleted by the user. We also do not know how many different users were responsible for these order book entries. This makes it difficult to make any assumptions about why these orders were placed. Someone could be doing this with the intention of manipulating the price (e.g. spoofing), but there are other explanations as well.

We decided to look at a few more statistics. The next figure shows the total volume of the ‘Created’ order book events at every time step over the whole 2 month time period.

This figure is also very strange. It almost seems like two data sets with different distributions were merged in the same figure. We see how the total volume is either around ~20 BTC or below 10 BTC. The area in between the two regions is quite sparse. This implies that the ~15 BTC order events that we observed in the previous feature have a significant influence on the total volume as well. If we subtract the order book events with the highest volume from the total volume at the same time step, we get the following updated graph:

This adjusted total volume looks much more natural already and the data points around the ~20 BTC mark have pretty much been completely removed. If our suspicions about these maximum order events are correct, then this updated figure would be a lot closer to the actual volume of the exchange.

We thought it would be interesting to check how much of the total volume was determined by those maximum order events. The figure below shows what percentage of the total volume remains after subtracting the maximum order book events with a value of 10+ BTC.

We see that the adjusted total volume is (for the most part) only around 20% of the total volume. This implies that 80% of the total volume at these time steps indeed came from the maximum order events alone. In other words, whenever there were 10+ BTC max order events, those events had a huge effect on the total volume. This could give a false impression of the actual order book volume at this exchange.

Discussion

After pre-processing the order book data from the Bittrex exchange over a two month time period, we observed a number of notable patterns. When we look at the maximum order event volume over time, a number of clear horizontal lines can be observed (e.g. at ~15 BTC and ~7.5 BTC). These notable order book events had a value around $100,000 and $50,000 respectively. Order book events with a value of 5+ BTC occur relatively frequently, as about 6% of all time steps have an order book event with such a volume.

These large order book events seem to have a large influence on the total volume:

  • Total BuyCreate-volume for all time steps: 1,752,501.24 BTC
  • Total BuyCreate-volume for all time steps (without 5+ BTC events): 1,347,100.56 BTC
  • Difference of 405,400.68 BTC (23.13%)

Looking at all these figures, there seem to be some signs in the order book data of the Bittrex exchange that one or more people were attempting to manipulate the price. Additional research is required to determine whether these suspicious order book entries have actually been executed as well or whether they have been deleted by the user instead.

Overall, it seems like analyzing the order book data in depth can result in unique insights about the trading behaviour at a specific exchange. It will be interesting to see what the data looks like for other exchanges and also how different currency pairs compare. We have only scratched the surface of order book data analysis, so there is likely still a lot to be gained in this particular area of research.

This research was done by Olaf Kampers.

--

--