Trading
Limit-Order Book
In this section we introduce the limit-order book, a central component of quantitative finance and common types of orders that the limit-order book receives. A solid understanding of the limit-order book and it's dynamics is crucial knowledge for the aspiring quantitative finance professional.
The markets discussed in the previous chapter can be traded either electronically, on an exchange, or off-exchange, in a chatroom or over the phone. While quant firms transact in both types of market, the majority of transactions happen in the former, and the principles are essentially the same.
On an exchange, market participants submit orders stating a side, quantity, and the worst price (called the limit price) that they are willing to transact at.
When the side is to buy, the order is called a bid, and the limit price corresponds to the maximum price.
When the side is to sell, the order is called an offer (or ask), and the limit price corresponds to the minimum price.
If the price of any bid is greater than or equal to the price of any offer, there is a match!
The above shows a limit-order book. This is what happens after several orders are submitted that cannot immediately match with each other. They are said to be resting, or passive. They are waiting for someone to submit a price better than their limit price to match against.
If we assume that market participants submitting limit orders are rational, they would only want to submit orders that would be profitable. To profit, bids must be lower than the fair price, and offers must be higher.
Hence, the limit-order book provides a consensus mechanism for the fair value of any security, since by computing the mid-price:
$$\text{mid-price} = \frac{\text{best bid} + \text{best ask}}{2}$$
We arrive at a price at which nobody is willing to submit bids or offers. Hence, we can infer that the mid-price is approximately equal to the fair price, as no market participant believes that trading close to it would yield a profit. In a competitive and efficient market, this provides price transparency.
Types of Orders
There are several types of orders one can send to an exchange. The limit order is the most straightforward of these. Another important order type is the market order. Market orders are orders to buy or sell a certain quantity of an asset immediately at the best available market price. Market orders do not guarantee a particular price, however an important advantage is that they are executed immediately. When a market order is received by the exchange, the best available limit orders are executed with the best price being executed first. If the market order quantity is larger than the depth of the best available limit-order, then the next available limit-orders are executed sequentially until the market-order is filled.
A stop-loss order is a type of order to buy or sell a specific asset once the asset reaches a certain price. A stop-loss is designed to limit a trader's loss on a position. It works by automatically triggering a sale if the price of the security falls to a certain level, helping to manage risk and protect investments. Once the asset reaches a certain price, the stop-loss order becomes a market order. So, a stop-loss order contains three pieces of information: the trade side (buy or sell), the price level at which the market order is activated, and the trade quantity.
An immediate-or-cancel (IOC) order is a type of order where all of part of the order is executed immediately at the best available price. Any portion of the order that cannot be executed immediately is cancelled. The trader specifies a worst acceptable price, which is the price level past which the order is cancelled. For a buy order, the trader specifies a maximum acceptable price, and likewise for a sell order, the trader specifies a minimum acceptable price. In this way, it is similar to a market order, but with a price threshold. This type of order is used by traders who prioritize speed and are looking to take advantage of short-term trading opportunities where immediate execution is crucial. IOC orders are particularly useful for arbitrage trading, which we will explore in depth in the next section.