A new book by author Michael Lewis describes how trading algorithms that detect and exploit tiny, fleeting profit opportunities, called high-frequency traders, have transformed the stock market. And not by ripping off middle class investors. But that doesn't mean there are no problems. Read on to understand what high-frequency trading is, and what the real issues with it are.

What is high-frequency trading?

If you're an average human being, your eyes take around 400 milliseconds to blink once. High-frequency trading is a kind of market activity that moves in less than one millisecond to spot and take advantage of an opportunity to buy or sell. It happens through trading algorithms, programs that determine how to trade based on fast-moving market data.

The kind of profit opportunities that high-frequency trading looks for aren't the things most investors ever think about. They're not betting that technology companies will see their profits grow more quickly than expected, for example, or that a recession is coming.

Instead, they're looking for tiny opportunities for arbitrage. Imagine that, at precisely 10:30:01.01 AM, a share of Bank of America's stock was trading at $16.02 on the New York Stock Exchange - but it was $16.04 on a smaller exchange called BATS. A high-frequency trading computer might spring into action by buying up shares of stock on the New York Stock Exchange and selling them on BATS. To make money this way you need to move super-fast, because the opportunity could vanish at any moment.

Is high-frequency trading growing?

Not anymore, according to most data. High-frequency trading came into vogue during the 2000s, but after many traders entered the market, profits are way down, and there seems to be slightly less high-frequency trading than there used to be:

Profits in high-frequency trading have fallen to about 0.0005 per share, or a twentieth of a penny, mostly due to rising competition and less volatility, which create profit opportunities for the trading algorithms. There's new reporting, however, that suggests that high-frequency trading may be retreating from the stock market only to spread to other financial markets, like bonds, currencies, and derivatives.

This "electronic front-running" happens because the high-frequency traders have an advantage in terms of speed

How does high-frequency trading make money?

In his book, Lewis says there are three main activities that happen inside of high-frequency trading computers:

The first they called electronic front-running - seeing an investor trying to do something in one place and racing ahead of him to the next ... The second they called rebate arbitrage - using the new complexity to game the seizing of whatever legal kickbacks, called rebates within the industry, the exchange offered without actually providing the liquidity that the rebate was presumably meant to entice. The third, and probably by far the most widespread, they called slow-market arbitrage. This occurred when a high-frequency trader was able to see the price of a stock change on one exchange and pick off orders sitting on other exchanges before those exchanges were able to react.

Let's unpack that. Imagine you're a huge institutional investor, like the California Public Employees' Retirement System, which invests pension dollars saved for California's retired state-government workers. You've decided to buy up lots of shares of Apple. When you place your trade, you don't just send the order at one time to a single exchange, like a small investor would. Instead, you often have to break up your order to many exchanges and over a period of time. That's because there simply aren't enough people looking to sell as many shares as you want in a particular moment at a particular exchange.

That's the first kind of behavior that Lewis says high-frequency trading exploits. When the traders see CalPERS place a bid for Apple shares on the tech-heavy Nasdaq exchange, they quickly buy shares on other exchanges, inferring that CalPERS' orders are coming down the wires. Then the high-frequency traders sell the Apple shares back to CalPERS at a higher price than they paid for them a millisecond ago. This "electronic front-running" happens because the high-frequency traders have an advantage in terms of speed, and because "the stock market" doesn't really exist — what exists are many stock exchanges in a trading network.

Small investors don't place the kind of orders that HFT could attack

The second idea Lewis mentions is "rebate arbitrage," and it requires a bit of backstory. Before trading went electronic, there used to be actual people standing on the floor of stock exchanges who would both buy and sell the same stock at different times, helping to accommodate the flow of orders. They were called "market makers." And while some stock exchanges do still have people nominally in this role, the real market-making happens from high-frequency trading computers. They make markets because the stock exchanges pay them to fill that role, giving them a "rebate" on the cost of their trading.

