High Frequency Market Taking

Photo by Austin Distel on Unsplash

The high frequency trading (HFT) industry has generally settled on three main types of trading strategies that are sustainable because they provide real economic values to the market:

A typical market taking strategy makes use of market microstructure signals extracted from order book states and trades in the recent past (e.g. a few ticks or a fews seconds) and issues buy or sell commands if the signals of interest are strong enough. As a price discovery process, such a strategy will need to determine a predicted price of the instrument for a given moment and compare this predicted price against the current available prices on the market (i.e. best bid and best ask). If there is a large enough discrepancy, the strategy will issue buy or sell commands accordingly. Let’s outline a particularly interesting and classical high frequency market taking strategy using a toy model. We have borrowed this model from Headlands Technologies LLC (a global quantitative trading company) with slight modifications for better clarity and better exposition. The idea behind it is that in crypto trading a lot of trading activities are driven by copy-trading due to an abundance of retail traders. Therefore we’d expect to see some trades having similar or even identical trades tailing them. For example, if you see one buy trade, it might be immediately followed by one or more buy trades with similar sizes. Assume at one moment T-1 our order book looks like this:

Sell 10 for $99.25

Sell 5 for $99.00 (best offer)

Buy 10 for $98.75 (best bid)

Buy 10 for $98.50

Then at moment T a sell trade for a quantity of 9 comes in and turns our order book into this:

Sell 10 for $99.25

Sell 5 for $99.00 (best offer)

Buy 1 for $98.75 (best bid)

Buy 10 for $98.50

The goal of our toy model is to calculate a “true” price at moment T and compare against the best bid/offer at moment T to see whether it is underpriced or overpriced. The argument is quite simple. Assume that another sell trade for a quantity of 9 will immediately come in (even though it hasn’t yet), the “true” order book should look like this:

Sell 10 for $99.25

Sell 5 for $99.00 (best offer)

Buy 2 for $98.50 (best bid)

The “true” weighted mid price (if you aren’t familiar with it, it is here) can be calculated as (99.00*2+98.50*5)/(2+5)=$98.64286. Notice that the observed best bid at this moment is:

Buy 1 for $98.75 (best bid)

Our theoretical “true” price is now below the observed best bid on the market. This means that in this toy model the instrument at time T is considered to be overpriced, therefore we will issue an order to sell the last remaining quantity of 1 at $98.75 for a theoretical profit of 98.75–98.64286=$0.10714!

Though the above analysis only constitutes a toy model, the general workflow for a real model will be more or less similar and boil down to determining whether an instrument is underpriced or overpriced enough. Once you have the model defined, it is fairly straightforward to code the market data streaming part and the order execution part using our lighting-fast C++ library: https://github.com/crypto-chassis/ccapi. For big fans of Python, the same library also provides a binding for it: https://github.com/crypto-chassis/ccapi/tree/v5.19.1#python. In addition, you can find a good amount of order book and trade data from our data archive for backtesting purposes: https://github.com/crypto-chassis/cryptochassis-data-api-docs. With all these tools in hand, we hope that creating and backtesting a high frequency market taking strategy is no longer a daunting task for you and we wish you best luck!

If you are interested in our work or collaborating with us, join us on Discord: https://discord.gg/b5EKcp9s8T 🎉 We specialize in market data collection, high speed trading system, infrastructure optimization, and proprietary market making. You’re welcome to hire us as engineers, liquidity providers, traders, or asset managers.

Disclaimer: This is an educational article rather than investment/financial advice.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store