Algorithmic Short-Selling with Python: Refine your algorithmic trading edge, consistently generate investment ideas, and build a robust long/short product

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Leverage Python source code to revolutionize your short selling strategy and to consistently make profits in bull, bear, and sideways markets Key Features • Understand techniques such as trend following, mean reversion, position sizing, and risk management in a short-selling context • Implement Python source code to explore and develop your own investment strategy • Test your trading strategies to limit risk and increase profits Book Description If you are in the long/short business, learning how to sell short is not a choice. Short selling is the key to raising assets when the markets are down. This book will help you demystify and rehabilitate the short-selling craft, providing Python source code to construct a robust long/short portfolio. It explains everything you have ever read about short selling from a long-only perspective. This book will take you on a journey from an idea (“buy bullish stocks, sell bearish ones”) to becoming part of the elite club of long/short hedge fund algorithmic traders. You’ll explore key concepts such as trading psychology, trading edge, regime definition, signal processing, position sizing, risk management, and asset allocation, one obstacle at a time. Along the way, you’ll will discover simple methods to consistently generate investment ideas, and consider variables that impact returns, volatility, and overall attractiveness of returns. By the end of this book, you’ll not only become familiar with some of the most sophisticated concepts in capital markets, but also have Python source code to construct a long/short product that investors are bound to find attractive. What you will learn • Develop the mindset required to win the infinite, complex, random game called the stock market • Demystify short selling in order to make consistent profits from bull, bear, and sideways markets • Generate ideas consistently on both sides of the portfolio • Implement Python source code to engineer a statistically robust trading edge • Perform superior risk management for high returns • Build a long/short product that investors will find appealing Who This Book Is For This is a book by a practitioner for practitioners. It is designed to benefit a wide range of people, including long/short market participants, quantitative participants, proprietary traders, commodity trading advisors, retail investors (pro retailers, students, and retail quants), and long-only investors. At least 2 years of active trading experience, intermediate-level experience of the Python programming language, and basic mathematical literacy (basic statistics and algebra) are expected.

Author(s): Laurent Bernut
Edition: 1
Publisher: Packt Publishing
Year: 2021

Language: English
Commentary: Vector PDF
Pages: 376
City: Birmingham, UK
Tags: Python; Best Practices; Trading; Strategy; Investment; Portfolio Management; Algorithmic Trading

