In [58]:
import pandas.io.data as pdweb
import datetime
In [ ]:
prices = pdweb.get_data_yahoo(['RAX','MSFT','GOOGL'],
start=datetime.datetime(2014, 1, 1),
end=datetime.datetime(2015, 1, 1))['Adj Close']
prices.head()
In [ ]:
volume = pdweb.get_data_yahoo(['RAX','MSFT','GOOGL'],
start=datetime.datetime(2014, 1, 1),
end=datetime.datetime(2015, 1, 1))['Volume']
In [ ]:
volume.head()
In [55]:
#Lets get the return
rets = prices.pct_change()
In [56]:
#Get the correlation of the stocks
corr = rets.corr
In [57]:
#Lets see the prices over time to get a very rough idea of the correlation between the stock prices
prices.plot()
Out[57]:
In [ ]: