Starship Troopers

For a start, here are three “alpha” apps for pairs trading the S&P 500, all to be part of a future platform or dashboard for long/short stock picking powered by data-science engineering.

For fun, I decided to name the series of apps after science fiction spaceships from books (not movies) from my youth.  All use the tidyquant and tidyverse libraries for R, and all are hosted by the platform at RStudio.

As a portfolio manager at a hedge fund, I was often asked to hedge my ideas with stocks that traded similarly and were at good entry points for pairs trading.  These tools help answer the thorny questions that arise when hedging: is this a good pair?  and is this a good time to enter that pair trade?

Lazy Eight: allows for filtering and sorting by z score, weekly returns relative, and daily returns relative to index and sector.

https://jedgore.shinyapps.io/lazy_eight/

Separately, if you have a single stock to hedge, you can compare it specifically with its peers using, er, Drunkard’s Walk (with a nod to the EMH):

https://jedgore.shinyapps.io/drunkards_walk/

Lastly, if you find a pair trade you like, you can see the history of its trading on a z score chart using Far Star:

https://jedgore.shinyapps.io/far_star/

I plan to add backtesting charts to Far Star (trades initiated at standard deviation limits) as an analytical supplement to the r-squared which appears on the lower right of the z score chart.

What’s next?  Hot Needle of Inquiry (again from Larry Niven, who really does have the best ship names) will attempt calculate sector-based correlations for use as identifying the expected return on assuming stock-picking long/short risk.  After that I want to tackle more factor-based analysis and more sentiment analysis.

Please report bugs to jed at sentieo.com!  I will be expanding these ideas in coming weeks.

Here is an Excel Workbook which shows the calcs for Lazy Eight for AAPL.  Did this to test the code but it also shows in Excel form what’s going on under the hood.

Sources:
Far Star
Drunkard’s Walk – “Grendel,” a short story in Larry Niven’s short story collection Neutron Star
Lazy Eight I – Larry Niven’s novel World of Ptavvs

 

Leave a comment