Книга: Algorithmic Short Selling With Python
Назад: Part 1: The Short Selling Game
Дальше: Chapter 2: 10 Classic Myths About Short Selling

1

The Stock Market Game

"Life is a game of time; use it well."

– Epictetus, (apocryphal attribution)

The financial services industry is facing a severe existential crisis. The way the asset management industry has traditionally been working does not seem to be working well these days. Evolution does not take prisoners. If active managers do not want to go join the bluefin tuna on the list of endangered species, then maybe learning to sell short would be an invaluable skill to add to their arsenal. As the global financial crisis of 2007-2008 and the Corona pandemic of 2020 showed us, it's crucial for market participants to be capable of generating profits not only in bull but also in bear markets. To that end, this book will cover the ins and outs of short selling and develop algorithmic strategies to maximize its effectiveness, with the end goal of creating a robust investment product that will set you apart from your market competitors.

This chapter sets the stage for the book. This chapter will set the mindset necessary to successfully navigate the markets. The stock market is a game. It has no beginning and no end. It is complex. The paradox of making money in the markets is to accept losses. At some point in your career, you have probably wondered whether the market was more of a science or an art form. What if the market was a perpetual unsolvable puzzle?

We will cover the following topics:

Your purchase includes a free PDF copy + exclusive extras

Your purchase includes a DRM-free PDF copy of this book, 7-day trial to the Packt+ library (no credit card required), and additional exclusive extras. See the Free benefits with your book section in the Preface to unlock them instantly and maximize your learning.

Is the stock market art or science?

"When bankers get together for dinner, they discuss art. When artists get together for dinner, they discuss money."

– Oscar Wilde, (apocryphal attribution)

Once upon a time, Lorenzo de Medici praised Michelangelo for the quality of his craftsmanship. Il Divino replied to il Magnifico, "it appears as art only to those who have not worked hard enough to see the craft." (Beautiful story, and yet probably apocryphal as well.)

Every market participant has wondered whether the stock market was more of an art than a science. The assumption behind art is the notion of innate talent. Some naturals are born gifted. Some aren't, and I am one of those. If talent is innate, then we mere mortals have to resign ourselves to the fact that we simply do not have it. However, talent is often an excuse for laziness. Michael Jordan was not a natural. He was thrown out of his basketball team, so he trained, and would not go home until he landed 100 free throws. Landed 98? Oops. Do it again. This way, skills can be developed. The output might look like effortless grace. Yet, it takes craft, hard work, perseverance, and something Angela Duckworth calls grit.

Making money on the markets is not art. It is a skill. In the early 80s, Richard Dennis and William Eckhardt assembled an eclectic team with people from all walks of life, including a poker player and even a drug dealer. They were given a system, starting capital, and sent off to trade futures. Decades later, some of these people, such as Jerry Parker, founder of Chesapeake Capital, still trade. Michael Covel has extensively written about the experiment in his trend following book series. The experiment even inspired a movie with Dan Akroyd and Eddie Murphy aptly named "Trading Places." Were they talented? Maybe some of them had some predispositions, but it did not matter. They worked on and at a system, the result of which might have looked like art.

Scientists like to explain the world with definitive formulas. This approach works well for simple and even complicated systems (which can usually be broken down into several simple systems) but not for complex systems:

Markets are complex systems. Complex systems can't be reduced to simple ones. The moment you think you have a definitive formula that explains stock prices, ceteris paribus, the markets will adapt and morph into something else.

The point I'm trying to make is that we do not see things as they are. We see things as we think they are. Context filters our perception. If we think something is going to be hard, it is probably not going to be easy.

If we think the stock market is an art, we will marvel at the masterpiece but fail to appreciate the craft. If we think of it as a science, we will look for a definitive formula, only to be fooled by randomness time and again. If we see it as a game, then the child in us will play.

Next, let's introduce this complex, infinite, random game called the stock market.

How do you win this complex, infinite, random game?

"Infinite games have infinite time horizons. And because there is no finish line, no practical end to the game, there is no such thing as "winning" an infinite game. In an infinite game, the primary objective is to keep playing, to perpetuate the game."

– Simon Sinek

Share prices may reflect fundamentals over time, but the journey is likely to be a random walk. The random walk theory was popularized by Burton Malkiel in A Random Walk Down Wall Street. It essentially postulates that every financial asset has an intrinsic value, yet market prices are hard to accurately predict. Randomness routinely throws market participants off. When even the best of the best in the business succeed roughly 50% of the time, the only conclusion is that randomness cannot be eradicated.

