High Frequency Trading I: Introduction to Market Microstructure

High Frequency Trading I: Introduction to Market Microstructure

In this new article series Imanol Pérez, a PhD researcher in Mathematics at Oxford University, and an expert guest contributor to QuantStart delves into high-frequency trading and introduces the concept of market microstructure.

Nowadays, a significant number of financial instruments are traded in electronic markets, and alternatives that used to be popular in the past, such as open outcry stock exchanges, were replaced by faster and more reliable computers. In this article, we will describe the market microstructure of these electronic markets, which is key when it comes to understanding how High Frequency Trading works.

Types of orders in electronic markets

The objective of electronic markets is, essentially, to provide a—computer based—way to match people that are willing to sell some financial instrument, with people that are trying to buy it.

Although the reality is a bit different, this objective is accomplished via two type of orders: Market Orders, often abbreviated as MO, and Limit Orders, abbreviated as LO. The reason why reality is a bit different is that most electronic markets have more than these two types orders, but this simplification will be enough to illustrate how market microstructure works.

A market participant that places a limit order shows his or her desire to buy or sell up to a certain amount of a financial instrument, at a given specific price. For example, suppose that a participant places LO to buy up to 1000 shares of Apple at a price of 170 USD. The order will not be executed straight away: the participant will have to wait until some other participant is willing to sell Apple shares at that price. Moreover, even when the order is executed, it doesn't have to be fully executed. Say, for example, that some participant arrives at the market willing to sell Apple shares at the price specified by our original participant. However, the participant only wants to sell 100 shares. In this case, the limit order will be partially executed: 100 of the 1000 shares of the order will be bought from this new participant, and the LO will be reduced to 900 shares. The participant will have to wait until a new one comes willing to fill his order. However, the participant can also decide to cancel the LO he or she posted—something that happens frequently, since there are studies that show that most limit orders are cancelled.

Since limit orders are passive orders that are not executed immediately, we will therefore have a collection of limit orders—both buying LO and selling LO—at any given time, called the Limit Order Book (LOB).

On the other hand, we also have market orders. If a participant sends a market order—be it a buying or selling order—he or she wants to immediately trade a financial instrument. The price at which the order will be executed is the best price of all limit orders available. If the volume of the MO is large enough so that the limit orders that offer the best price are completely executed but the MO is not, the MO would then be executed at the next best available price in the limit order book. This action of going through each layer of the LOB until the MO is fully executed is called walking the book. Since in this case a portion of the order wasn't executed at the best available price, the urgent nature of the MO will have cost the participant money, since the average price at which he or she has bought or sold the financial instrument is worse than the best available price when the MO was sent.

This usually happens when the financial instrument is illiquid. If the number of limit orders for the asset is low—which is the case of illiquid instruments, such as rarely traded stocks—it will be more likely that a MO will have to walk the book in order to complete its execution. Very liquid assets, however, will probably have enough limit orders at the best price in order to fully execute MO of reasonable sizes.

Fig 1 - LOB of Hewlett-Packard's (HPQ) and FARO Technologies' stocks, after the 10,000th trade of the 1st of October of 2013[1]

For instance, take a look to Figure 1. It shows the Limit Order Book of two stocks—HPQ and FARO—at two given times. Both LOB correspond to the 10,000th trade of the day. Notice that, while the 10,000th trade of HPQ occured shortly after the market was opened, FARO's 10,000th trade didn't take place until just after noon, implying that HPQ is much more liquid than FARO. This is also reflected on the LOB. The volume on each level is much higher for HPQ than for FARO, which is in fact empty on many levels. It is clear that a MO sent to buy or sell HPQ shares will probably be filled without having to walk the book, while the volume available at the best price for FARO shares will probably not be enough to fill the complete market order.

Bibliographic Note

Since High Frequency Trading is relatively new, existing books on the topic are rather scarce, at least compared to books on other fields of investment theory or quantitative research. However, there are some really interesting and useful books that are worth reading. One of them is Algorithmic and High-Frequency Trading, by Álvaro Cartea, Sebastian Jaimungal and José Penalva. After discussing how market microstructure works, the book uses tools from stochastic analysis to tackle problems such as optimal liquidation or optimal acquisition problems in the high-frequency setting, where the challenge is to buy or sell a certain number of shares at the best possible price. The book also discusses some HFT strategies. It is a book I really recommend for the reader that wants to know more about the topic. In fact, some parts of this series of articles are influenced by this book.

A second book I would like to recommend is High Frequency Trading: A Practical Guide to Algorithmic Strategies and Trading Systems, by Irene Aldridge. It is oriented to HFT strategies, as well as appropriate ways of backtesting them and analysing their performance. It also has some very interesting insights about the HFT business and is worth taking a look.

Article Series