Photo: liryon via Flickr
The Securities Exchange Commission (SEC) recently announced a new rule to help them better monitor stock trading. The new rule, Rule 613, will require stock markets to track orders more precisely than they do now, in real-time, with the hope that this will enable the SEC to maintain more orderly markets.The markets have been anything but orderly lately. Everyone has heard about the absurd glitch during the Facebook IPO, which essentially destroyed hundred of millions of dollars of somebody’s money. What you might not have heard is that every few months some piece of software at a trading firm goes haywire and pumps out thousands or hundreds of thousands of unintentional stock trades before anyone notices, with disastrous results for the firm, the stock market, and, ultimately, all of us.
Its difficult to find something less interesting to talk about than an SEC rule, but if you want to understand why the markets are the way they are, and what could be done to stabilise them, it is the best place to start. Stable stock markets help us, and unstable, chaotic stock markets hurt us. All of us. I am not trying to convince you that a strong stock market helps everyone. I am not sure it does. But an unstable stock market that impairs companies’ ability to operate and scares investors from investing in the US only hurts our economy, makes it harder for you to get a job or get that raise, or save enough money against inflation for retirement. Even if you have never invested a dollar in any stock, even if you don’t have a 401K or a 529 or any kind of investment at all, not even a checking account, bad markets are bad for you. Do not think you are safe because you feel far from Wall Street. Sorry, dear reader, what happens on Wall Street matters to you more than you know.
The SEC’s work towards a more stable, more understandable stock market matters to all of us, and let’s give them credit: they have done at least an OK job since they started, during The Great Depression. At the very least we have not had another Great Depression.
Stock markets are changing, though, and are creating a new set of challenges for the SEC. For starters, the SEC is geared up to be a watchdog for people. The SEC regulates people. It creates rules for people, and then monitors people to make sure they are following the rules.
Stock markets have been heavily people-centric long after you would think. For a long time, all those terminals and displays you saw on the B roll on nightly news simply connected people. Technology let more people trade with each other faster and from farther away. Those traders working those terminals were using a trader’s equivalent of instant messenger instead of all shouting at each other under a buttonwood tree or calling each other on the telephone. Trading was still slow and manageable by rules designed to regulate people because people still had to connect to execute a trade.
By the late 90’s, though, the infrastructure was in place for computers to trade directly with each other. More than 10 years later, the vast majority of equity trading activity is between computers, software, algorithms, operating in real-time, trading orders of magnitude faster than any person could ever deal with. Even when people are directly involved, they are still trading with computers, and can enter massive order strategies with a single keystroke.
I don’t think this is necessarily bad. I am not prejudiced, or a Luddite. In fact, I worked hard to bring this all about. What two consenting computer algorithms want to do, or what consenting adults wants to do with a trading algorithm is none of my business, as long they follow the rules, and as long as we have good rules that ensure stock markets are enabling a common good. When an algorithm goes haywire, or, more specifically, when a trading firm empowers an algorithm to destabilize the entire US equities market, causing trillions in paper gains to disappear in minutes, that is helping no one. Practically no one: I am sure there were some crafty short-trading bots taking advantage of the situation.
Computer driven stock markets have the the capacity to create problems orders of magnitude faster and larger than the SEC can cope with. Months after the Flash Crash of 2010, the SEC was still unable to understand what caused that meltdown. Its still a mystery. Rule 613 is an effort to get a handle on these problems.
Rule 613 is a nice idea, but it doesn’t go far enough. Like earlier iterations of this rule, it will fail to fulfil expectations because the SEC does not understand how to create rules that work for computers. They write rules as if they are regulating humans. The Flash Crash was not caused by humans, not directly, nor was the the recent collapse of Knight Trimark. The SEC needs to understand they are not regulating humans. They are regulating computers. Or worse, computer programmers.
As a computer programmer, I created the first service that let regular people, i.e. non-professional or “retail” traders, trade directly with the stock market from anywhere on the web. When I first started doing this in 1996, the stock market was made up of “market makers” or “specialists”, human traders whose job it was to buy and sell stocks all day long. My customers entered orders through a website into what would be now called a “bot” or an “algo”, that then did its best to out-trade those market makers or specialists. There were people involved, just not at our firm, only over at the stock market. Shortly afterwards, we created a fully automated system that let regular people trade with each other without needing a stock market at all, just an algorithm that mindlessly matched up trades, more quickly and more fairly than any human. That algorithm eventually became the heart of NASDAQ, as well as the heart of many other electronic markets. It didn’t take long before smart firms started replacing their traders with algorithms as well. Algorithms never get stuck in traffic, never have to go to bathroom, and never ask for a raise.
To let people trade directly with the stock market I had to automate pretty much every rule the SEC and the stock markets had ever written involving stock trading. Going through that process made it painfully clear the rule-writers had never thought about how a computer, or a computer programmer, might try to automate this stuff.
Let me see if I can clarify with a few small examples. One rule defining how frequently a particularly effective trading system could be used by an individual specified a “one trade every few minutes” limitation, the idea being that this system was intended for small traders who should not trade that much or that often. Its an odd restriction to explain now, and it was equally odd back then, but its interesting how woefully incomplete the rule was to a computer programmer. What about orders entered when the markets were closed, like on weekend? Websites are always open, even if the stock markets are not. Did this rule apply then? What if a customer entered an order on the weekend, then cancelled it, and then entered another one, even though the first order never went anywhere because markets are closed on the weekend?
Asking for clarification got you nowhere, because the way the SEC and other stock market regulating organisations like NASDR liked to play was, “you do your own thing and we reserve the right to punish you later if we decide you got it wrong.” Not wanting any trouble with Mary Shapiro, then head of NASDR who oversaw this rule, now the head of the SEC, I assumed the most pessimistic, risk adverse answer every time, i.e., “yes, the rule counts on the weekend even if that makes no sense.”
Many of the SEC’s rules made no sense when viewed during the trading day, as if the writers of the rules only experienced the world when stock markets were closed. There were some interesting rules regarding how much a client could borrow from a brokerage firm to trade with based on the prices of the stocks in their portfolio. If the price of a stock dropped below $5, you couldn’t borrow against it. The amount you could borrow was based on the value of the position. If a stock in your portfolio hovered around $5, you would have lots of money to trade with, then have none, then lots, then none or worse, be in default because you borrowed too much. These rules were especially idiotic, from a real-time algorithmic perspective, because the definition of “stock price” was nowhere to be found. In a continuous market like NASDAQ or the NYSE, there is the price you can sell at (the offer or ask), the price you can buy at (bid), and that’s it. Two numbers, for every stock, whenever there is trading going on. There is something called a “last trade price” which only makes sense at the end of the day- its too noisy during the trading day to be of much use for anything important. Last trade price jumps around as firms enter trades hours after they are executed, and it had little connection to the actual price you could buy or sell a stock at (although other rules have improved this somewhat in recent years). Nowhere was the definition of “price” given, and conversations with the regulators taught me that they lived in a simpler world than mine. The rule-makers never conceived of a real-time, fully automated world, just as I never conceived of anything but that.
As far as I knew, I was alone in connecting a dentist in New Rochelle, and several million people like him, directly to the first automated stock exchanges over the web. I was alone, and terrified. What if something went wrong? How would I know what happened, and how would I defend my firm to the NASDR or the SEC if they decided that what we were doing was somehow inappropriate? We thought we were helping the individual investor trade effectively against professionals who had the odds and the rules stacked in their favour, but we knew that the SEC or the regulators at the exchanges, hired by those same professionals, might have a different view.
Out of fear, I built a system that kept track of every single order a customer entered, every single trading decision my algorithms made, every single piece of data needed to make those decisions, as well as every single trade that we ever created, cancelled, or fulfilled. In real-time. This knowledge was instantly accessible by anyone at our firm, even while the trades were being processed. It required more hard drive space in a day than all the other data we generated in a month, and it was worth it.
It answered every question regulators ever asked us about any customer order, and more importantly, it answered our own questions about what was going on with our customers’ orders. If a customer called to ask about an order, we could tell them exactly what was going on. We could not have stayed in business without this system.
Years after I had created this real-time order tracking system and my firm had grown to be one the largest retail brokerage companies on the planet, the SEC mandated an industry-wide order tracking system whose acronym was OATS. This is the predecessor of whatever will be created by Rule 613, and I think its still in use today. This system, implemented across every firm at much expense, was a near-total failure. I am fairly certain it never answered any useful questions for at least the first few years of its operation, because I would frequently get calls from regulators to answer questions that could have been answered by the simplest queries on the data that OATS was supposed to collect. Regulators would routinely contact firms to collect trading data for their investigations, even though OATS mandated that it should already be on the CD-ROMS, DVDs, or data tapes in a closet somewhere at the NASDR or the SEC. Of course, firms that had something to hide had an incentive to produce poor OATS data, and it didn’t seem like anyone was ever checking those CD-ROMS anyway.
OATS was a failure because it collected a small fraction of the data a regulator would need to answer real questions, it asked for the data in a format that made it almost unusable, and mostly because no one ever validated the data to see if it was even remotely accurate. OATS was like making a backup for your computer but never checking to see if you wrote anything to your backup drive, or even if you could connect the backup drive to your computer – yes, my analogy needs some work, but that show broken OATS was from a computer programmer perspective.
The SEC realises they need to get a handle on this big data problem, which is why they passed Rule 613 which calls for stock markets to create the next OATS. The problem is that Rule 613 does not go far enough, and is likely to result in a system as useless for solving these problems as OATs was or is. While the SEC might want to solve this problem, the trading firms don’t, and they will hem and haw and say how hard it is for them to do the simplest things, even as they spend millions of dollars to make their trading algorithms go a few microseconds faster.
Rule 613 does not call for, or provides generous exceptions for, many of the features that made my system so effective. My Rule 613 analogue was created by just a single average programmer (me ) in a few weeks, on 1990’s technology. Its certainly not beyond the technical capacity of Wall Street today. For example, time-stamping messages down to a microsecond or two within the trading day is a fairly trivial problem, and asking exchanges or firms to write a message indicating ever single order, cancel, or execution just isn’t that hard. More effort goes into showing you those banner ads on your web browser that you ignore.
More importantly, Rule 613 doesn’t ask firms to identify trades as to why they are being entered, i.e. which ‘bot or algorithm is placing the trade, and what the perceived market data is that is generating that trading decision. Most of my problems on my systems were caused when either the market data got confusing, or my systems got confused by the market data. Tracking that market data that goes into a ‘bots trading decision is key if you want to understand “why” and not just “what”. If you think of the stock market as a computer program, this is exactly the type of data you want to log to debug the markets.
I could go on like this for quite a while, but the core problem is the SEC does not understand they are debugging a giant and very important computer program: they don’t understand what data they need to log, where to put the printf() statements.
The system I think the SEC needs would not only collect everything my old silly system collected in real-time, but validate it in near real-time as well, so that the SEC knew firms were reporting correctly, before they needed to answer any hard questions.
If I were the SEC, I would make the system open and let third-parties access the data as well. That way, the SEC could do less, accomplishing more by not hiring their own army of computer programmers, but instead building an ecosystem around trade data. Third-party firms could validate the data, in real-time, and publish reports on market dynamics. Maybe these firms generate revenue by selling reports as well- they will need some incentives to look through all that data. Maybe multiple entities, not the SEC or exchange-specific regulatory agencies, can scour data in real-time looking for problems, and the SEC can pick and choose which problems it wants to focus on. Multiple competing watchdogs, all mining the same real-time trade data, will certainly generate more thorough results than a team of government analysts. There are ways of anonymizing the data so that proprietary trading secrets remain secret, but trading improprieties are still identifiable in real-time. If the SEC can borrow an idea from the Internet, and build an open ecosystem around trade data for the purpose of monitoring stock markets, we will all be better off.
The SEC should try treating stock markets like computer systems that need to be debugged. Once they start thinking of things this way and staff accordingly, I think the SEC will love their job more than ever before. People, or at least Wall Street people, can be deceitful, lying, selfish, nasty things that will do anything for money, including break rules in ways that are terribly hard to find. This happens countless times every day and the SEC can only hope to find the most grievous examples, and even then only at great expense to the taxpayer.
Computers, in comparison, are predictable, make terrible liars, and while persistent to a fault they are not known for creative rule breaking. Most importantly, they are remarkably easy to monitor once you set up their environment the right way. In an electronic trading world, the SEC has the opportunity to identity and categorize every single transgression, and punish the transgressors accordingly. In fact, the SEC could identify patterns in trading activity that are precursors to results they want to avoid and create market circuit breakers that are specific enough to actually work, as opposed to the one-sided price, volume-blind circuit breakers now in place that have failed to protect the markets more than once.
The smart computer programmers are working at the trading firms, shaving off those microseconds, not at the SEC helping to debug the markets. That means more flash crashes, unstable markets, and in the end, a worse outcome for almost all of us.
The SEC needs awesome computer hackers to help write the rules, monitor the markets, and restore the balance.