There are two types of games: finite and infinite. A finite game has a clear set of rules, participants, a beginning, a middle, and an end. An infinite game has no set rules, no beginning, and no end. The objective of a finite game is to win the game. The objective of an infinite game is to stay in the game.

Let's illustrate this with an example. A professional poker player meets a professional trader. The trader plays risky hands throughout the night and wins the game. The next day, the poker player buys a stock the trader recommended. The trader stops out the trade two weeks later, while the gambler forgets about it and doubles his money over the next 3 years. For the trader, poker is a hobby, and he won the poker night because he knew he could afford more risk. Meanwhile, the poker player took calculated risks. He accepted the short-term loss as part of winning the long-term game. When the poker player followed the investment tip, he rode it through the ups and downs, as he was merely using a disposable asset. On the other hand, when the trader closed the same stock and missed the ensuing rally, he was executing risk management.

For the trader, the poker night was a finite game. On the other hand, the stock tip was a finite game for the poker player. They both could afford a higher risk tolerance in each other's games because they knew the game was finite. However, when a game turns from a hobby to a livelihood, the game turns from finite to infinite. We want to stay in the game for as long as possible and thus become more risk-averse.

Jack Schwager, best-selling author of the Market Wizards series, often says that no sane person would buy a book on surgery, read it over the weekend, and believe they would be ready to operate on someone's head by Monday. Yet, people buy books on investment, subscribe to a couple of newsletters, and think it is perfectly reasonable to start trading by Monday. It may work for amateurs with a very small sample. After all, there is a 50-50 chance of winning. The same randomness that favors the amateurs hurts the pros who have a much larger sample. The game becomes infinite the moment a hobby turns into work. The gambler may have budgeted for a few bad poker nights a year. Similarly, the trader follows a tight risk management policy. Poker players and star traders have one thing in common: they go to work; it is not supposed to be fun.

This leads us to the central question of this book: how do you stay in an infinite complex random game?

Let's start with how to win a game that has no end in sight.

How do you win an infinite game?

"The game of life is the game of everlasting learning. At least, it is if you want to win."

– Charlie Munger

If you are in an infinite game, you don't win by winning one game or all the games. You win by staying in the game. You win some, you lose some, but you get to stay in the game as long as your average wins multiplied by your win rate exceeds your average loss multiplied by your loss rate. You win as long as your gain expectancy stays positive. Your job as a stock picker, trader, investor, speculator, or whatever you choose to call yourself, is to maximize that gain expectancy. That is the part where, out of all the stocks you picked, the ones you keep need to look good, the result of which may eventually look like art. This is what we are going to work on further along the book, so keep reading, Michelangelo.

Next, let's see how you can beat complexity with simplicity.

How do you beat complexity?

"Genius is making complex ideas simple, not making simple ideas complex."

– Albert Einstein

When faced with a complex problem, we intuitively believe the solution must be complicated. Not always. The trajectory of a fast projectile, such as a tennis ball rebounding on the court, for instance, is rocket science, quite literally. Now, when was the last time you saw Serena Williams solving stochastic equations by the side of the court? This is called the gaze heuristic: see, run, intercept, repeat. The example of Serena Williams shows that complex problems often have simple solutions.

Many quantitative traders, affectionately referred to as quants, believe they need to justify their PhDs with convoluted equations. Proof by mathematical intimidation undoubtedly strokes the ego, and yet a high IQ does not rhyme with high performance. The stock market is the place where Nobel prize winners go to get humbled.

On the other hand, it appears there is a simple heuristic hiding in plain sight that beats the complexity of the market. This simple mantra is: "cut your losers short, let your winners run."

Next, we are going to deal with the stress of randomness.

How do you beat randomness?

"When an investor focuses on short-term investments, he or she is observing the variability of the portfolio, not the returns—in short, being fooled by randomness."

– Nassim Nicholas Taleb

As a species, our survival has depended on how we deal with randomness. The same survival mechanism we instinctively apply in daily life does not transfer to the markets. Understanding randomness is critical to the development of a healthy short selling practice. First, let us look at how we approach randomness in the markets. Second, let us look at how we deal with randomness in real life. Third, we will see how we can apply this skill to the markets.

