-
-
Save quantra-go-algo/695b42d11e7e570bc7db6f9ef7e55dca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import statsmodels.regression.linear_model as lm | |
import statsmodels.tools.tools as ct | |
# Jensen’s alpha’s performance metric data | |
returns = pd.read_csv(‘Data_file_link’, index_col=’Date’, parse_dates=True) | |
# Jensen’s alpha’s performance metric calculation | |
returns.loc[:CT’] = ct.add_constant(returns) | |
# Using risk free rate of ticker and risk free rate of market for calculating Jensen’s alpha | |
alphaj = lm.OLS(returns[‘TICKER-RF’], returns[[‘CT’, ‘MKT-RF’]], hasconst=bool).fit() | |
print (‘Jensen Alpha Linear Regression Summary’) | |
print(alphaj.summary()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment