# How to detect price anomalies in HFT?

Let's say I'm developing an HFT application and seeking arbitrage in futures markets between MAY contract(M) and JUNE contract(J).

In this strategy, my spread is J-M. I did not check with real data but I think this is a mean-reverting series... This spread should be around the interest rate, right? In some short periods of time, anomalies occur and the spread gets greater than the interest rate.

My question is, how can I detect these anomalies. Does it work:
|spread(t) - mean(spreads in 1 minute)| > stddev(spreads in 1 minute) ?

Is there a more robust solution?

• I'd suggest you start by getting the data and looking at it yourself. There are standard statistical tests you can use to check stationarity. For your formula - yes, it looks reasonable, but probably won't make you rich. – LazyCat May 7 '20 at 14:51

Many futures markets do not have stable intra-expiry relationships as they are related to the supply and demand dynamics of the underlying. It really depends on which contract. As LazyCat commented, get some data and test your hypothesis. I suspect that the answer will be, that there might be an arbitrage opportunity, but its so small, and the effort required to obtain it so large, that it isn't worth it. It's hardly an original idea.

• Well, professionals do make a decent living from arbing the roll market. I agree that this is probably not the ticket to riches for a newcomer, though. – Igor Rivin Nov 12 '20 at 4:18
• That is a fair point. Some people do indeed make money on roll markets. – ThatDataGuy Nov 16 '20 at 10:42

First of all, the futures contracts are kept in sync via the roll market. Traders put orders in for the roll to buy or sell it. That keeps the contracts in sync with each-other. So by being very, very fast, you will not find any small opportunities as the roll market forces the far contract to stay in-line.

So that eliminates the HFT angle.

Now the other side, thinking that you can arbitrage the spread. Now, the word arbitrage implies that you will buy and sell simultaneously. Obviously you aren't going to do that. Instead you are hoping that there's some sort of reversion to the process. But, this is a process driven by the real funding and inventory needs of the street. You will have a hard time finding pure cyclicality. You will very rarely see any futures spread that trades at the implied LIBOR rate! Instead you are seeing the supply and demand for financing the spot.