Let us say we design a system to pick stocks. When we build a strategy, we start with some assumptions. If stocks meet certain expectations [insert laundry list of criteria here…], we go long or short. In theory, rich valuations, far above reasonable market expectations, revert to fair, fair valuation being the price some market participants are willing to pay for the value they perceive. In theory, bad businesses are expected to go bust. In theory, overbought and oversold stocks are expected to revert to the mean. In theory, this should work. Now, it is time to take the idea for a spin. Signals can be summarized in the outcome matrix below:

A group of ovals with different colored circles    Description automatically generated

Figure 1.1: Figurative matrix outcome

True positives are when signals are generated and performed as expected. True negatives occur when stocks did not pass our test and went on to exhibit poor performance as predicted. This is when theory has its first encounter with reality. In theory, markets are efficient: all publicly available information should be reflected in the price immediately. In practice, this is not always the case.

Back to the drawing board, the presence of false positives, when signals were generated but did not perform as expected (for example, stocks passed our tests but flopped in practice), suggests we have missed something. In practice, valuations can get, and remain rich longer than clients will stay invested. As John Maynard Keynes famously said, "markets can remain irrational longer than you can stay solvent". Overbought and oversold technical indicators are signs of sustained strength and weakness, respectively. They indicate the continuation of a trend rather than a reversion to the mean. We grow confused and frustrated. Our natural inclination is to refine our thesis, adding layers of complexity to reduce false positives. This approach generates fewer signals, yet false positives do not disappear entirely.

A side effect and classic pitfall for intermediate short sellers of over-filtering are false negatives. This is when stocks exhibit desired behavior but go completely undetected as a result of our more stringent tests. A real-life analogy is dating by checklist. Sometimes people show up with a long laundry list of unattainable standards and unrealistic expectations. In the same way, market participants reject good enough ideas because of their own self-limiting belief systems. They essentially seek reassurance that their pick will perform as expected by applying superfluous filters, but they fail to see that some of those conditions are mutually exclusive or unrealistic. As a result, they systematically hold themselves out of the market and miss all the perfectly fine opportunities passing them by. This explains the bloated size of the false negative circle in Figure 1.1.

Structural/crowded shorts are classic examples of over-filtering. They tick all the bad boxes, except obvious trades are rarely profitable. Conversely, high dividend yield value traps are classic examples of false negatives or blind spots. Those stocks have cheap valuations and dividend support. They do not participate in bull markets. They do not provide adequate support in prolonged bear phases either. They are slow-burning underperformers, relegated to the purgatory of forgotten issues. The bottom line is, despite all the best efforts, some stocks still fail to be profitable, on the short and long sides. This is a lot more complex than we originally thought. More confusion. Back to the drawing board again.

Continuing with the dating by checklist scenario, one way to beat randomness is as follows. On paper, a person ticks all the boxes. In practice, big red flags pop up: that person does not laugh at your jokes, hates broccoli, and stubbornly refuses to debate Kant's "critique of pure reason" with your goldfish—all the classic important stuff.

In real life, you deal with this seemingly random response by aborting the mission. You don't wait until you are married with a couple of kids in tow, a dead goldfish in a bowl, and a mountain of green vegetables rotting in the fridge to break up. It's the same with the markets. A stock might tick all the boxes, but something unforeseen or overlooked pops up and you bail. When we focus all our energy on stock picking, we try to solve randomness with certainty. Trying harder next time to pick the right stock does not solve randomness. Perfectionism is a form of procrastination. The only way to deal with randomness is to accept our fallibility. The faster we fail, the faster we move on.

Let's illustrate this concept with a practical example. We can all agree that stocks underperforming their benchmark have peaked out relative to the index. Within the population that has hit a ceiling, there are 100% of the future underperformers (which would be our key target for short selling) plus some stocks that will meander sideways and go nowhere until they trend again. There is simply no easy way to discriminate the former from the latter a priori. There are, however, simple techniques to deal with freeloaders a posteriori. The way to beat randomness is not to try to be a better stock picker. The way to beat randomness is to accept that at one point or another, you will pick losers and learn how to deal with them. People see all those great market wizards for the few picks that worked well. They do not look at all the ones that were discarded along the way. We have it backward. We want the medal before the race. Great stock pickers should be judged on what they choose to keep, rather than the less profitable picks they discard along the way.

Now that we have explained the nature of the stock market game, let's see how we can play the mixed martial arts tournament of short-selling.

Playing the short selling game

"Follow me if you want to live."

