Matt Taibbi at Rolling Stone has an illuminating new post on his blog that sheds some light into one of the darker corners of Wall Street. According to documents recently (and mistakenly) filed in a lawsuit, Goldman Sachs (a.k.a. the vampire squid) routinely engages in naked short selling, a practice that is definitely illegal.
As a Wall Street skeptic, this revelation does not surprise me. However, as a computer scientist, I find the problem of naked short selling to be somewhat ridiculous. Naked short selling is only possible because the computer systems that power the stock market allow it to happen. However, the database technology to stop this practice has existed for 40 years. Why rely on laws to enforce the rules when you can use technology to stop the bad behavior in the first place? I think it’s time for the stock market to get an upgrade.
Before I delve into the technical details, a few definitions. What is short selling? In a short sale, an investor attempts to make money when the price of a stock falls. The process is simple: you sell the stock at a high price, wait for the price to fall, and then buy the stock back. In the end, the investor has the same amount of stock they began with, plus they pocket the difference between the high sell price and the low buy price.
For an investor to conduct a short sale, they must first have shares of the stock in question. If an investor wants to short a stock when they don’t have any shares, they borrow the shares from someone else (usually for a fee). Unfortunately, loopholes in our stock trading systems allow people to conduct naked short sales. In a naked short, the investor sells stock that they don’t have, waits for the price to fall, then buys the imaginary shares back. This practice is illegal, although, as Matt Taibbi reminds us, big investment firms get away with this all the time.
The obvious question that immediately jumps out from this scenario is: how is it possible for an investor to sell shares that they don’t actually have? The problem lies in the computer systems that run our stock markets. Essentially, these systems do perform any sanity checks in real-time. During the trading day, buy and sell orders just happen, and the systems do not check to make sure that traders have the shares they claim to be selling. At the very end of the day, the trading systems go through a reconciliation process, which is when the shares are actually moved around. Invalid trades (e.g. a naked short sale) are simply flagged as “failed trades” and ignored. The dirty little secret of Wall Street is that there are $200 billion dollars in failed trades per day.
The root problem here is that the trading systems do not perform error checks when trades are made. However, computer scientists solved this problem 40 years ago through the development of transactional databases. In investor jargon, a transaction is a trade or a deal. In CS lingo, a transaction is a coherent, reliable, reversible operation on a database. If you bank online, then you’re already familiar with transactions and you don’t even know it. As an example, lets say you want to transfer $1000 from your checking account to your saving account. Behind the scenes, there is a transaction going on that looks like this:
- Locate the checking account
- Make sure there is $1000 in the checking account
- Subtract $1000 from the checking account
- Locate the saving account
- Add $1000 to the savings account
Notice all the error checking. Both accounts need to be real, and you actually have to have the money. If any one of these 5 steps fails, then the entire transaction gets rolled back, so the database returns to its original state. For example, suppose you accidentally tried to transfer the $1000 to an account that was closed. The transaction would fail at step 4, but at that point the $1000 is already subtracted from your checking! The rollback makes sure that the $1000 goes back into your checking account, and doesn’t disappear into the ether.
Using transactions makes obvious sense for your bank. Consider what could happen if your local bank used a reconciliation system like the stock market. A person could do the following:
- 8:00 am: Transfer $1 million from one empty account into another.
- 8:01 am: Withdraw the money and go gambling in Las Vegas.
- 5:59 pm: Put $1 million back into one of the accounts (assuming you haven’t already lost the money playing pai gow).
In the reconciliation system, the bank wouldn’t notice that you just minted $1 million out of thin air until they closed up shop for the day. If this looks and sounds like fraud to you, that’s because it is. It would be insane for a bank to store money in a system that wasn’t transactional. Why should we treat the stock market any different? Upgrading the stock market to use a transactional system would completely prevent unscrupulous investors from naked short selling. There would be no need to legislate against naked short selling, or worry about uneven (or nonexistent) enforcement of the law.
An additional benefit of moving to a fully transactional stock trading platform is that the trading system would be slower. The slowdowns arise from the extra code that performs error and consistency checking. Practically, this would increase the time to conduct a trade from several microseconds (current system) to milliseconds (transactional system). No human would notice the difference, but the added delay would make it harder for High Frequency Traders (HFT) to cause another flash crash.