1. Obtaining the universe of stocks
The universe of US stocks is comprised of the members of the
- S&P 500
- S&P 400
- Barron’s 400 (updated in March and September)
This results in a list of about 1050 distinct values.
I’m using BeautifulSoup and Selenium to automatically parse these sources and create the current list of stocks.
2. Performing the calculations
Iterating through the stocks in the list created in step 1, the calculations and sorting are done in Python.
The results are written in a csv file.
I rely primarily on pandas, numpy, and scipy.stats.
3. Generating the Excel output file
To make the result more appealing to the eye and to add some formatting, I’m using pandas and XlsxWriter.
For example, in my own version of the file, all current holdings are colour-coded and a list of to-dos (what to buy/sell) is generated automatically.
4. Reporting
Additional reporting and journaling is done with pandas.