Wednesday, April 22, 2015

Spoofing in an Algorithmic Ecosystem

A London trader recently charged with price manipulation appears to have been using a strategy designed to trigger high-frequency trading algorithms. Whether he used an algorithm himself is beside the point: he made money because the market is dominated by computer programs responding rapidly to incoming market data, and he understood the basic logic of their structure.

Specifically, Navinder Singh Sarao is accused of having posted large sell orders that created the impression of substantial fundamental supply in the S&P E-mini futures contract:
The authorities said he used a variety of trading techniques designed to push prices sharply in one direction and then profit from other investors following the pattern or exiting the market.

The DoJ said by allegedly placing multiple, simultaneous, large-volume sell orders at different price points — a technique known as “layering”— Mr Sarao created the appearance of substantial supply in the market.
Layering is a type of spoofing, a strategy of entering bids or offers with the intent to cancel them before completion.
Who are these "other investors" that followed the pattern or exited the market? Surely not the fundamental buyers and sellers placing orders based on an analysis of information about the companies of which the index is composed. Such investors would not generally be sensitive to the kind of order book details that Sarao was trying to manipulate (though they may buy or sell using algorithms sensitive to trading volume in order to limit market impact). Furthermore, as Andrei Kirilenko and his co-authors found in a transaction level analysis, fundamental buyers and sellers account for a very small portion of daily volume in this contract.

As far as I can tell, the strategies that Sarao was trying to trigger were high-frequency trading programs that combine passive market making with aggressive order anticipation based on privileged access and rapid responses to incoming market data. Such strategies correspond to just one percent of accounts on this exchange, but are responsible for almost half of all trading volume and appear on one or both sides of almost three-quarters of traded contracts.

The most sophisticated algorithms would have detected Sarao's spoofing and may even have tried to profit from it, but less nimble ones would have fallen prey. In this manner he was able to syphon off a modest portion of HFT profits, amounting to about four forty million dollars over four years.

What is strange about this case is the fact that spoofing of this kind is, to quote one market observer, as common as oxygen. It is frequently used and defended against within the high frequency trading community. So why was Sarao singled out for prosecution? I suspect that it was because his was a relatively small account, using a simple and fairly transparent strategy. Larger firms that combine multiple strategies with continually evolving algorithms will not display so clear a signature. 

It's important to distinguish Sarao's strategy from the ecology within which it was able to thrive. A key feature of this ecology is the widespread use of information extracting strategies, the proliferation of which makes direct investments in the acquisition and analysis of fundamental information less profitable, and makes extreme events such as the flash crash practically inevitable.

Monday, April 06, 2015

Intermediation in a Fragmented Market

There’s a recent paper by Merritt Fox, Lawrence Glosten and Gabriel Rauterberg that anyone interested in the microstructure of contemporary asset markets would do well to read. It's one of the few papers to take a comprehensive and theoretically informed look at the welfare implications of high frequency trading, including effects on the incentives to invest in the acquisition and analysis of fundamental information, and ultimately on the allocation of capital and the distribution of risk.

Back in 1985, Glosten co-authored what has become one of the most influential papers in the theory of market microstructure. That paper considered the question of how a market maker should set bid and ask prices in a continuous double auction in the presence of potentially better informed traders. The problem facing the market maker is one of adverse selection: a better informed counterparty will trade against a quote only if doing so is profitable, which necessarily means that all such transactions impose a loss on the market maker. To compensate there must be a steady flow of orders from uninformed parties, such as investors in index funds who are accumulating or liquidating assets to manage the timing of their consumption. The competitive bid-ask spread depends, among other things, on the size of this uninformed order flow as well as the precision of the signals received by informed traders.

The Glosten-Milgrom model, together with a closely related contribution by Albert Kyle, provides the theoretical framework within which the new paper develops its arguments. This is a strength because the role of adverse selection is made crystal clear. In particular, any practice that defends a market maker against adverse selection (such as electronic front running, discussed further below) will tend to lower spreads under competitive conditions. This will benefit uninformed traders at the margin, but will hurt informed traders, reduce incentives to acquire and analyze fundamental information, and could result in lower share price accuracy.

