Book Image

Algorithmic Short Selling with Python

By : Laurent Bernut
Book Image

Algorithmic Short Selling with Python

By: Laurent Bernut

Overview of this book

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 under management. This book will help you demystify and hone the short selling craft, providing Python source code to construct a robust long/short portfolio. It discusses fundamental and advanced trading concepts from the perspective of a veteran short seller. 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.
Table of Contents (17 chapters)
14
Other Books You May Enjoy
15
Index

To get the most out of this book

Sometimes we win, sometimes we learn. The best disposition to get the maximum out of this book is to have lost money on the markets. This will put you in an open state of mind!

Intermediate knowledge of Python, specifically the use of numpy, pandas, and matplotlib will suffice. We will also use some non-standard Python libraries; yfinance and scipy. High school level competence in algebra and statistics is also necessary.

Download the example code files

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Algorithmic-Short-Selling-with-Python. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781801815192_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example; "From the rolling_profits and rolling_losses functions, calculate profit_ratio."

A block of code is set as follows:

# Import Libraries
import pandas as pd
import numpy as np
import yfinance as yf
%matplotlib inline
import matplotlib.pyplot as plt

Any command-line input or output is written as follows:

3.52

Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "Did the price beat the volume at weighted average price (VWAP) or not?"

Warnings or important notes appear like this.

Tips and tricks appear like this.