Relative Rotation: Tech Is Rotating Positive, Financials, Healthcare and Real Estate Rotating Downwards

Relative rotation is an interesting approach to see what is hot and what is not.

The JdK RS-Ratios can be calculated for the S&P 500 index.

UccdH

So what is leading? Tech. What is weakening? Real estate. Healthcare is in the bottom left quadrant.

Screen Shot 2019-04-24 at 9.08.38 AM.png

The Python code?


def rs_ratio(prices_df, benchmark, window=10):
from numpy import mean, std
for series in prices_df:
rs = (prices_df[series].divide(benchmark)) * 100
rs_ratio = rs.rolling(window).mean()
rel_ratio = 100 + ((rs_ratio - rs_ratio.mean()) / rs_ratio.std() + 1)
prices_df[series] = rel_ratio
prices_df.dropna(axis=0, how='all', inplace=True)
return prices_df

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.