Saturday, April 5, 2014

Notes on Mark Cuban's "An Idiot's Guide to High Frequency Trading"


I read Mark Cuban's blog post the other day and was immediately struck by a couple things.  First, I appreciate his candor, and his invitation for commentary and corrections.  Second, he begins by clarifying that he is "going to be wrong in several ways."  Indeed, he is.  I wanted to provide some of my notes and thoughts on his post, and perhaps point some of his inaccuracies out.  

I suppose before I begin, I too have a disclaimer:  I have worked in the electronic trading industry as (mostly) a software engineer.  My experience has been at a small equity options trading firm; I have never worked at a high frequency trading firm.  I have performed several different jobs within the industry; at times I would classify myself as one of Mr. Cubans "algorithms writers." That's not all I did, but it was part of the job description[1]. I have worked at the firm for some time, but I am by no means the world's foremost expert in either electronic trading or high frequency trading.  The firm had a direct relationship with only one of the several derivatives exchanges in the US (so I don't have very much knowledge of the cost/incentive programs offered throughout the many exchanges); we were by no means "high frequency" or truly "low latency"--those firms collected their pennies from our traders, too, more often than not.

The section titles you see below are Mr. Cuban's, copy-pasted directly from his post at http://blogmaverick.com/2014/04/03/the-idiots-guide-to-high-frequency-trading/.  If you haven't read it, I would recommend it--especially before moving on. 


1.  Electronic trading is part of HFT, but not all electronic trading is high frequency trading.
Agreed, and this point is lost on a lot of people because it involves a fair bit of nuance.  As an aside, I often feel as if there is this perception that electronic trading is all done by artificial-intelligence-driven robots and that algorithmic trading cannot possibly have any human element whatsoever.  It's been my experience (in the equity options world, at least) that these black-box robots don't exist in most places, if at all substantially.  More often, small parts of the trading workflow are automated, or algorithms take care of the minutia on the trader's behalf.  Large positions are not meant to be acquired by artificial intelligence, but rather by traders' decisions.
The fact that there is a matching engine which runs on a server somewhere that everyone submits orders to is not a bad thing, it is in fact probably a good thing. Do you have any data to back up your attribution of the narrowing of the markets to the electronic age versus the high frequency trading phenomenon?  If not, I think it is a sensible enough bit of guesswork, but if you do I think you should share! 
2. Speed is not a problem.
You're right in that it doesn't create problems in the market, per say....but ultimately I think you're wrong.  More technical minutia:  there are two types of speed here.  The first is the amount of time it takes the exchange to go from receiving my order to filling it with available liquidity.  A decrease in this time is a good thing and seems harmless enough to me. I think this is the speed you are talking about.
The second kind of speed is trading speed. This is the typical time a share is held; as it decreases, the rate of the marketplace increases.  This contributes to the fragilization of the market and exposes us to more of the systematic risk you mention below.  Some of my thoughts on HFT and it's systematic risks can be found here.
3. There has always been a delta in speed of trading.
Agreed again.
4. So what has changed ? What is the problem?
Couple points here.  I think the main point you are making is valid:  the real issue is the time people are holding positions in major equities.  The marketplace has accelerated and as a result is more fragile.  Also, not all algorithms are so bad!  
However, I take a bit of an exception to your definition of a rigged market place. Just because someone is arbitraging something in the market doesn't make that market rigged.  Just because there is a way to continually arbitrage things in the market, doesn't make it rigged either.  For instance, I am sure there are somewhat similar instances in the equity options world--some instances of traders being able to execute several trades at once or in rapid succession to lock in a guaranteed profit...I would not call that rigging the game, just taking advantage of an opportunity you spotted. The fact that you can only spot that opportunity if you make (semi-insane) investments in technological and intellectual capital doesn't bother me, either.  Somebody is going to make an investment to take advantage of arbitragable scenarios, and those people are going to be professional traders, not everyday investors. 
Also, I don't know the exchange-by-exchange particulars here, but this notion of "jumping in front of the line" seems really flawed to me.  Do you have some reference material of an exchange which allows some orders to take precedent over others simply because those participants have a (pricey) appointment with the exchange?  It was always my understanding, and it has been my experience, that it is generally first come first serve for incoming orders, and any preferential treatment is given to quotes.  Preferential treatment of some market makers relative to other market makers doesn't seem to be too big of a deal if their preference applies only to quotes.  If they can all of a sudden take precedence in the order flow, then that seems a bit whacky.  I'd love to learn more.
6. Is this bad for individual investors?
a. Either the profit HFT makes will float back into wider spreads, or electronic traders will help fill the gap.  I would hazard that HFT does narrow spreads, thus the profit they are scalping off you may not be as big of a cost as one would think, but again, I don't have any data to back up that guess.
b. I think the blanket rule that HFT don't touch small stocks may be a bit flawed, too.  What do you mean by small?  Small daily volume?  small stock price? I am sure some HFT trades happen on smaller dollar stocks so long as volume is there. They may even happen on smaller volume stocks, too.  Who knows, it is all pretty opaque.
c. Given my understanding of HFT, it does not seem unethical to me.  There is a big externality to their activity in terms of systematic risks, though.  Those issues are not theirs to solve; they are up to us to solve.  
7.  Are There Systemic Risks That Result From All of This?
Agree with your conclusion, but I provide a slightly different look at where those systematic risks are coming from here.
8. So Why are some of the Big Banks and  Funds not screaming bloody murder? 
This analysis makes a lot of sense to me, but I have literally no experience at or with big banks, so I can't really provide much insight.
9. So My Conclusion? 
I completely agree: you can craft arguments which paint HFT as spread-narrowers, however this misses the point!  Maybe they narrow spreads, maybe they don't; in either case they are DEFINITELY fragilizing our capital markets via creating unquantifiable systematic risks.   







  1. As is often the case at smaller firms, I performed a bunch of different jobs at once.  I was mostly a software engineer, but I also wrote trading algorithms, option pricing mechanisms,  provided systems support, handled most of the technical communication with the exchanges, analyzed trade data, etc.

Thursday, April 3, 2014

HFT: Highly Fragilizing Trading

High Frequency Trading is a vastly complex topic, far too vast to discuss in detail in a couple hundred words.  However, it is also an important topic, so I will try to do it justice with the following brief synopsis.

First, about the whole "rigged"[1] business:  Other definitions of rigged aside, I don't think the presence of HFT trading has made the stock markets fraudulent.  If you submit an order to an exchange, and that exchange has the liquidity to fill that order at the price you entered, then the transaction will process as expected. If the misleading 60 Minutes piece[2] has confused you, see my previous post for a more accurate analogy.

However, when you realize that all of the HFT activity happens in a matter of nanoseconds[3], it does sounds REALLY fast.  But fast is good, right?  The typical argument is based on a typical Econ 101-esque line of thinking[4] and focuses on deterministic producer and consumer surpluses along with dead-weight loss. This technique is completely inadequate for this domain because it is entirely deterministic.  In reality, there is a GREAT deal of complexity, uncertainty, and non-linearity build into the trading systems.  As a result, the system itself is highly non-deterministic.  The Econ 101-type argument will focus on surpluses and losses which have a single value at worst, at best the argument will be hand-waved into an averages-based argument; e.g. "on average," "on expectation," or "in aggregate."  One small issue remains...in highly complex, non-linear systems, the expectation is not well defined mathematically. The best approach in such domains is not to try to reason about deterministic value or averages, but rather to look at the situation from the standpoint of fragility[5].

When viewed from this frame of reference, several things become clear.  First, HFT speeds up markets[6].  The faster a market moves, the more frequently bubbles form and the more frequently they burst by way of crashes.  Second, HFT consolidates liquidity provision into fewer sources.  Gone are the days of boutique market-making shops on Wall Street.  Instead, fewer larger institutions provide liquidity.  In extreme domains, the consolidation of the industry leads to more fragile systems because there exists less diversity amongst the herd.  The smaller and less diverse the herd, the more likely it is that a single unanticipated event can sink the entire industry.  Finally, by way of HFT competition, the liquidity provision system gets more and more complex by the day.  As systems get more complex, they become more highly non-linear, and in this case more fragile.  Small changes in circumstances can lead to big changes in outcomes.  Flash Crashes are a good illustrator of complexity fragilizing the market place. As seen in flash crashes, the feedback loops present in the algorithmic HFT system can be very damning.  Worse yet, they are entirely unpredictable and highly uncontrollable.

This fragilization of the capital markets by activities such as those HFT firms engage in is the real issue.  Exposure to limited upside (potential reduction in spread width) paired with unquantifiable potential losses is the very definition of fragility. By shifting to algorithmic HFT-based liquidity providers, we have exposed one of the central pillars of our economy to a great deal of unquantifiable, systematic risk.  Let's be clear: given today's highly-connected, complex global economy, this it is not risk for one person, or one HFT firm, or for one bank, or for one sector, or even for one economy, but rather a system-wide risk that affects us all.  Worse, so far as the aim of the capital markets is to facilitate the efficient provision of capital HFT makes no clear additions. As Mark Cuban pointed out on his interview with CNBC[7], this is the much more troubling issue with HFT. The market is not rigged, but the market is broken.  It hasn't fallen apart yet, but if we don't do something to fix the broken pillar now the next shock might just cause the whole thing to come crumbling down.






  1. Definition via Google search:  "rig" verb. past tense: rigged; past participle: rigged.
    1. manage or conduct (something) fraudulently so as to produce a result or situation that is advantageous to a particular person.
    2. cause an artificial rise or fall in prices in (a market, esp. the stock market) with a view to personal profit.
  2. "Is the U.S. stock market rigged?" http://www.cbsnews.com/news/is-the-us-stock-market-rigged/
  3. The light from your laptop screen, by comparison, takes a couple nanoseconds to get from your screen to your eyes.  The technology to accomplish these sort of latency-based arbitrages is astounding, and more and more of it is not software related, but rather being implemented by hardware itself by way of Field Programmable Gate Arrays (FPGAs).  To see how far some of the optimizations go, see http://dspace.mit.edu/openaccess-disseminate/1721.1/62859
  4. It goes something like this: these HFT titans use considerable capital and brainpower to narrow spreads in equities, lowering the cost for everyone to enter into and exit out of investment positions.  Markets are more liquid with HFT than they would be without!  Couple issues with that. First, as the 60 Minutes piece (and presumably the Flash Boys) demonstrates: there is a cost for that liquidity provision!  Pension funds spend hundreds of millions of dollars in the form of increased position entry/exit costs if they choose to subject themselves to poorly routed orders.  The alternative is not cheap either:  they can develop or buy order routing systems specifically designed to minimize their entry/exit costs.  Either way is more costly than if only those pesky HFT folks would just disappear...right?  Well...maybe.  Maybe not.  Presumably, being insanely fast gives them an advantage over your average joe investor, and as such they can narrow markets more than the average investor would.  As a result, when they leave, markets would be wider, and markets would be "less liquid"and that would be more expensive for investors than the cost of being latency arbitraged. Well....maybe.  Which effect is bigger is a matter of guesswork.  Also, thankfully and wonderfully, it doesn't matter!
  5. This idea is entirely Nassim Taleb's.  The markets lie squarely in 'Extremistan' (to borrow a term of his) and in such domains, the Law of Large Numbers no longer saves you. See Antifragile: Things that Gain from Disorder and Silent Risk
  6. The speed here is not necessarily how fast the matching engine runs, or how quickly new quotes are registered and published, but rather the rate of trade.  If anyone has data on time between trades and/or daily volume figures looking back pre-electronic and pre-high frequency trading, I would be very interested to see. 
  7. http://www.cnbc.com/id/101539820

A Better HFT Analogy

There has been much scuttlebutt over HFT in the wake of the 60 Minutes segment which aired this past Sunday.  With regard to the 60 Minutes segment, the particular analogy given by Mr. Katsuyama about StubHub was grossly misleading[1].  In the analogy, he states:
"The best analogy I think is that your family wants to go to a concert. You go onto StubHub, there's four tickets all next to each other for 20 bucks each. You put in an order to buy four tickets, 20 bucks each and it says, "You've bought two tickets at 20 bucks each." And you go back and those same two seats that are sitting there have now gone up to $25."[2]

The analogy is very alarming! What do you mean the price is one thing and then they can change it on you as soon as you go to buy the tickets!? The analogy is also sneakily close to being accurate, but it falls well short by leaving out a couple key pieces of information. In the analogy there is one exchange--StubHub--selling you all the tickets you need.  Imagine if there were not only StubHub but also several (nearly) identical exchanges, called TicketCity, and PassStation. In order to make the analogy accurate, there would have to be different exchanges selling those four tickets.  Enter TicketCity and PassStation. Furthermore, concert tickets are particular; shares of stock are not.  Each share of stock is just as good as the next, unlike concert tickets. If this were the stock market, then one exchange would not be selling all four tickets; you would also be happy with any four tickets, not a particular set of four.   For example, say that there is one ticket being sold on TicketCity, two tickets being sold on StubHub, and the final one ticket is being sold on PassStation. A more apt analogy:

Your family wants 4 generic passes to go to a music festival.  You see StubHub has two for $20, TicketCity has one for $20, and PassStation has one for $20.  You go onto StubHub and put in an order for two for $20 each and it says "you've bought two tickets at 20 bucks each." Now you go to look at PassStation and TicketCity, and they are now selling their tickets for $25.

In order to buy all four tickets, you could have two options.  One potential option is to send an order for four tickets to StubHub in New York; they will then sell you the two they have listed at $20 and forward the subsequent requests to TicketCity and PassStation on your behalf electronically.  The second is to manually send three unique orders yourself to StubHub, PassStation, and TicketCity by sending each an electronic signal one-by-one.  In either case, you are not guaranteed to get all four at the same price.  As soon as the signal is processed by the first exchange, say StubHub, they will update that it sold the tickets it had listed for $20.  That public listing is viewable by the sellers who are on PassStation and TicketCity, too. Generally, that is a good thing; it helps prevent people from giving "special deals" to their buddies.  Say that in the time it takes you or StubHub to send the next message, the sellers at that exchange see that someone bought 100% of the available tickets on StubHub for $20.  In that case, they might very well guess that there may be more tickets desired.  As a result, they can attempt to change the price for the one ticket they are selling on their exchange as a result of change in demand. If they can change their price to $25 before your order gets to their exchange and they were the only selller willing to sell the ticket for $20, then your order to buy a ticket from them at $20 will not be fulfilled[3].  You will instead have to try again to buy the ticket for $25.  This is neither criminal nor evil.  Furthermore, it does not sound rigged to me, it just sounds capitalistic.

Long story short:  the market is not rigged.  Well.  It might be, I don't know, but it is not rigged by the HFT trader trying to "front run" your order in the way they described.





  1. Disclaimer: I have not yet read the Flash Boys: A Wall Street Revolt by Michael Lewis yet, so I cannot speak to the book's accuracy, validity, or worth.  The notes here are merely comments on the segment 60 Minutes ran.
  2. "Is the U.S. stock market rigged?" http://www.cbsnews.com/news/is-the-us-stock-market-rigged/
  3. In reality the HFT firms can (and I would bet they do) go one step further.  If they have a high degree of certainty there is a large order for many more tickets en route, then they could buy all the tickets listed at $20 on the exchange, and then list the bunch of them at a higher offer price.  If they can do that before your buy order comes in, they can effectively buy low and sell high in no time flat and make a couple pennies per share in the process.  This more involved example is still a response to new information indicative of an increase in demand, and still doesn't seem rigged to me.