Market Microstructure 101: book edge

Let’s assume for a moment you possess a “fast” algorithm. Fast is in quotes because that definition depends to a certain degree on the market in which you are trading. For the sake of this example, assume you are one of the top three fastest firms in the market.

What is the simplest algorithm that could make you money in this scenario?

Intermarket arbitrage? Too many moving parts. Suppose I want something really stupid simple that will generate cash: it trades one product in one market.

Surely even blazing speed can’t squeeze blood from a stone? But that sort of thinking would be incorrect…

This next strategy goes by many names. A version has no doubt existed since the beginning of trading pits. We can assure you we did not invent this, nor did any of the firms we have worked for in the past that might lay claim to it. In its most general sense, this strategy illustrates a simple way to extract what market makers call book edge: or the edge you gain from leaving an order sitting in the book.

Let’s define the strategy for our strategy’s bid (the ask is a mirror image).

Quoting logic:

  1. Place a new order on the inside bid if the inside bid has greater than or equal to B contracts in total
  2. Modify your standing order to the inside bid – N ticks if the inside bid has less than B contracts in total

Trade management logic (what happens upon a fill):

  1. Is your fill price == the current bid?
    • YES: Place profit order at fill price + 1 tick
    • NO: Place exit order at fill price
  2.  Upon every update you receive, check whether: 1) is the inside bid the same as last time? AND 2) is the total number of contracts on the inside bid is greater than or equal to B_exit?
    1. YES: sit tight and wait
    2. NO: Modify your order down (i.e. sell into the bid, or pull order into new ask if bid has disappeared and repeat (2))

To understand how this can make money we must realize that each order in the book provides value in two distinct ways:

  • The first, and most intuitive, is the value it provides to the owner of the order
  • The second is the value it provides to other market participants

Your order in the book has value to you because you legitimately want to buy. Your order in the book also has value to my strategy because it acts like a “free” put option, capping the max loss for my strategy as long as it remains in the book.

Thus, if my order to buy gets filled ahead of your buy order, I can “lean” on your order. As long as you and enough other interested parties want to buy on the bid, I can safely place my order to sell on the inside ask and wait to get randomly filled (or not and just dump my position on the bid) then repeat the process over again. The strategy’s only true dangers are “sweeps” — orders that remove multiple levels from the order book at the same time — and latency. Sweeps can be minimized by avoiding specific times of day, or by including volatility filters which remove the strategy from the market under volatile conditions.

The lower your latency the more you can trust your market data and the smaller B and B_exit can be, all other factors remaining equal.

How can I maximize the chances of getting filled ahead of the pack? Again, this depends on the market, but in a FIFO market (first in first out) it is the relative age of your order that determines when the matching engine dispenses a fill. You may have noticed the line of logic:

  • Modify order to the inside bid – N ticks if inside bid has less than B contracts

This increases the book edge of my order, i.e. the probability that any given 1 lot trading into the bid will get dispensed to my strategy. If an inside bid gets knocked out of the book by a large order, my strategy’s order could become the best inside bid for an instant, exposing my bid to great fills ahead of newer orders on the bid.

In other markets the process is far simpler. Some markets have Pro-rata components: i.e. the bigger the size of your order relative to other orders the more fills your algorithm will receive from the matching engine. E.g. if your order is 100 and there are 900 contracts you will get 10% of the fills that execute against that bid. A lot of interest rate markets are like this (treasury roll contracts, short term interest rates, the two year US treasury…), as well as options, FX, and other markets that like to attract huge posted size.

You can think of this like an arms race: if you show more I have to show more and so does everyone else. In these types of markets you can see a 20-lot trade into the bid and see 20000 orders cancel from the bid. 20 is all anyone ever really wanted, but to get any fill you have to post big size. Sweeps get particularly disastrous in these markets.

Some equity markets have toyed with orders specifically that confer a higher probability of fill ahead of the pack. We are not talking about this kind of nonsense, but are referring instead to “legitimate” ways to extract value from the order book. By legitimate we mean its not just given away by a desperate exchange.

This is obviously a spectrum with many shades, as we’ve known of some major futures exchanges in the past which unwittingly conferred an advantage to algos which chopped up their orders into many parts (e.g. its better to show 100 1-lots than 1 100-lot) and other situations where such order trickery is endemic. We know impropriety when we see it but its hard to provide an all encompassing definition in this situation.

The main takeaway here is that this strategy, theoretically, creates an asymmetric payout structure: it has shifted the payout on the downside outcome to 0 (minus transaction costs) and the upside remains in tact. While this strategy only exists on its own in specific markets, you can bet your bottom dollar that versions of this logic are embedded in the majority of more complicated liquidity providing strategies in some form or another. Why would anyone not want free money, from a mathematical expectation perspective?

That being said, to describe strategies like this as “zero risk” obscures the true risk these strategies take. This type of strategy exhibits extreme tail risk; each day it must earn money from the market (rent) in order to pay for the occasional hurricane of sweeps or execution failure that will cost the firm dearly.

If used as part of another liquidity providing strategy, extracting book edge in this fashion can be a smart decision for the systems developer. If used on its own, strap on your safety belts and make sure you have logic for the times when a sweep + communication error with the exchange loads your strategy up with 5x its max position limit. As we have said before, if you trade all the time the probability of seeing a tail event is 1.0

Disclaimer: If you have to ask if you’re fast enough to implement this, you’re not. Please do your own due diligence. We are not responsible for the things you do at any speed.

Check out the Beta release of SliceMatrix:

a unique tool for visualizing the stock market, including views of filtered correlation networks and minimum spanning trees


Want to learn how to mine social data sources like Google Trends, StockTwits, Twitter, and Estimize? Make sure to download our book Intro to Social Data for Traders

Enter your email address to follow this blog and receive notifications of new posts by email.


Lead image licensed from Mark Fischer under CC BY-SA 2.0

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s