Quantitative Trading. Ernest P. Chan
rel="nofollow" href="http://www.economist.com/briefing/2019/10/05/the-stockmarket-is-now-run-by-computers-algorithms-and-passive-managers">www.economist.com/briefing/2019/10/05/the-stockmarket-is-now-run-by-computers-algorithms-and-passive-managers.
2 Lux, Hal. 2000. “The Secret World of Jim Simons.” Institutional Investor Magazine, November 1.
3 Poundstone, William. 2005. Fortune's Formula. New York: Hill and Wang.
Acknowledgments
For the second edition, I would like to thank Ben Xie, Long Le, Roger Hunter, Tho Du, and Zachary David for their help with Python and R. A big thank you also to my production editor, Purvi Patel, for shepherding this project to its fruition.
I thank Dr. Sergei Belov and Dr. Radu Ciobanu for demonstrating a novel machine-learning technique that we called Conditional Parameter Optimization in Example 7.1, and updating Example 7.4 with his high-performance PCA codes. Radu was the VP of Engineering at PredictNow.ai, our financial machine-learning SaaS, and Sergei is a senior researcher there.
Last but not least, I would like to thank all the readers who wrote me over the years since the publication of the first edition with their questions and doubts, about bugs in the book, and on how they finally achieved success in this ultracompetitive world of quant trading.
CHAPTER 1 The Whats, Whos, and Whys of Quantitative Trading
If you are curious enough to pick up this book, you probably have already heard of quantitative trading. But even for readers who learned about this kind of trading from the mainstream media before, it is worth clearing up some common misconceptions.
Quantitative trading, also known as algorithmic trading, is the trading of securities based strictly on the buy/sell decisions of computer algorithms. The computer algorithms are designed and perhaps programmed by the traders themselves, based on the historical performance of the encoded strategy tested against historical financial data.
Is quantitative trading just a fancy name for technical analysis, then? Granted, a strategy based on technical analysis can be part of a quantitative trading system if it can be fully encoded as computer programs. However, not all technical analysis can be regarded as quantitative trading. For example, certain chartist techniques such as “look for the formation of a head and shoulders pattern” might not be included in a quantitative trader's arsenal because they are quite subjective and may not be quantifiable.
Yet quantitative trading includes more than just technical analysis. Many quantitative trading systems incorporate fundamental data in their inputs: numbers such as revenue, cash flow, debt-to-equity ratio, and others. After all, fundamental data are nothing but numbers, and computers can certainly crunch any numbers that are fed into them! When it comes to judging the current financial performance of a company compared to its peers or compared to its historical performance, the computer is often just as good as human financial analysts—and the computer can watch thousands of such companies all at once. Some advanced quantitative systems can even incorporate news events as inputs: Nowadays, it is possible to use a computer to parse and understand the news report. (After all, I used to be a researcher in this very field at IBM, working on computer systems that can understand approximately what a document is about.)
So you get the picture: As long as you can convert information into bits and bytes that the computer can understand, it can be regarded as part of quantitative trading.
WHO CAN BECOME A QUANTITATIVE TRADER?
It is true that most institutional quantitative traders received their advanced degrees as physicists, mathematicians, engineers, or computer scientists. This kind of training in the hard sciences is often necessary when you want to analyze or trade complex derivative instruments. But those instruments are not the focus in this book. There is no law stating that one can become wealthy only by working with complicated financial instruments. (In fact, one can become quite poor trading complex mortgage-backed securities, as the financial crisis of 2007–08 and the demise of Bear Stearns have shown.) The kind of quantitative trading I focus on is called statistical arbitrage trading. Statistical arbitrage deals with the simplest financial instruments: stocks, futures, and sometimes currencies. One does not need an advanced degree to become a statistical arbitrage trader. If you have taken a few high school–level courses in math, statistics, computer programming, or economics, you are probably as qualified as anyone to tackle some of the basic statistical arbitrage strategies.
Okay, you say, you don't need an advanced degree, but surely it gives you an edge in statistical arbitrage trading? Not necessarily. I received a PhD from one of the top physics departments of the world (Cornell University). I worked as a successful researcher in one of the top computer science research groups in the world (at that temple of high-techdom: IBM's T. J. Watson Research Center). Then I worked in a string of top investment banks and hedge funds as a researcher and finally trader, including Morgan Stanley, Credit Suisse, and so on. As a researcher and trader in these august institutions, I had always strived to use some of the advanced mathematical techniques and training that I possessed and applied them to statistical arbitrage trading. Hundreds of millions of dollars of trades later, what was the result? Losses, more losses, and losses as far as the eye can see, for my employers and their investors. Finally, I quit the financial industry in frustration, set up a spare bedroom in my home as my trading office, and started to trade the simplest but still quantitative strategies I know. These are strategies that any smart high school student can easily research and execute. For the first time in my life, my trading strategies became profitable (one of which is described in Example 3.6), and has been the case ever since. The lesson I learned? A famous quote, often attributed to Albert Einstein, sums it up: “Make everything as simple as possible. But not simpler.”
(Stay tuned: I will detail more reasons why independent traders can beat institutional money managers at their own game in Chapter 8.)
Though I became a quantitative trader through a fairly traditional path, many others didn't. Who are the typical independent quantitative traders? Among people I know, they include a former trader at a hedge fund that has gone out of business, a computer programmer who used to work for a brokerage, a former trader at one of the exchanges, a former investment banker, a former biochemist, and an architect. Some of them have received advanced technical training, but others have only basic familiarity of high school–level statistics. Most of them backtest their strategies using basic tools like Excel, though others hire programming contractors to help. Most of them have at some point in their career been professionally involved with the financial world but have now decided that being independent suits their needs better. As far as I know, most of them are doing quite well on their own, while enjoying the enormous freedom that independence brings.
Besides having gained some knowledge of finance through their former jobs, the fact that these traders have saved up a nest egg for their independent venture is obviously important, too. When one plunges into independent trading, fear of losses and of being isolated from the rest of the world is natural, and so it helps to have both a prior appreciation of risks and some savings to lean on. It is important not to have a need for immediate profits to sustain your daily living, as strategies have intrinsic rates of returns that cannot be hurried (see Chapter 6).
Instead of fear, some of you are planning to trade because of the love of thrill and danger, or an incredible self-confidence that instant wealth is imminent. This is also a dangerous emotion to bring to independent quantitative trading. As I hope to persuade you in this chapter and in the rest of the book, instant wealth is not the objective of quantitative trading.
The ideal independent quantitative trader is therefore someone who has some