Will the following installations address the role of high frequency trading in flash crashes? Although high frequency trading seems like a very good strategy when arrayed against human opponents I have to wonder what happens when all the inputs and outputs are controlled by HFT algorithms trading against each other. How do you debug a HFT algorithm?
What caused the flash crash is a poor implementation of stop and market orders.
Essentially, the exchanges do not natively have a concept of "market orders" -- filling now. Instead, some brokers implement them by selling at a penny or buying at some enormous price, essentially hitting the bid or offer. Under normal circumstances this is not a problem, as the prices are reasonable. However, during periods of extreme dislocation, when traders pull out their limit orders, all that are left are stub quotes at a penny. And because those brokers used algos that would trade at a penny, those trades happened.
You debug an algorithm like you debug any other piece of software :) I "debug" by using a regression against a pure python implementation, which was implemented in the most obvious and correct way. I discussed it here: http://veyronb.wordpress.com/2011/11/02/prototyping-with-pyt...
How is the price of a stock market plummeting a "disaster"?
For those who own the stock it's of course not advantageous, to those who wish to buy it, it is.
I'd like the HFT traders to get into milk and apples. Maybe they can crash the price of these too so I can get some cheap groceries.
Testing/Debugging can be achieved by running your own mock exchange with historical or generated data.
Also, most exchanges provide a simulated environment where you can do fake trades and make/loose fake money.
as I understand it, the flash crash of may 2010 was by a bug in the algo that said "in order to allow the market to absorb a large order, simply divide it into X chunks and put them on the market one at a time". The bug was that this algorithm worked if your total shares T were small enough that T/X didn't affect the market. But on that day, T was so big that T/X still moved the market, and the algo didn't take that into consideration. You could protect against this by having sanity post-checks, but once something hits the market there's basically no CTRL-Z button.
One interesting thing about the flash crash was that the original "stock" wasn't a stock at all, but S&P e-minis, which are tied to a whole cross-section of stocks but are on an exchange that is mostly traded by pros. We have circuit-breakers now on individual stocks that halt trading if a single stock moves too much too fast, but that won't be effective if the whole index gets pushed down like it did that day.