Particle Physics Meets Economics
by Alberto Perro (CERN – LHCb Experiment)

As recently announced in CERN’s KT news, a new collaboration between the ROOT team, the Commodity Risk Management Expertise Center (CORMEC) and Wageningen University & Research (WUR) is investigating how to apply tools and expertise from particle physics to analyse data from commodity futures markets. The project is named HighLo (High Energy Physics Tools in Limit Order Book Analysis), and the goal is to combine EP’s knowledge in handling and analysing data with the finance expertise at CORMEC and WUR. Bringing these fields together may spark new ideas and provide unexpected insights. The long-term goal is to develop methods for detecting market anomalies that may eventually help regulators detect fraud.
The project will focus on commodity futures markets. Futures are contracts where parties agree to trade a good at a fixed price and delivery date in the future. They can be used to mitigate economic risks or to speculate on prices. Because futures trade on exchanges where traders and algorithms can see other parties’ buy and sell orders, some parties may post orders solely to manipulate a commodity’s price. One such strategy is called “spoofing” and was brought to court in 2019.
The HighLo project has access to an archive of messages from the Chicago Mercantile Exchange (CME), the largest exchange for commodity futures. Traders can subscribe to these messages to be notified about offers to buy or sell futures contracts, and when trades are executed (i.e., an offer is accepted). However, since the messages are text with a varying number of key-value pairs, they cannot be easily analysed programmatically. ROOT’s ability to store large amounts of structured data (but not necessarily identically structured—some values might appear multiple times or not at all) is ideal for such tasks.

Visualisation tool for order depths from a US patent application (US 2018/0260896 A1).
Towards data science in economics with ROOT
During an initial meeting at CERN, the teams developed a converter to create ROOT files from the text data. For one trading day of a single commodity, these computations can easily be run on a laptop, but processing a full year with all commodities would be challenging. Using CERN’s batch systems, it is easy to run an analysis developed for a single commodity on many others with a single command.
As an initial exploration of the data, the teams reconstructed a commodity order book from the messages. The order book indicates how many bids and asks (offers to buy or sell a commodity) have been posted to the exchange. It is a standard tool for traders, and the teams reconstructed it in ROOT both as a proof of concept and to validate the data. Plotting the order book revealed that ROOT provides several useful tools such as overlaying graphs, axes with configurable ticks, or adding additional information in a second plot (the equivalent of the “ratio plot” in HEP). A paper discussing the possibilities to visualise order books with ROOT is in preparation.
To answer more complicated questions such as:
“If a trade is executed, does the market react to it? (And on which time scale?)”
strategies known from particle physics analyses were used. The teams developed a small framework based on concepts such as:
- Filters that select which kind of messages are of interest.
- Actions that e.g. fill histograms or update data.
- Triggers that run actions when certain conditions apply.
This approach is similar to what ROOT now offers with RDataFrame—a simple, functional programming interface where the user defines what to do, and RDataFrame handles how it is done.
In the coming months, these techniques will allow the teams to implement more sophisticated algorithms, to study derived quantities calculated from the low-level data, and to derive descriptive features which can be used for machine learning. ROOT’s built-in machine learning tools and its interface to NumPy can be used as a starting point for training predictive algorithms and implementing anomaly detection.
Challenges when processing economics data with particle physics tools
An interesting challenge rarely encountered in particle physics is the fact that entries in the dataset have a strict time ordering. That is, in particle physics, all events are statistically independent, and their order does not matter. In finance, one has to “look into the past to understand the present”, because causality connects past with future market actions.
When computing time series, events have to be processed consecutively, and summary statistics such as running averages or the current state of the order book are updated continuously. Sometimes, data from past messages is needed, for example, when the state of the market right before a trigger event has to be analysed. The teams solved this by buffering a part of the data such that, e.g. an order book can be plotted for a short interval before and after the point where a trade happened.
Eventually, tools developed for time-series analysis during the HighLo project will be released in ROOT. The HighLO project will run for three years, and the first results are expected at the end of 2020.