#original from http://www.traineetrader.com/importing-stock-data-from-yahoo-using-python/ #modified by http://www.neuralmarkettrends.com (NMT) import ystockquote #added the matplotlib (NMT) import matplotlib.pyplot as plt # Get Quotes 01/01/2006 - 01/01/2009 GOOG = ystockquote.get_historical_prices('GOOG', '20100101', '20101203') # Create empty lists, quick and dirty GOOGOpen = [ ] GOOGClose = [ ] GOOGDate = [ ] GOOGHigh = [ ] GOOGLow = [ ] GOOGAdj = [ ] GOOGVolume = [ ] # Populate lists from downloaded data for i in range(1, 225): GOOGDate.append(GOOG[i][0]) GOOGOpen.append(GOOG[i][1]) GOOGHigh.append(GOOG[i][2]) GOOGLow.append(GOOG[i][3]) GOOGClose.append(GOOG[i][4]) GOOGVolume.append(GOOG[i][5]) GOOGAdj.append(GOOG[i][6]) #adjusted the plotting functions and added plt.show() (NMT) plt.plot(GOOGAdj) plt.title('Google Adjusted Close') plt.ylabel('GOOG Closing Price ($USD)') plt.xlabel('Date') plt.grid(True) plt.show()