October 17, 2023

Invisible Hand Or AI Bot? Machine Learning's EMH Reality Check

Invisible Hand Or AI Bot? Machine Learning's EMH Reality Check

In theory, arbitrage opportunities don't exist because, in practice, traders jump in quickly to exploit them.

So, they do exist if you know where to look but they're often small and you need to be fast to make money from them consistently. As a trader your job is to build the algorithmic equivalent of Spiderman.

Here's an easy to understand example. No automation required.

How To Trade Funding Rate vs Realized Drift

Many traders new to quantitative methods think of the funding rate like the relative strength index (RSI) - negative means oversold, positive means overbought.

But in reality it's much more nuanced.

The funding rate on most exchanges is determined by taking the average difference between the perpetual futures price (or perp) and the spot asset price over [n] as a %, multiplied by n/24, where n is the number of hours per funding period. Sometimes plus a default rate but you get the picture.

What this means is that over 24 hours, traders with long or short positions have to pay their counterparties the cost of the average premium or discount of the contract. This ensures that the contract stays roughly aligned with its spot price.

But what this also means is that the funding rate functions as a quantitative measure of the market's expectations on price. At least it ought to.

If I'm long and the funding rate (a measure of the perp premium) averages 0.0001%/hour, I am betting the market will on average gain faster than that, otherwise I am negative.

Now we can extrapolate. If the average funding rate is 0.0001% an hour, at the beginning of every hour, we can say "the price should on average be 0.0001% higher in one hour".

Now draw a line between the hour's opening price and that price plus 0.0001%.

Realistically, the funding rate and its averages are often way out of line with what the market actually does, since it's a lagging indicator.

So how is this useful?

Well, think about what that relationship means. If the actual performance is not matching up with the funding rate cost, that eventually gets expensive and the losing side of the market should eventually be forced to start closing their positions. When they do, the funding rate and the average performance begin to converge.

By taking an average of the funding cost and an average of the market's performance over the same length of time we can tell when one gets ahead of the other.

If they are roughly equal, the market is balanced and unlikely to trend.

But if for example, longs are paying an average of 0.0001% an hour but gaining an average of 0.002%? That's 20x their cost, they've no reason to close! Shorts will though, and this will push the premium (aka the funding rate) up, until the market reaches equilibrium.

We can take advantage of this comparison between position cost and position return to see whether the perp market is properly positioned.

If it is not, it represents pent-up pressure that must eventually be reconciled with the underlying spot market, often dragging it along.

While funding rates on their own don't tell you everything, combining them with a look at how the market's actually been doing gives you a pretty good picture of not just where things are heading, but how strong the move might be.

There's a lot more you can do with funding rate analysis including stat arb and arbitraging the basis perp vs spot trade itself. Modelling the above trade and building a system around it is easy with the right tools and lets you experiment with different asymmetries over different time series.

Just experiment with your model before you put real money behind it and be aware that the market can be wrong for a lot longer than you can stay liquid!

Be Spiderman.