The third exploits the network structure of markets, and the fact that they don't all adjust instantly to changes in price. If high-frequency traders can figure out where a stock price will be in the next millisecond before other investors can get a quote, that's a huge advantage they can use for profit.

So, does that mean the market is "rigged"?

There's no good definition of that term. It's not rigged in the sense most people mean "rigged," as the outcome of the market is not decided in advance. But it's reasonable to argue, as Lewis does, that high-frequency traders have a speed advantage - and, as a result, an informational advantage - that they use in an exploitative way.

What isn't at all right in Lewis' book, though, is its view that high-frequency trading hurts small investors. Small investors, as Reuters' Felix Salmon writes, don't place the kind of orders that high-frequency traders could attack, or would even find it worth their while to do so. The target of high-frequency trading is mostly institutional investors investment banks, pension funds, insurers, and so on — who trade in large volumes. On the other hand, people who have money and those institutions are hurt. High-frequency trading ended up skimming $7 billion off these investors in 2009. That's mostly coming out of the pockets of other rich people, but some middle class people with defined benefit pensions are also losing out

Does high-frequency trading make the market more efficient?

Nobody knows. There's a world in which that kind of rapid action could be good news. Responding instantly to earnings announcements, economic data and political events would be an advance for the efficiency of the market - and with that, the deployment of capital. Economists Jonathan Brogaard, Terrence Hendershott and Ryan Riordan have found that high-frequency trading tends to get the movements of prices right. Lots of trading volume might also narrow "bid-ask spreads," the differences between prices at which buyers want to buy and sellers want to sell, and make those orders clear more quickly. That's all good news for efficiency.

One of the biggest concerns, though, is that high-frequency trading may reduce the amount of liquidity in markets - that is, how easy it is to buy or sell - rather than increase it. The problem, as Nicholas Hirschey of the London School of Economics has found, is that the front-running makes financial investment more costly. It may also push institutional investors out of stock exchanges, further shrinking liquidity.

Can high-frequency trading cause stock-market crashes?

High-frequency trading might not cause the stock market to swing — markets have always done that — but research does suggest it may magnify volatility and, in particular, make financial markets more vulnerable to freezing up suddenly.

The high-frequency trading algorithms simply move too fast for humans to intervene with better judgment. When stocks drop, the trading programs may decide to stop trading, withdrawing liquidity from the market, or they may add to the sell-off.

That wouldn't surprise many people who remember what happened to the stock market on May 6, 2010 at 2:45 p.m. — the "Flash Crash," in which U.S. stocks fell 9 percent and then recovered in the course of a few minutes. Shares in companies like Accenture, a management consultancy, fell from $40 a share to a penny.

How did the Flash Crash happen? Some accounts, such as the report by the U.S. Commodity Futures Trading Commission and the Securities and Exchange Commission, center around the the "e-mini," a heavily-traded futures contract that tracks the Standard & Poors 500, a broad index of U.S. stocks.

The crash happened when a trading algorithm sold $4.1 billion of the contract, overwhelming demand for the e-mini. As liquidity ran out, the value of the contract plunged. High-frequency traders piled on, dumping the e-mini and and selling off other stocks, causing the rapid decline to cascade through the stock market. (See here for a minute-by-minute timeline of the crash.)

Another account of the crash from the market-data firm Nanex, however, focuses on two problems with price quotes, or when market participants send in the prices at which they want to buy or sell. During the Flash Crash, transmission of these quotes slowed sharply, as exchanges became overloaded. What caused the overloading, Nanex argues, was "quote stuffing" — high-frequency traders that sent in a blizzard of orders to buy and sell at the same time, only to cancel those orders milliseconds later before they went through. This behavior paralyzed market trading, and the processing delays caused a panic among traders who knew they had unreliable data.

