Regulating HFT in India

The Securities and Exchange Board of India (SEBI) has set a cat among the HFT (High Frequency Trading) pigeons by proposing seven measures to curb the impact of HFT and improve “real liquidity” in the stock markets.

The big problem with HFT is that algorithms tend to cancel lots of orders – there might be a signal to place an order, and even before the market has digested that order, the order might get cancelled. This results in an illusion of liquidity, while the constant placing and removal of liquidity fucks with the minds of the other algorithms and market participants.

There has been a fair amount of research worldwide, and SEBI seems to have drawn from all of them to propose as many as seven measures – a minimum resting time between HFT orders, matching orders through frequent batch auctions rather than through the order book, introducing random delays (IEX style) for orders, randomising the order queue periodically, capping order-to-trade ratio, creating separate queues for orders from co-located servers (used by HFT algorithms) and review provision of the tick-by-tick data feed.

While the proposal seems sound and well researched (in fact, too well researched, picking up just about any proposal to regulate stock markets), the problem is that there are so many proposals, which are all pairwise mutually incompatible.

As the inimitable Matt Levine commented,

If you run batch auctions and introduce random delays and reshuffle the queue constantly, you are basically replacing your matching engine with a randomizer. You might as well just hold a lottery for who gets which stocks, instead of a market.

My opinion this is that SEBI shouldn’t mandate how each exchange should match its orders. Instead, SEBI should simply enable individual exchanges to regulate the markets in a way they see fit. So in my opinion, it is possible that all the above proposals go through (though I’m personally uncomfortable with some of them such as queue randomisation), but rather than mandating exchanges pick all of them, SEBI simply allows them to use zero or more of them.

This way, different stock exchanges in India can pick and choose their favoured form of regulation, and the market (and market participants) can decide which form of regulation they prefer. So you might have the Bombay Stock Exchange (BSE) going with order randomisation, while the National Stock Exchange (NSE) might use batch auctions. And individual participants might migrate to the platform of their choice.

The problem with this, of course, is that there are only two stock exchanges of note in India, and it is unclear if the depth in the Indian equities market will permit too many more. This might lead to limited competition between bad methods (the worst case scenario), leading to horrible market inefficiencies and the scaremongers’ pet threat of trading shifting to exchanges in Singapore or Dubai actually coming true!

The other problem with different exchanges having different mechanisms is that large institutions and banks might find it difficult to build systems that can trade accurately on all exchanges, and arbitrage opportunities across exchanges might exist for longer than they do now, leading to market inefficiency.

Then again, it’s interesting to see how a “let exchanges do what they want” approach might work. In the United States, there is a new exchange called the Intercontinental Exchange (IEX) that places “speed bumps” over incoming orders, thus reducing the advantage of HFTs. IEX started only recently, after major objections from incumbents who alleged they were making markets less fair.

With IEX having started, however, other exchanges are responding in their own ways to make the markets “fairer” to investors. NASDAQ, which had vehemently opposed IEX’s application, has now filed a proposal to reward orders by investors who wait for at least once second before cancelling them.

Surely, large institutions won’t like it if this proposal goes through, but this gives you a flavour of what competition can do! We’ll have to wait and see what SEBI does now.

Correlation hits finance again; Flash crash edition

So the curious case of the “flash crash” of 2010 is allegedly solved. A suspect has been named, and arrested. No it’s not one of the usual suspects. This is a guy named Navinder Singh Sarao, day-trading from his home near London. Yes, you saw that right. One guy caused the flash crash it seems. Read this excellent Matt Levine (wish I could write like him!!) piece on this.

Maybe it’s a biased sample that I follow on twitter, but the general discourse there is that this guy has probably been framed. Yes, he did “spoof”, that is, place orders on the markets without intending to execute them, and Levine explains in this post as to why that is a problem (not a very straightforward piece, this, but very insightful if you can “get it”). But in the earlier link you can see that Sarao actually switched off his (spoofing) algorithm before the flash crash happened. So it goes.

I had written glowingly about the “correlation term” in this post last week. But we had seen earlier that it was underestimation of correlation (between homeowners defaulting on mortgages) that led to the 2008 financial crisis. Based on my reading of the story so far, the flash crash was also caused due to some kind of correlation, but of a different kind – correlation between interacting algorithms. Or perhaps I should call this one “resonance”, since it was some kind of freaky frequency match that led to disastrous effects.

So as the more perceptive of you might already know, a large part of the volume of trading in most financial markets is now done by algorithms, without a human touch. On the upside, these result in highly efficient markets (sometimes too efficient, as Levine writes in this piece), and high price discovery. On the downside, this results in a large number of extremely dumb (for that is what algorithms are!) traders overcrowding the market, leading sometimes to extraordinarily dumb decisions by the market itself (like the flash crash). So high frequency trading is controversial, and there is this massive discourse that it is actually harmful to markets, liquidity be damned (Disclosure: I worked for a year at a high frequency trading hedge fund in India).

The thing with spoofing (placing orders and withdrawing them just before they can be executed, to move markets in a specific way) is that it doesn’t work on humans. At least not nowadays, given electronic markets and a high degree of algorithmic trading. The reason is that time scales don’t match – the time scale at which an order is placed, and then removed is much smaller than the time in which a human can react. And humans are usually intelligent enough to see through some of the more common spoofs.

In other words, spoofing is exclusively in place to trick “dumb” trading algorithms to move in a particular manner, which the spoofing algorithm spots and profits from. In other words, spoofing algorithms are some kind of “second degree algorithms” in that they try to profit by tricking other algorithms. And you have anti-spoofing algorithms that are in place to profit from snooping algorithms. And it is all pretty normal stuff.

So what caused that flash crash was a coming together of algorithms that shouldn’t have come together. A set of spoofs were designed to fool a particular class of algorithms, but instead ended up trapping another class of algorithms, which were possibly dumber and over-reacted to the spoof. This over-reaction triggered other algorithms which were possibly in place to detect quick market movements, and trade on the “momentum” to make a profit, and this led to a further drop in prices. And that triggered off a self-fulfilling thing among algorithms, and before the human overlords could react, the markets had crashed some 10%.

\

So the problem with algorithmic trading is that it creates dumb traders, and new traders are designed to take advantage of these dumb traders. Add a few more meta layers to this and you have more complexity than in a CDO Squared. As with most complex systems, such complexity is quite okay in normal times, as these multilayered algorithms usually cancel each other out and make each other more efficient. But once in a while, like on May 6th 2010, their frequencies resonate, and the system blows up.

Back when I was a HFT trader (that’s an AER redundancy), I was told that SEBI (the Securities and Exchange Board of India) mandated that our algorithms be “audited”, so that they are not malicious and don’t cause trouble. While I appreciate the principle behind the regulation, the problem is that most algorithms are harmless for the most parts, and by themselves, definitely harmless. It is only when they come together with other algorithms, and in very rare cases (like this one), that they create havoc, and a statutory audit can in no way pick this up.

The SEBI regulation is good in spirit but practically wholly useless!