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

Control panel

Having variables disseminated across a notebook is a source of errors. All parameters, variables, websites, lists, and Booleans are centralized in one place before processing the data. This is where you will adjust settings if desired:

website = 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies'
params = ['2014-12-31', None, 63, 0.05, 0.05, 1.5, 2,5,2.5,3]
start,end,vlty_n,dist_pct,retrace_pct,threshold,dgt,d_vol,r_vol,lvl= [params[h] for h in range(len(params))]
rel_var = ['^GSPC','SP500', 'USD']
bm_ticker, bm_col, ccy_col = [rel_var[h] for h in range(len(rel_var))]
window = 100
st= fast = 50
lt = slow = 200
batch_size = 20
show_batch = True
save_ticker_df = False
save_last_row_df = False
save_regime_df = False
web_df_cols = ['Symbol','Security','GICS Sector','GICS Sub-Industry']
regime_cols = ['rg','rrg',
    'smaC'+str(st)+str(lt),&apos...