Pages

Wednesday, January 5, 2011

High Frequency Trading

There’s a lot of FUD about high-frequency trading. After reviewing much documentation on it, and discussing the math with a PhD in Applied Mathematics from MIT who’s been working in cryptography and numerical analysis probably for longer than you’ve been alive, I have begun to understand how and why it works for those involved, and how it places an unfair advantage in the laps of those who participate.

First, the computer hardware requirements are really special. The exchanges charge huge fees for participation, as that hardware needs to be placed at or near to the Exchange’s servers such that the hardware may be connected directly to the Exchange’s GbE (Gigabit Ethernet) network. The servers running a company’s HFT algorithms must be physically placed on the GbE links provided at the exchanges because retransmission of packets through physical layer links takes time. Latency in information on a trade of milliseconds will cause the probability algorithms running on the servers to become unstable, causing significant errors in the calculations of the buy/sell orders, their values, the bid/ask information, and other pertinent information. So Cisco and others have developed special low-latency switches that permit scalability on this exchange-provided GbE network.

The second piece of latency is in the operating system running on the servers. In our opinion, the HFT servers do not run a standard operating system, rather they would be running either a proprietary OS or pieces of an available open source or purchasable source OS, perhaps like Linux, where the OS could be modified to eliminate latencies and packet forwarding delays. (packets forwarded to other layers of software in the servers). The servers would all be running in parallel, because running a standard network topology where packets are forwarded would be far too slow.

You and I can’t afford these switches, servers, and specially modified operating systems, and we can’t afford the fees charged by the exchanges to be co-located on the Exchanges’ GbE links. Therefore, the playing field is not level. It is even not level for firms that do not have the IT smarts to develop the low-latency scalable networks and have predictive calculators running which have the answers done before the data arrives.

Whether the playing field should be level should be the subject of another post.

Having answers before data arrives is .key in HFT. You’ve heard about multi-processor chips from Intel, well HFT servers are exactly that, multi-multi processors which run algorithms on data that hasn’t arrived, so as soon as the data does arrive, the server with the correct answer simply puts out it’s precalculated answer, and the buy/sell order that has been precalculated is put in place. The other servers are off calculating the next one before the data arrives from the trade just placed.

By doing this, and placing orders in quadrants around the previous orders, one can collect a kind of topographical map of orders placed/filled or placed/not filled, and by doing so, one can predict the probable volumes of shares that are available at various price points. The map is kind of like a sheet that you’ve shook out over your bed, where there are billows and valleys, where some parts of the sheet will hit the bed before others. Once you know the characteristics of the air under the sheet, you can predict which parts will hit the bed first, and more importantly, next.

Now here’s the next one that’s unfair to us traders. If there’s only one HFT trader on any one given stock, that HFT is guaranteed to make money. So there are algorithms that evaluate how fast the sheet billows on any given stock, and these algorithms can determine how many HFTs there are participating. If there are more than your algorithm wants, your algorithm simply moves off to another stock. Also, the algorithms develop signatures, and if one of your algorithms evaluates the sizes, buys sells, and other characteristics, you can tell which company you’re competing with. In fact, you can figure out who you must not compete with in order to make money. That’s why almost all, and I will hazard a guess that all, HFTs make money. They know the competition.

There are numerous advantages given to HFTs on any given exchange, set up by Exchange rules. Just how this is accomplished is not for public view, but there are reports of several things given to HFTs to theoretically assist the Exchange in doing it's business. For example, the human market makers are gone, so computers have to have supplies of shares of stock to complete transactions. If an HFT provides these shares, the Exchange is grateful and may give that HFT a kickback. However, providing these shares gives the HFT an advanced view of the orders as well, so they may be able to place orders to make more than just the kickback.

At this time, there are no rules nor regulators nor regulations by which HFTs are controlled. It is up to the Exchange to police their own environment. How well this is done is unknown.