Such trade-offs are inescapable, and the Glosten-Milgrom and Kyle models help to keep them in sharp focus. But this theoretical lens is also a limitation because the market makers in these models are passive liquidity providers who do not build directional exposure based on information gleaned from their trading activity. This may be a reasonable description of the specialists of old, but the new market makers combine passive liquidity provision with aggressive order anticipation, and respond to market data not simply by cancelling orders and closing out positions but by speculating on short term price movements. They would do so even in the absence of market fragmentation, and this has implications for price volatility and the likelihood of extreme events which I have discussed in earlier posts.

But the focus of the paper is not on volatility, but rather on market fragmentation and differential access to information. The authors argue that three controversial practices---electronic front running, slow market arbitrage, and midpoint order exploitation---can all be traced to these two features of contemporary markets, and can all be made infeasible by a simple change in policy. It's worth considering these arguments in some detail.

Electronic front running is the practice of using information acquired as a result of a trade at one venue to place or cancel orders at other venues while orders placed at earlier points in time are still in transit. The authors illustrate the practice with the following example: 
For simplicity of exposition, just one HFT, Lightning, and two exchanges, BATS Y and the NYSE, are involved. Lightning has co-location facilities at the respective locations of the BATS Y and NYSE matching engines. These co-location facilities are connected with each other by a high-speed fiber optic cable.
An actively managed institutional investor, Smartmoney, decides that Amgen’s future cash flows are going to be greater than its current price suggests. The NBO is $48.00, with 10,000 shares being offered at this price on BATS Y and 35,000 shares at this price on NYSE. Smartmoney decides to buy a substantial block of Amgen stock and sends a 10,000 share market buy order to BATS Y and a 35,000 share market buy order to NYSE. The 35,000 shares offered at $48.00 on NYSE are all from sell limit orders posted by Lightning.
The order sent to BATS Y arrives at its destination first and executes. Lightning’s colocation facility there learns of the transaction very quickly. An algorithm infers from this information that an informed trader might be looking to buy a large number of Amgen shares and thus may have sent buy orders to other exchanges as well. Because of Lightning’s ultra-high speed connection, it has the ability to send a message from its BATS Y co-location facility to its co-location facility at NYSE, which in turn has the ability to cancel Lightning’s 35,000 share $48.00 limit sell order posted on NYSE. All this can happen so fast that the cancellation would occur before the arrival there of Smartmoney’s market buy order. If Lightning does cancel in this fashion, it has engaged in “electronic front running.” 
Note that if Smartmoney had simply sent an order to buy 45,000 shares to BATS Y, of which an unfilled portion of 35,000 was routed to NYSE, the same pattern of trades and cancellations would occur. But in this alternative version of the example, orders would not be processed in the sequence in which they make first contact with the market. In particular, the cancellation order would be processed before the original buy order had been processed in full. This seems to violate the spirit if not the letter of Regulation NMS.

Furthermore, while the authors focus on order cancellation in response to the initial information, there is nothing to prevent Lightning from buying up shares on NYSE, building directional exposure, then posting offers at a slightly higher price. In fact, it cannot be optimal from the perspective of a firm with such a speed advantage to simply cancel orders in response to new information: there must arise situations in which the information is strong enough to warrant a speculative trade. In effect, the firm would mimic the behavior of an informed trader by extracting the information from market data, at a fraction of the cost of acquiring the information directly. 

Electronic front running prevents informed traders from transacting against all resting orders that are available at the time they place an order. This defends high frequency traders against adverse selection, allowing them to post smaller spreads, which benefits uninformed traders. But it also lowers the returns to investing in the acquisition and analysis of information, potentially lowering share price accuracy. Given this, the authors consider the welfare effects of electronic front running to be ambiguous.

The other two practices, however, result in unambiguously negative welfare effects. First consider slow market arbitrage, defined and illustrated by the authors as follows:
Slow market arbitrage can occur when an HFT has posted a quote representing the NBO or NBB on one exchange, and subsequently someone else posts an even better quote on a second exchange, which the HFT learns of before it is reported by the national system. If, in the short time before the national report updates, a marketable order arrives at the first exchange, the order will transact against the HFT’s now stale quote. The HFT, using its speed, can then make a riskless profit by turning around and transacting against the better quote on the second exchange…

To understand the practice in more detail, let us return to our HFT Lightning. Suppose that Lightning has a limit sell order for 1000 shares of IBM at $161.15 posted on NYSE. This quote represents the NBO at the moment. Mr. Lowprice then posts a new 1000 share sell limit order for IBM on EDGE for $161.13.