Cover
Copyright
Foreword
Contributors
Table of Contents
Preface
Chapter 1: The Stock Market Game
Is the stock market art or science?
How do you win this complex, infinite, random game?
How do you win an infinite game?
How do you beat complexity?
How do you beat randomness?
Playing the short selling game
Summary
Chapter 2: 10 Classic Myths About Short Selling
Myth #1: Short sellers destroy pensions
Myth #2: Short sellers destroy companies
Myth #3: Short sellers destroy value
Myth #4: Short sellers are evil speculators
Myth #5: Short selling has unlimited loss potential but limited profit potential
Myth #6: Short selling increases risk
Myth #7: Short selling increases market volatility
Myth #8: Short selling collapses share prices
Myth #9: Short selling is unnecessary during bull markets
Myth #10: The myth of the "structural short"
Summary
Chapter 3: Take a Walk on the Wild Short Side
The long side world according to GARP
Structural shorts: the unicorns of the financial services industry
Overcoming learned helplessness
Money "is" made between events that "should" happen
The unique challenges of the short side
Market dynamics: short selling is not a stock-picking contest, but a position-sizing exercise
Scarcity mentality
Asymmetry of information
Stock options and transparency
Sell-side analysts are the guardians of the financial galaxy
Summary
Chapter 4: Long/Short Methodologies: Absolute and Relative
Importing libraries
Long/Short 1.0: the absolute method
Ineffective at decreasing correlation with the benchmark
Ineffective at reducing volatility
Little, if any, historical downside protection
Lesser investment vehicle
Laggard indicator
Long/Short 2.0: the relative weakness method
Consistent supply of fresh ideas on both sides
Focus on sector rotation
Provides a low-correlation product
Provides a low-volatility product
Reduces the cost of borrow fees
Provides scalability
Non-confrontational
Currency adjustment becomes an advantage
Other market participants cannot guess your levels
You will look like an investment genius
Summary
Chapter 5: Regime Definition
Importing libraries
Creating a charting function
Breakout/breakdown
Moving average crossover
Higher highs/higher lows
The floor/ceiling method
Swing detection
Historical swings and high/low alternation
Establishing trend exhaustion
Putting it all together: regime detection
Regime definition
Methodology comparison
Timing the optimal entry point after the bottom or the peak
Seeing through the fundamental news flow
Recognizing turning points
Let the market regime dictate the best strategy
Summary
Chapter 6: The Trading Edge is a Number, and Here is the Formula
Importing libraries
The trading edge formula
Technological edge
Information edge
Statistical edge
A trading edge is not a story
Signal module: entries and exits
Entries: stock picking is vastly overrated
Exits: the transmutation of paper profits into real money
Regardless of the asset class, there are only two strategies
Trend following
Mean reversion
Summary
Chapter 7: Improve Your Trading Edge
Blending trading styles
The psychology of the stop loss
Step 1: Accountability
Step 2: Rewire your association with losses
Step 3: When to set a stop loss
Step 4: Pre-mortem: the vaccine against overconfidence
Step 5: Executing stop losses: forgiving ourselves for mistakes
Step 6: What the Zeigarnik effect can teach us about executing stop losses
The science of the stop loss
Stop losses are a logical signal-to-noise issue
Stop losses are a statistical issue
Stop losses are a budgetary issue
Techniques to improve your trading edge
Technique 1: The game of two halves: how to cut losers, ride winners, and maintain conviction while improving your trading edge
Technique 2: Mitigate losses with a trailing stop
Technique 3: the game of two-thirds: time exit and how to trim freeloaders
Technique 4: The profit side: reduce risk and compound returns by taking small profits
Technique 5: Elongate the right tail
Technique 6: Re-entry: Ride your winners by laddering your positions
Final exit: the right tail
Re-entry after a final exit
How to tilt your trading edge if your dominant style is mean reversion
Losses
Profits
Partial exit
Exits
Summary
Chapter 8: Position Sizing: Money is Made in the Money Management Module
Importing libraries
The four horsemen of apocalyptic position sizing
Horseman 1: Liquidity is the currency of bear markets
Horseman 2: Averaging down
Horseman 3: High conviction
Horseman 4: Equal weight
Position sizing is the link between emotional and financial capital
A position size your brain can trade
Establishing risk bands
Equity curve oscillator – avoiding the binary effect of classic equity curve trading
Comparing position-sizing algorithms
Refining your risk budget
Risk amortization
False positives
Order prioritization and trade rejection
Game theory in position sizing
Summary
Chapter 9: Risk is a Number
Importing libraries
Interpreting risk
Sharpe ratio: the right mathematical answer to the wrong question
Building a combined risk metric
The Grit Index
Common Sense Ratio
Van Tharp's SQN
Robustness score
Summary
Chapter 10: Refining the Investment Universe
Avoiding short selling pitfalls
Liquidity and market impact
Crowded shorts
The fertile ground of high dividend yield
Share buybacks
Fundamental analysis
What do investors really want?
Lessons from the 2007 quants debacle
The Green Hornet complex of the long/short industry
Lessons from Bernie Madoff
Summary
Chapter 11: The Long/Short Toolbox
Importing libraries
Gross exposure
Portfolio heat
Portfolio heat bands
Tactical deployment
Step-by-step portfolio heat and exposure management
Net exposure
Net beta
Three reasons why selling futures is the junk food of short-selling
Selling futures is a bet on market cap
Selling futures is a bet on beta
Selling futures is an expensive form of laziness
Concentration
Human limitation
Hedges are not tokens
The paradox of low-volatility returns: structural negative net concentration
Practical tips about concentration
Average number of names
Ratio of big to small bets
Keep your powder dry
Other exposures
Sector exposure
Exchange exposure
Factor exposures
Design your own mandate
Step 1: Strategy formalization
The signal module
The money management module
Step 2: Investment objectives
Step 4: Design your own mandate: product, market, fit
Step 5: Record keeping
Entry
Exits
Position sizing
Journaling
Step 5: Refine your mandate
Summary
Chapter 12: Signals and Execution
Importing libraries
Timing is money: the importance of timing orders
Order prioritization
Relative prices and absolute execution
Order types
Exits
Stop loss
Pre-mortem
The Zeigarnik effect
Profitable exits
Entry
Rollover: the aikido of bear market rallies
Moving averages
Retracements
Retest
Putting it all together
Summary
Chapter 13: Portfolio Management System
Importing libraries
Symptoms of poor portfolio management systems
Ineffective capital allocation
Undermonitored risk detection
High volatility
High correlation
Poor exposure management
Your portfolio management system is your Iron Man suit
Clarity: bypass the left brain
Relevance: the Iron Man auto radio effect
Simplicity: complexity is a form of laziness
Flexibility: information does not translate into decision
Automating the boring stuff
Building a robust portfolio management system
Summary
Appendix: Stock Screening
Import libraries
Define functions
Control panel
Data download and processing
Heatmaps
Individual process
Other Books You May Enjoy
Index