28 comments:

  1. @Rock,

    Great post.

    We all know how self regulation has worked in the past, (Flash Crash, BP, Massey Coal, Sub Prime Mortgage companies) so I am sure that another disaster just won't happen.

    What could go wrong (this time)? We don't need no stinkin' regulators mucking up the free market for the capitalists. Bad for business!

    "At this time, there are no rules nor regulators nor regulations by which HFTs are controlled. It is up to the Exchange to police their own environment. How well this is done is unknown."

    In my opinion it is just a matter of time until another Flash Crash is allowed to happen because there are new sheeple to fleece in the markets.

    ReplyDelete
  2. Algos and day traders!

    BTE ADP number and the market sells off.

    ICan

    ReplyDelete
  3. @Dss:

    A good article about the flash crash can be read from the IEEE Spectrum
    http://spectrum.ieee.org/riskfactor/computing/it/flash-crash-cause-found
    which also provides a link to the official report.

    Often, in my comments, I have indicated "anybody with a big pocketbook can move this stock wherever he wants". This is exactly what happened with the E-Mini contracts: a huge investor unloaded a bunch of futures. It was not done by HFT, but was accomplished over a 20 minute time period.

    The thing that needs to be understood is that many probability algorithms use futures to base their calcuations. If the futures fall "out of bounds", an algorithm may become unstable. This is probably the cause of the flash crash, that is, a huge drop in the E-Minis (a future contract) caused HFT algorithms of one or more big boys to go unstable, executing orders in the direction of the E-Mini trend.

    If the huge investor had executed a huge buy, the market would likely have done exactly the same thing the other way.

    I don't believe the Flash Crash was "allowed" to happen, and I don't think it mattered whether there were new or old Sheeple in the way. I think it was a result of inadequate testing of the probability algorithms which are developed by mathematicians who have no real world experience.

    My friend is one of these. Mathematically, there probably are only 100 people in the world his equal, but when it comes to common sense, well, he has to have help to tie his shoelaces. Which is why I gave him a pair of Velcro flip-flops for Christmas.

    ReplyDelete
  4. "Fed may keep easing at 'full throttle' until decline in unemployment rate". http://noir.bloomberg.com

    So this should keep commodtities high. See new posts at Macro-man blog. Yesterday's regarding commods by Nemo(works for some IB in HK). According to him OIL Shouldn't be down blow $100 much longer.

    "World food prices surge to record, passing levels that sparked 2008 riots". http://noir.bloomberg.com/news/regions/india.html

    Australian floods are keeping Coal and Cotton hot despite U$D being green.

    ICan

    ReplyDelete
  5. Hold on, ICan. This is a test of your extreme desire to see the market fall!

    Don't fight the FED!!! We're still buying!!!

    As Mannwich said, the shorts are about to get messy.....I guess that's a smelly analogy.....

    ReplyDelete
  6. Good read, Rock. So much cool tech for such a mundane goal...

    ReplyDelete
  7. Just a comment on today's world:

    My watch was confiscated at Customs this trip, because a) it was deemed a counterfeit, and b) I didn't have my paperwork with me where I registered it with US Customs, so long ago.

    I've had the watch ever since my dad gave it to me, about 1985 or so.

    So I filled out the paperwork, came home and dug out the ancient US Customs form which had expired by now, and took that back to Customs.

    I got a watch back today. The one I gave them had "softened" over the years, edges were rounded, the engraving at the back had worn. The one I got was pristine. Sharp edges. Perfect crystal. The one I gave them kept perfect time, within 1 second per year, since 1985. The one I got back loses about 4 minutes every day.

    Sigh.

    If you travel, be sure you register your possessions, like cameras, phones, watches, Coach bags, etc, with your local customs organization and keep that paperwork with you.

    ReplyDelete
  8. @Rock,

    By saying "allowed to happen" I mean that because there is no regulations that force HFT institutions to make markets like the old specialist and market making systems, the regulators are saying "HFT make all the money you want pretending to provide liquidity, but you are under no obligation to do anything else".

    That is the real flaw in these electronic systems in that there are no market makers anymore, so it is inevitable that another flash crash will happen.

    Huge investors unload futures all the time so if this is really what triggered the Flash Crash we might as well all go hide in our bomb shelters as there is nothing to protect anyone from an unexpected meltdown.

    ReplyDelete
  9. Pimco's Bill Gross - Jan 2011 letter at Trader Mark's site -fundmymutualfund.com

    "Off With Our Heads".


    ICan

    ReplyDelete
  10. Great post, Rock. Interesting thought, emmy. So much thought and effort put into such a socially worthless activity as well. The culture that consists of the unbridled, unchecked, rabid pursuit of money as an ends now trickling down to the masses because they/we merely try to emulate what our "betters" are doing will be (and that is in progress) our undoing as a nation. The beat goes on.

    ReplyDelete
  11. Then there's this. Sigh. We won't ever truly learn until the disaster is truly on an epic scale. I'm beginning to wonder if outright collapse might be the preferred way at this point so that we can pick up the pieces and start anew. The slow motion drip, drip, drip is akin to torture.

    http://www.ritholtz.com/blog/2011/01/corporate-self-regulation-how-did-that-work-out/comment-page-1/#comment-481267

    ReplyDelete
  12. @Manny,

    Exactly the point I made earlier.

    ReplyDelete
  13. A fool, stock market, and Citigroup in India.


    Gurgeon, just outside of New Delhi is Nouveau riche town. Used be a small dusty town just 20 years until the likes of IBM and Microsoft moved in and the property prices soared to 10 Rs. million/acre plus.

    Citigroup is the country's largest foreign bank by assets and has 42 branches. Foreign banks account for about 7% of India's banking assets according to the Reserve Bank of India.

    High net worth indiviuals' wealth in India grew 53.8% annually according to the 2010 Asia-Pacific wealth Report by Capgamini and Merill Lynch Global wealth Management.

    20 high net worth individuals lost 300 crores(66 million U$D) investing in Nifty index of options and derivatives.

    Then they tried to sue their advisor and Citi bank's Pandit and India head. They filed an FIR at a local police station. I was following that story for a few days. Greed!


    Here is link to that story at bloomberg.com

    www.bloomberg.com/india-police-rules-out-Citigroup-s-pandit-local-head-from-fraud.html

    ICan

    ReplyDelete
  14. @Denise: An unbridled race to the "top" by the top, and lust for money for its own sake for the simple reason that they can. Everyone else just trying to keep from floating downward towards the bottom.

    ReplyDelete
  15. And forget about shorting this market. You will go broke. Right now anyway, but I'm guessing the turn downward, when (not if) it happens is going to be vicious and screw a lot of overconfident bulls as well who are thinking this Bernanke Put won't allow things to ever go down in a substantive way ever again.

    ReplyDelete
  16. Facebook looking a bit "frothy"?

    http://opinionator.blogs.nytimes.com/2011/01/04/friends-with-benefits/?hp

    Something tells me that will end badly as well.

    ReplyDelete
  17. Wow, my little F nibble looking mighty perky.

    ReplyDelete
  18. Rock – Thank you for taking the time to post that. I have read and followed HFT since I first heard about it. I have always known it gives an unfair advantage to the owner of HFT, just did not understand how big that advantage is.

    And although I work in the technology field, I have (and will not) not had the chance to work with much of the technology you laid out, but I have a decent understanding of how they work.

    For those of you who have watched the 1984 (or so) Mathew Brodrick film War Games, you will understand he was playing a game with the computer, the computer would input different scenarios and display the data, it would then use that displayed data to come up with two scenarios and display that data. Each time the data was computed the data would double and pretty soon the display was covered with a multitude of different scenarios.

    HFT is doing the same thing only 1000x faster and when a scenario plays out the HFT goes back to and “updates” the previous data. The HFT can not and does not predict the future, because it needs to know what has happened, but as soon and I mean AS SOON as it knows what happened it has an preconceived answer and that preconceived answer then sets off the next scenario, but at the same time goes back and updates the old scenarios, which will give it a better understanding of what might happen in the future.

    WOW- Unbelievable.

    There is an old saying “Never bring a knife to a gun fight” Well in the case of HFT “Never bring a spoon to a nuclear war”

    Thanks for sharing that Rock, I am truly amazed.

    Mangy Mutt.

    ReplyDelete
  19. Hi again everyone, just popping in real quick.

    Manny and Dan, read your posts from a cafe having breakfast today, AWESOME, both totally spot on.

    Dan, I hadn't thought of "the elite" in the terms you laid out but man, you hit the nail on the head. Depressing.

    It's all about Austerity here in the UK, all you hear on the news.

    Also, this CCTV thing is fascinating, cameras everywhere, there was a murder of some girl a few weeks ago and there are complaints that they have no one charged yet and people want to know why!

    They're tracking down ALL of the violent protesters from a couple months ago as well, especially the ones who tried to attack the prince of wales and Camilla, they've got shots of everyone and are specifically looking for one girl who hit the car the most - they've shown her face on several news programs we've seen and are asking people to report her. Not sure how I feel about that, on the one hand it's very "big brother" but on the other hand, people here don't seem to mind it at all.

    Have also noticed that most of the cigarette butts on the ground are hand rolled, apparently taxes on them are so high people just buy tobacco and roll their own because it's too expensive.

    Will be home on Friday. I think Denise is putting up one of my travel logs for tomorrow. Please remember that I write those very quickly, usually on the go, so they're not very polished and there are probably some stuff in there that won't make sense :-)

    Miss you all!

    J

    ReplyDelete
  20. Well, it looks like Barry and Peter are right on, C is about to hit 5.

    Now let's see if my guess of 5.25 hits.

    That was a 25% gain, BTW. I wish I had more shares, but I feel guilty when I buy thousands of something as big as C.

    And, F does look pretty good too.

    I wonder how the rest of the alphabet is faring. But not tonight.

    ReplyDelete
  21. @Rock,

    Citi - it has to stay above $5 for funds to be able to buy. Read somewhere that some funds are not allowed to buy shares under $5.


    ICan

    ReplyDelete
  22. ...i am currently reading "The Quants", if you find Rock's post interesting, you might find this a really good read,

    although it is not about HFT per say, and it is not particularly technical, it is very interesting to read about the mathematicians who came to WS and created these "money machines", these algos and the various trading strategies they employed...

    ...i'm just to the part where the algos are running off the rails - August 2007...

    Happy New Year, y'all!

    ReplyDelete
  23. Good to hear from you, Wes! Thanks for checking in. Hope all is well with you. I'll have my wife (who know has a Kindle) grab that one for me and put it on the list of books I need to eventually get to.

    ReplyDelete
  24. @Wes,

    I read the Quants and it was terrific. The book reveals so many interesting things about the hedge fund founders; they know each other very well, some have mentored others, some worked with each other and they socialize with a big poker game with high stakes once a year.

    Not to say that they are not competitive and secretive, but the notion that they are operating in dark isolation was proven wrong.

    Happy New Year Wes!

    ReplyDelete
  25. @Manny,

    It was about the best book I read last year so you might want to move it up on your list.

    ReplyDelete
  26. I will do that, Denise. Thanks for the tip!

    ReplyDelete
  27. Good post Rock but as someone who has written a fair few of these HFT algos I can tell you, you get a lot of the details wrong. Your matematician friend is not a computer engineer so he probably doesn't the real inside setup. You details on networking, OS and even the algos themselves nopt altogeter correct. But you have the general idea about unfair advantage right.

    ReplyDelete