My goal is to create a python script that will take a watch list and rank the stocks according to how well they perform under a particular strategy. What method would best accomplish this?
Unless I'm missing something, the ranking part is trivial. For each stock in your universe, calculate a metric for how it performs with your strategy. Sort best-to-worst by metric value. The rank of an individual stock is the position in the output. Example: for 800 ETFs, I calculate a daily Sharpe ratio for three years of price data (adjusted for splits and dividends): Code: mean (daily return proportion- daily risk-free return proportion) / sampleStandardDeviation(daily return proportion- daily risk-free return proportion) Symbols and Share ratio sorted on high-to-low Sharpe ratio are in the attached etf_sharpe_ratios.txt
Well, what you want to do is use your strategy on each stock to see how well it does. For example, if your strategy involves looking at moving averages (which is like an average price over a certain period), you could figure out how much money you would have made on average when the stock's price is higher than this moving average. It's like checking each stock to see how well it matches your game plan and then writing down the scores to compare them later.
These are TOP 200 stocks by activity (volume x price) Average 52W %FromHigh & %FromLow rank. I like TMUS Another way to rank stocks is by sharpe or efficiency ratio Over 3, 6 and / or 12 months.