I'm trying to calculate JDK - RS Ratio using python, however it seems it is not working well.
These are some articles that i've found on the internet, concerning JDK RS Ratio:
https://quant.stackexchange.com/questions/17963/how-to-calculate-the-jdk-rs-ratio
https://marginstone.com/how-to-create-a-relative-rotation-graph-on-excel/
This is my python code, using Taurus (TASA4) stock and Ibovespa (benchmark - ^BVSP) as an example:
df_tasa = pdr.get_data_yahoo(['^BVSP', 'TASA4.SA'], start_date, end_date)['Adj Close'].pct_change().dropna().reset_index()
df_tasa['price_relative'] = (df_tasa.iloc[:,2] / df_tasa.iloc[:,1]) * 100
df_tasa['price_relative_roll10_mean'] = df_tasa.price_relative.rolling(10).mean()
df_tasa['price_relative_roll10_std'] = df_tasa.price_relative.rolling(10).std() + 1
df_tasa['Jdk_rs_ratio'] = 100 + ((df_tasa.price_relative - df_tasa.price_relative_roll10_mean) / df_tasa.price_relative_roll10_std)
df_tasa['Jdk_rs_ratio'] = df_tasa['Jdk_rs_ratio'].round(2)
df_tasa.dropna(inplace=True)
df_tasa.tail()
The above code has returned the following table:

However, it's seems that my python code has some error because when i compared python daframe with RRG Software, i've saw that Taurus (TASA4) JDK Rs Ratio has ranged between 96 and 98.
The above beind said, could you please help me correctly calculate JDK RS Ratio?
Thanks in advance