– Arnold Schwarzenegger, Terminator

The mechanics of short selling are deceptively simple. For example, you sell a stock at 100, buy it back at 90, and pocket the 10. It works in absolute or relative to a benchmark. There is only one additional step that needs to take place before the short sale. Short sellers deliver shares they do not own. So, they borrow those shares from a stock lending desk with their brokerage house first. Once they buy the shares back and close the trade, they return those shares.

Do not let that simplicity fool you. Due to the infinite, complex, and random nature of the game that we have considered in this chapter, 90% of market participants fail. That is the unapologetic reality of the markets. Of the remaining 10%, fewer than half will ever engage in short selling. Simply picking up this book and applying its principles already sets you apart. When the going gets tough, remember that you had the courage to step up and learn a skill most people would never even contemplate.

Our objective is to navigate these challenges and succeed on both sides of the portfolio, despite the complexity. If we travel down the same road as everybody else, we will end up with the same results, plus or minus one standard deviation for good measure.

If virtually everyone fails on the forgiving abundance of the long side, then for you to survive on the merciless aridity of the short side, this book must be intentionally different. This book will take you on a road far less traveled. You might disagree with parts of it, but you will come out transformed. For example, you may entertain the idea that stock picking is overrated. You will also get to see for yourself exactly where the money is generated within the investment process.

The postulate of this book is that short-selling is a game best played algorithmically.

Short selling is an algorithmic sport

Counter-intuitive though it may sound, short-selling is a sport that is best played quantitatively. If 90% of market participants solely focus on buying, no broker in shining armor is going to gallop to the rescue of short sellers in distress anytime soon. This means that short sellers must do their own research. Firstly, algorithms or algos make it easy to plow through vast quantities of data. Recent advances in artificial intelligence and large language models make it even easier to digest more qualitative data.

Secondly, algos partially remove the emotional agony of execution in adverse times. If the strategies have been properly tested, then all we have to do is execute signals. We have to trust the process. As we will see in subsequent chapters, herein lies the rub for those who optimized rather than stress tested their strategies.

Thirdly, well-conceived algos incorporate position sizing and risk management. This is particularly important on the short side. Short selling is not a stock picking contest, but a risk management exercise.

Fourthly, multiple strategies can be run concurrently. There is virtually no limitation other than capital as to the number of uncorrelated strategies that can be deployed simultaneously.

In this chapter, we set the context for the rest of the book. The stock market is neither an art form nor a science. Market wizards are not born, nor do they need to be supremely intelligent. They are forged in the crucible of adversity. The stock market is an infinite, complex, random game. The only way to win this game is to stay in it, by adapting your strategy to the market's infinite, complex, random nature, and to pick stocks and cut losses accordingly. Short selling is a quantitative sport. In the coming chapters, we will consider how to incorporate short selling into your trading strategy and implement techniques to improve your success rate and gain expectancy.

Market participants are generally less comfortable selling short than buying long. This is down to a number of technical factors, but also because of a general fear of the practice, propagated by the number of myths related to short selling. We will discuss and disprove these in the next chapter.

Summary

This chapter established that the market cannot be "won" in the traditional sense. Instead, success lies in staying in the game. You have learned that the stock market is neither an art nor a science; it is a dynamic puzzle that rewards adaptability, discipline, and risk management.

We explored the distinction between finite and infinite games. While finite games have defined rules and winners, infinite games have no defined players, rules, and no end game. The key to thriving in this game is understanding randomness, cutting losses quickly, and letting winners run. You learned that perfection in stock picking is futile. Over-filtering inevitably leads to missed opportunities. Instead, success comes from managing false positives and negatives effectively.

The chapter also demystified short selling. It explains its mechanics and why it's critical for navigating bear markets. You now understand that short selling is not a stock picking contest but an exercise in risk management. It's a quantitative sport where algorithms can process data, remove emotion, and incorporate position sizing for better outcomes.

In summary, this chapter laid the groundwork for treating the market as a game of resilience, where the focus is on managing risk and staying in the game.

In the next chapter, we will dispel a few myths about short selling.

Get this book's PDF version and more

Scan the QR code (or go to ). Search for this book by name, confirm the edition, and then follow the steps on the page.

Image

Image

Note: Keep your invoice handy. Purchases made directly from Packt don't require an invoice.

Назад: Part 1: The Short Selling Game
Дальше: Chapter 2: 10 Classic Myths About Short Selling