The national reporting system is a bit slow, and so a short period of time elapses before it reports Lowprice’s new, better offer. Lightning’s co-location facility at EDGE very quickly learns of the new $161.13 offer, however, and an algorithm sends an ultra-fast message to Lightning’s co-location facility at NYSE informing it of the new offer. During the reporting gap, though, Lightning keeps posted its $161.15 offer. Next, Ms. Stumble sends a marketable buy order to NYSE for 1000 IBM shares. Lightning’s $161.15 offer remains the official NBO, and so Stumble’s order transacts against it. Lightning’s co-location facility at NYSE then sends an ultra-fast message to the one at EDGE instructing it to submit a 1000 share marketable buy order there. This buy order transacts against Lowprice’s $161.13 offer. Thus, within the short period before the new $161.13 offer is publicly reported, Lightning has been able to sell 1000 IBM shares at $161.15 and purchase them at $161.13, for what appears to be a $20 profit. 
This practice hurts both informed and uninformed traders, and is a clear example of what I have elsewhere called superfluous financial intermediation. According to the authors this practice would have negative welfare effects even if it did not require the investment of real resources.

In discussing wealth transfer, the authors argue that "Ms. Stumble... would have suffered the same fate if Lightning had not engaged in slow market arbitrage because that course of action would have also left the $161.15 offer posted on NYSE and so Stumble’s buy order would still have transacted against it." While this is true under existing order execution rules, note that it would not be true if orders were processed in the sequence in which they make first contact with the market. 

Finally, consider mid-point order exploitation:
A trader will often submit to a dark pool a “mid-point” limit buy or sell order, the terms of which are that it will execute against the next marketable order with the opposite interest to arrive at the pool and will do so at a price equal to the mid-point between the best publicly reported bid and offer at the time of execution. Mid-point orders appear to have the advantage of allowing a buyer to buy at well below the best offer and sell well above the best bid. It has been noted for a number of years, however, that traders who post such orders are vulnerable to the activities of HFTs… Mid-point order exploitation again involves an HFT detecting an improvement in the best available bid or offer on one of the exchanges before the new quote is publicly reported. The HFT puts in an order to transact against the new improved quote, and then sends an order reversing the transaction to a dark pool that contains mid-point limit orders with the opposite interest that transact at a price equal to the mid-point between the now stale best publicly reported bid and offer…

Let us bring back again our HFT, Lightning. Suppose that the NBO and NBB for IBM are $161.15 and $161.11, respectively, and each are for 1000 shares and are posted on NYSE by HFTs other than Lightning. Then the $161.15 offer is cancelled and a new 1000 share offer is submitted at $161.12. Lightning, through its co-location facilities at NYSE, learns of these changes in advance of their being publicly reported. During the reporting gap, the official NBO remains $161.15.

Lightning knows that mid-point orders for IBM are often posted on Opaque, a well known dark pool, and Lightning programs its algorithms accordingly. Because Opaque does not disclose what is in its limit order book, Lightning cannot know, however, whether at this moment any such orders are posted on Opaque, and, if there are, whether they are buy orders or sell orders. Still there is the potential for making money.

Using an ultra-fast connection between the co-location facility at NYSE and Opaque, a sell limit order for 1000 shares at $161.13 is sent to Opaque with the condition attached that it cancel if it does not transact immediately (a so-called “IOC” order). This way, if there was one or more mid-point buy limit orders posted at Opaque for IBM, they will execute against Lightning’s order at $161.13, half way between the now stale, but still official, NBB of $161.11 and NBO of $161.15. If there are no such mid-point buy orders posted at Opaque, nothing is lost.

Assume that there are one or more such mid-point buy orders aggregating to at least 1000 shares and so Lightning’s sell order of 1000 shares transacts at $161.13. Lightning’s co-location facility at NYSE is informed of this fact through Lightning’s ultra-fast connection with Opaque. A marketable buy order for 1000 shares is sent almost instantaneously to NYSE, which transacts against the new $161.12 offer. Thus, within the short period before the new $161.12 offer on NYSE is publicly reported, Lightning has been able to execute against this offer, purchase 1000 IBM shares at $161.12, and sell them at $161.13, for what appears to be a $10.00 profit. 
As in the case of slow market arbitrage, this hurts informed and uninformed traders alike. 

