The Motley Fool Discussion Boards

Previous Page

Investing/Strategies / Mechanical Investing


Subject:  Re: Another S&P 500 screen Date:  4/23/2021  10:40 PM
Author:  Rayvt Number:  281055 of 281789

If no one comes through with a source for actual data, a crude guesstimate of standard deviation often used by statisticians in the absence of complete data is the high-low range divided by 6.

Since we only care about ranking, "high-low" is adequate.

Fidelity shows the next quarter high-low range, but scraping for them manually stock-by-stock would be pain.

Lots of sites have that data--without having to log in to your account.

I was able to write a Linux bash script. Once I had a list of the symbols, 3 lines to dowload the 12 month price data, 6 lines to compute the 12-month returns (could have been 4 with awk), 1 line to get the top 125, 4 lines to compute the figure of merit "(hi-low)/whatever", then 1 line to sort and print the top 25.

All a simple bash script, using curl, sed, awk, and html2text. Only took me part of the afternoon, most time spent figuring out which data to scrape.

I shudder to think of trying to do this by hand.
Copyright 1996-2021 trademark and the "Fool" logo is a trademark of The Motley Fool, Inc. Contact Us