Skip to content

Instantly share code, notes, and snippets.

@shashankvemuri
Created September 13, 2020 19:25
Show Gist options
  • Save shashankvemuri/01a06416cddd5622795e808e638afdb0 to your computer and use it in GitHub Desktop.
Save shashankvemuri/01a06416cddd5622795e808e638afdb0 to your computer and use it in GitHub Desktop.
correlation
dataset = pdr.get_data_yahoo(tickers, start, end)['Adj Close']
stocks_returns = np.log(dataset/dataset.shift(1))
print('\nCorrelation Matrix')
corr_matrix = stocks_returns.corr()
print (corr_matrix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment