Dust flux, Vostok ice core

Dust flux, Vostok ice core
Two dimensional phase space reconstruction of dust flux from the Vostok core over the period 186-4 ka using the time derivative method. Dust flux on the x-axis, rate of change is on the y-axis. From Gipp (2001).
Showing posts with label flash crash. Show all posts
Showing posts with label flash crash. Show all posts

Tuesday, August 9, 2011

Flash crash: business model or indicator?

After the series on deconstructing algos, a few things become clear:

1) HFT, by and large, does not increase liquidity. On the contrary, it works by reducing liquidity at key intervals (during periods of determined buying or selling), resulting in larger price moves than would otherwise be the case.

2) We can distinguish between the brief episodes when an algo clears out those pesky human bids from those when two algos are going toe-to-toe in a stat arb war, as well as those intervals when an algo is taking some hapless mutual or pension fund to the cleaners.

Examples below are accessible through here, except for the first one which was posted here.


Eliminating human bids before the fun begins--2 s.


Scalping the fund by removing liquidity in the face of determined buyingNote the sudden
 rapid rise in stock price while the fund buys, and the price returns to normal afterward.


Two algos slugging it out. Notice a lot of activity in the bid/ask but very few trades actually occur.


Two algos duel. Then, at 10:25, a committed buyer shows up for a scalping.


A committed seller experiences HFT (note the rapid decline in price).

The flash crashes occur because somebody needs to sell a quantity of shares. The algos "perceive" the orders coming to market and choke off liquidity, and the seller gets a poor price.

The flash "rises" occur because somebody needs to buy. In response to demand, the algos again remove liquidity.

In neither case is liquidity being offered when it is needed. In fact, the exact opposite is occurring. By systematically removing liquidity when it is needed most, HFT algos destabilize the system. This destabilization is merely a side effect--the algos increase the profits of the companies that operate them. But this is very much like the Enron method of doing business--shut down plants at a time of soaring electricity demand to line your own pockets while possibly bringing down the electrical network.

Days with a lot of flash crashes, as on Friday (August 5), are days where there is a lot of institutional selling. It is possible that the focussed withdrawal of liquidity by these service providers contributed to the rather steep decline of the indices on that day.

Friday, July 8, 2011

Deconstructing algos 3: Quote stuffing as a means of restoring arbitrageable latency

In a recent article Nanex has shown that quote stuffing can slow down the updating of series of stock prices, bids and asks. The article was less clear about why one might do that. There could be arbitraging opportunities.

One of the first games these clowns got into was latency arbitrage. HFTer offers a number of shares for sale at one price, and at the first sign of interest, pulls all of the offers and resubmits them at a higher price. The latency comes into play because as another player send his orders in to fill HFTer, and these orders all find their ways to the market via differing routes, each of which has a different latency (lag time)--so instead of all arriving at once, they arrive singly, giving HFTer time to pull the rest of his bids.

Early this year, Royal Bank of Canada (RBC) launched a new trading program called Thor, which was designed to avoid latency arbitrage. The gist of the program was that the system would monitor the various latencies to all the different exchanges to which orders would be routed, and artificially delayed the submission along the fastest route so that all the orders would arrive simultaneously on all exchanges. While perfection did not occur, the early claims were that the various latency would me measured in microseconds, which at the time seemed reasonable.

Presumably RBC is not the only player that has developed such software.

Now we hear that orders are being stuffed down different channels at such speeds as to change the latencies. In the Nanex article we see:
Today (June 28, 2011) between 10:35 and 11:17, algorithms running on multiple option exchanges (6 or more), drove excessively high quote rates for SPY options (and 2 or three other symbols that I haven't identified yet).  Fortunately this was a quiet trading period.  A total of about 400,000,000 excessive quotes were generated -- that is, compared and scaled to the previous day. In one 100ms period, 2,000 SPY option contracts had about 16,000 fluttering quotes (some combination of nominal changes in bid, bid size, ask, ask size) resulting in saturating/delaying all SPY options on that line. These events occurred several times per minute during the interval. If these algorithms include more symbols, or if they run again during an active market, we will see severe problems. It is shocking to see this so widely distributed across so many exchanges and contracts simultaneously.
I'm pretty sure this is not intended to be damaging to the market. The fact that it runs for short bursts on limited channels suggests that there is a particular target. A target like Thor.

Saturating the quotes on individual lines will change the time lags (latency factor) during the intervals the quotes are generated. For Thor to work properly, it has to estimate by observation the precise lag between sending an order and having it arrive on each market. Randomly changing the lags for the different lines would confound RBC's (and others) attempts at ensuring all its orders arrive on all markets at the same time.

The quote stuffing in this case is intended to be noise, and its intent is to give the latency arbitrageurs the upper hand, as it is easier to generate an immense amount of random noise than it is to formulate an anticipatory response to it in real (microsecond) time.

The only approach I can see (if this is possible) is some kind of all-or-nothing fill on your orders. So your orders arrive on the different markets at slightly different times, but they aren't triggered until they are all ready and then they trigger at the same time. Of course the arbitrageur is probably also the "market maker" and can see you trying to match up your orders prior to execution, leaving you up shit creek in any case.

I really can't see an argument for these actions providing liquidity.

Saturday, July 2, 2011

Deconstructing algos--reconstructing the system

Our market system is predicated on the assumption that all market participants have equal access to information. In the real world, this is not the case. As companies pursue their interests, discoveries are made, unusually large transactions occur, and participants in the companies in question acquire material information before many other market participants. The market has rules which are intended to prevent those with access to privileged information from being able to profit unfairly. Thus, the rules against trading on insider information.

Now, as has been demonstrated abundantly, it is clear that there are other entities with access to privileged information. This information has not arisen from the normal business activities of market participants--it has been deliberately created and vomited into the market through quote stuffing in order to overwhelm the system's ability to update market prices and to create many, many, many small arbitrage opportunities.

Very few market participants can carry out quote stuffing, or can create and cancel orders hundreds of times per second. The effect is to tip the playing field in favour of these large entities, and the law of large numbers ensures that profits flow towards them. To my mind this is something very different from trading on insider information.

There is a libertarian argument insider trading is victimless and should not be considered a crime. I admit to some sympathy towards this view as it seems to fit into a kind of justice--usually someone is doing something socially useful and this creates an opportunity to make additional profit.

For those who think that quote stuffing represents a form of natural justice (IFS Bank has invested in the technology and therefore deserves its ill-gotten profits at the expense of everyone else), I would like to point out the moral difference. The money made from quote stuffing is not part of a socially useful activity. The proper role for financing has always been to make money by attempting to create something that generates cash flow, whether it be a mine, a factory, or an apartment block. Carrying out thousands of transactions per second in order to scalp fractions of pennies each time does not create wealth--it transfers it towards the HF traders.

How do we regulate the market to return it to a semblance of normality? The current market rules did not envision the kinds of advantages that can arise through quote stuffing--consequently there is no mechanism for bringing its practitioners under control. What should be done?

Quote stuffing has to be ended. One method is to place a tax on each stuffed quote, and to remove the exemptions that certain market participants hold for Exchange cancellation fees. The fact that such exemptions exist guarantees that certain market participants will hold an advantage over other participants--something that is not consistent with a fair market.

As has also been pointed out--how can such changes occur when the regulators have been captured by the perpetrators?

Friday, June 10, 2011

Flash crash the nat gas!

As shown on posts on Zero Hedge, (correction, these are originally from Nanex) there have been some bizarre patterns in the trading of natural gas in the past couple of days. The charts below are from the evening of June 8, 2011 and come from the first of the two articles linked above:



At first glance this looks like nearly perfect chaos.


The last figure represents a one-dimensional projection of a Lorenz butterfly curve, shown in its glory below.


In reality the trading data isn't as nice as it first appears. There has been a bit of playing around with the time axis on the first two plots. I have subsequently digitized the data with trades at half-second intervals (but I'll outline the caveats below).


The axis on the bottom is time in seconds, starting from 19:40:37 on 08-Jun-11. The digitization is at half-second intervals, because the analysis below requires evenly spaced data. There were some difficulties, however. There was not always a trade right on the half- or full-second mark. Frequently the two nearest trades on either side of the desired time interval were at the same price so that it would be reasonable to use that price. Sometimes, however, the two nearest prices were quite far apart--for these I used a midpoint between bid and ask at the moment--however arguably this is not a price, particularly when we observe that many trades took place either above the ask or below the bid. Additionally, there are intervals where the midpoint between the bid and ask is actually undefinable, as during the interval from 19:42:04 to 19:42:06 where the bid price fluctuates in a complex fashion while the ask remains constant. So there are risks in this analysis.

The two dimensional lagged state space (using a 2-s lag to minimize mutual information) looks as below:


Not quite as beautiful as the Lorenz butterfly curve. I smoothed the data through a 3-point moving average filter as the original really looked like hell. The sinusoidal waves that slowly increase in size are reflected in the two-d state space as a spiral, drawn from the centre outwards, until the curve flies off into a new area of phase space.

The conventional dynamic explanation of the nat gas trading curve would be of a system in equilibrium--but the equilibrium is unstable, and the wobbles get progressively larger until the system shifts to a new equilibrium. Such a dynamic interpretation is incorrect. The Lorenz equilibrium is all equilibrium. What we perceive as a sudden shift in equilibrium is actually part of the equilibrium state.

Disequilibrium--it's new equilibrium.

From a trading perspective, the nat gas trading is more straightforward. Someone is able to profit from variability. The proper positioning of puts and calls may allow you to benefit by a large move (either up or down) in the price of a stock or commodity. After that, you can try to hit any buy or sell stops if you are able to drive the price up or down, (or in this case, both ways, until the sell stops were hit triggering a cascade in price). If there had been more buy stops, then the price would have melted up. It was simply a matter of luck that the price melted down.

As in all markets there are two (or more) participants. Leaving the actual trades for a minute and scrutinizing the fluctuations in the bid and ask, we see a complicated psychological game being played. I see many of the tricks that I have seen in thinly traded gold stocks priced by a market maker. You see the bid (or trade price) creep up towards the ask price, then run away, perhaps hoping to draw the ask price down.

But the time frame is completely different. I used to see this play out over the course of a trading day (my favourite was when I would get a partial fill of, say 500 shares of some penny stock before the price would swing away, and could imagine the market maker saying "do you want to pay full transaction fees for a $100 sale, or are you going to meet my price and fill your order?"). In this case, these games are being played on a split-second scale.

Game theory has been digitized and is running on a level of complexity that leaves TIT FOR TAT in the dust. Unfortunately my textbook on the subject is being used by my seven-year-old, so I can't get into strategy games between different players.

Many of the price rises happen while trades are occurring above the ask price. How does that happen. Is the asker crossing transactions with fictional entities to lure the buyer? Similarly, many trades occur below the bid price as the price is falling. Are these fictional crosses? Are these real trades or just a gimmick to lure in another party (hurry up and buy--look how fast price is falling!).

The chaotic appearance of this function is simply an emergent property of the gaming algorithms.

Lastly, I will point out that my analysis is roughly seven orders of magnitude slower than the frequency of some of the trades.