A related theory is that markets froze up and crashed because of what's called "order flow toxicity," a complicated way of saying that people in the market became convinced that the other parties in their trades were "informed," or had newer or better information than they did. The market crashed as traders chose to dump shares or withdraw from the market rather than lose money to an informed trader. In this view, the problem with high-frequency trading is adverse selection: the fast traders drive out the slow until no market is left.

Are there other possible problems with high-frequency trading?

Yes, and three in particular often come up.

1) Much high-frequency trading exploits data before it is public for an advantage.

Until last summer, the data firm Thomson Reuters, for example, sold to elite investors the right to see an important economic statistic, the University of Michigan's consumer confidence survey, five minutes earlier than the rest of the market. An "even-more elite" group of high-frequency trading clients could purchase an extra 500 millisecond head start.

Reuters isn't doing this any longer. Yet similar practices still exist - one is called "paying for order flow." The idea is that a financial firm can pay brokers to route their clients' orders through them, so that they finish the broker's role of executing your trade. Why would these firms pay for that? Because they get to see orders to buy and sell before anyone else, giving them milliseconds' worth of advance knowledge of future prices.

A similar example that Lewis talks about is "co-location." High-frequency traders will locate their

computers as physically close to the exchange as possible, sometimes even right on the exchange's own servers. This gives them the first look at price changes.

2) Some strategies in high-frequency trading, such as "pinging" and "spoofing," are unethical or illegal.

"Pinging" is a strategy in which the high-frequency trader sends many small orders to an exchange. If these orders are all filled instantly, the high-frequency trader can infer that on the other side of the trade is a big investor looking to move a large volume of shares. The high-frequency trader then takes this knowledge and uses it against the big investor by moving the price against him - buying if he wants to buy and then selling it back to him at a higher price, selling if he wants to sell and then buying it back at a lower one.

"Spoofing" is a strategy, ostensibly banned in 2010, in which high-frequency traders send in orders with the idea of trying to confuse, or "spoof," other traders - and especially other trading algorithms - into thinking that demand to buy or sell a stock is coming. If the other traders fall for it, the algorithm quickly reverses course to take the side of the trade it actually wanted. There's evidence that this is what trading algorithms sending in bizarre orders, as they did during the Flash Crash, might be up to.

3) High-frequency trading is socially wasteful.

High-frequency trading is a zero-sum game. The winning side wins whatever the losing side loses. Yet millions of dollars have been spent to play this game faster - laying shorter cables across the country to transmit trades, massive investments in trading programs, and so on. That "arms race," as economists Eric Budish, Peter Cramton, and John Shim argue, is a pure waste.

What are some ways we could curb high-frequency trading?

One idea is to tax financial transactions, a proposal called a Tobin tax, after economist James Tobin. A slight fee of, say, 0.1 percent might have little effect on the ability of most investors to buy and sell profitably. Yet it might render unprofitable most of high-frequency trading, which makes a small profit per trade but makes countless trades.

The European Union planned to introduce a Tobin tax in 2014 on stocks, bonds, and derivatives trading, but the proposal has since been stalled. Sweden had a 0.5-percent tax on financial transactions from 1984 to 1991.

Another proposal is to redesign the way markets work. Instead of processing orders as they come in, there would be a "batch auction." All the orders that arrive over a given period of time would clear at once and at a single price. This would make it impossible to trade at the speeds high-frequency traders do, eliminating their informational advantage or their ability to preview other traders' orders.

The Securities and Exchange Commission, the Federal Bureau of Investigation, and the Justice Department all have ongoing investigations of high-frequency trading practices. Mostly, they're trying to determine whether the programs break laws against insider trading.

Regulators might end up opting for milder solutions. They might, for example, restrict particular types of trading activity or high-frequency traders' ability to co-locate inside stock-exchange servers. Another possibility is that they might adjust regulations to force high-frequency trading to abandon some of its shadier practices. They could assess a fee on high volumes of order cancellations, for instance, or require traders who submit quotes to honor them for a minimum period of time.