Low-latency Machine Learning Inference for High-Frequency Trading

November 7, 2023
Felix Winterstein

As discussed in the previous article, a robust method for short-term predictions of financial time series is of great value, and many companies in the electronic trading industry are using machine learning methods to achieve this goal. As trading strategies that support machine learning become more prevalent, the speed at which machine learning algorithms can make decisions is once again becoming one of the critical factors in differentiating oneself from the competition.

Quantifying latency is difficult in a general framework, as it varies by trading strategy, exchange, etc. Such information can be derived by examining the timestamps of trading messages as they arrive at the exchange. The advantage of analyzing message data instead of limit order book data is that races become visible: When multiple market participants compete for the same trade, one can see the timestamp of the fastest participant on the finish line as well as the timestamps of the slower participants whose trade attempt failed.

A study by Aquilina et al. using the method of analyzing trade message data found that:

  • Trade races occur frequently - about once per minute in the data observed by the study.
  • The time difference between the winner of a race (successful trade) and the first loser (failed attempt) is about 5-10 microseconds in this observed data.
  • The races are dominated by the top six trading firms, which participate in over 80% of all races.  

The analysis shows that 5 microseconds of delay can draw the line between a successful and unsuccessful trading strategy. Machine learning inference often takes up most of the latency of the trading loop. Thus, the above example shows the latency regime in which machine learning algorithms operate for high-speed trading.


Further articles you might like