The three activities discussed above all stem from the fact that trading in the same securities occurs across multiple exchanges, and market data is available to some participants ahead of others. The authors argue that a simple regulatory change could make all three practices infeasible:
We think there is an approach to ending HFT information speed advantages that is simpler both in terms of implementation and in terms of achieving the needed legal changes. None of these three practices would be possible if private data feeds did not make market quote and transaction data effectively available to some market participants before others. Thus, one potential regulatory response to the problem posed by HFT activity is to require that private dissemination of quote and trade information be delayed until the exclusive processor under the Reg. NMS scheme, referred to as the “SIP,” has publicly disseminated information from all exchanges.
Rule 603(a)(2) of Reg. NMS prohibits exchanges from “unreasonably discriminatory” distribution of market data… Sending the signal simultaneously to an HFT and to the SIP arguably is “unreasonably discriminatory” distribution of core data to the end users since it is predictable that some will consistently receive it faster than others… Interestingly, this focus on the time at which information reaches end users rather than the time of a public announcement is the approach the courts and the SEC have traditionally taken with respect to when, for purposes of the regulation of insider trading, information is no longer non-public. Thus the SEC’s ability to alter its interpretation of Rule 603(a)(2) may be the path of least legislative or regulatory resistance to prohibiting electronic front-running. 
There’s an even simpler solution, however, and that is to process each order in full in the precise sequence in which it makes first contact with the market. That is, if two orders reach an exchange in quick succession, they should be processed not in the order in which they reach the exchange but rather the order in which they have reached any exchange. Failing this, I don't see how we can be said to have a "national market system" at all.

Friday, April 03, 2015

Prediction Market Design

The real money, peer-to-peer prediction market PredictIt is up and running in the United States. Modeled after the pioneering Iowa Electronic Markets, it offers a platform for the trading of futures contracts with binary payoffs contingent on the realization of specified events. 

There are many similarities to the Iowa markets: the exchange has been launched by an educational institution (New Zealand's Victoria University), is offered as an experimental research facility rather than an investment market, operates legally in the US under a no-action letter from the CFTC, and limits both the number of traders per contract and account size. While there are no fees for depositing funds or entering positions, the exchange takes a 10% cut when positions are closed out at a profit and charges a 5% processing fee for withdrawals. (IEM charges no fees whatsoever.) 

While still in beta and ironing out some software glitches, trading is already quite heavy with bid-ask spreads down to a penny or two in some contracts referencing the 2016 elections. Trading occurs via a continuous double auction, but the presentation of the order book is non-standard. Here, for instance, is the current book for a contract that pays off if the Democratic nominee wins the 2016 presidential election:


To translate this to the more familiar order book representation, read the left column as the ask side and subtract the prices in the right column from 100 to get the bid side.

There's one quite serious design flaw, which ought to be easy to fix. Unlike the IEM (or Intrade for that matter), short positions in multiple contracts referencing the same event are not margin-linked. To see the consequences of this, consider the prices of contracts in the heavily populated Republican nomination market:

These are just 10 of the 17 available contracts, and the list is likely to expand further. According to the prices at last trade, there's a 102% chance that the nominee will be Bush, Walker or Rubio, and a 208% chance that it will be one of these ten. If one buys the "no" side of all ten contracts at the quoted prices at a cost of $8.10, a payoff of at least $9 is guaranteed, since the party will have at most one nominee. That's a risk-free return of at least 11% over a year and a quarter. 

This mispricing would vanish in an instant if the cost of buying a set of contracts were limited to the worst case loss, as indeed was the case on Intrade (IEM allows the purchase and sale of bundles at par, which amounts to the same thing.) Then buying the "no" side of the top two contracts would cost $0.26 instead of $1.26, and shorting the top three would be free.

If the exchange were to manage a switch to margin-linked shorts, all those currently holding no positions would make a windfall gain as prices snap into line with a no-arbitrage condition. Furthermore, algorithmic traders would jump into the market to exploit new arbitrage opportunities as they appear. Such algos have been active on IEM for a while now, and were responsible for a good portion of transactions on Intrade.

Despite this one design flaw, I expect that these markets will be tracked closely as the election approaches, and that liquidity will increase quite dramatically. This despite the fact that traders are entering into negative-sum bets with each other, which ought to be impossible under the common prior assumption. The arbitrage conditions will come to be more closely approximated as the time to contract expiration diminishes, especially in markets with few active contracts (such as that for the winning party). But unless the flaw is fixed, the translation of prices into probabilities will require a good deal of care.