Why don't you just use a datareader ?
import pandas.io.data as web aapl = web.DataReader("aapl", 'yahoo', '2010-1-1')['Adj Close'] aapl.plot(title='AAPL Adj Close');pd.rolling_mean(aapl, 50).plot();pd.rolling_mean(aapl, 200).plot()

To get more control over the graphics:
aapl = web.DataReader("aapl", 'yahoo', '2010-1-1')['Adj Close'] aapl.name = 'Adj Close' aapl_50ma = pd.rolling_mean(aapl, 50) aapl_50ma.name = '50 day MA' aapl_200ma = pd.rolling_mean(aapl, 200) aapl_200ma.name = '200 day MA' aapl.plot(title='AAPL', legend=True);aapl_50ma.plot(legend=True);aapl_200ma.plot(legend=True)

source share