I've installed Enthought's EPD (64 bit for Windows 7).
I'm trying to plot historical stock quote data using Yahoo's API. All the code I'm trying to use is on this blog post: http://www.traineetrader.com/importing-stock-data-from-yahoo-using-python/
The ystockquote.py file works fine.
But the second script to plot Google's historical stock quote doesn't work for me. This is the code (from the website):
import ystockquote
# Get Quotes 01/01/2006 - 01/01/2009
GOOG = ystockquote.get_historical_prices('GOOG', '20060101', '20090101')
# Create empty lists, quick and dirty
GOOGOpen = [ ]
GOOGClose = [ ]
GOOGDate = [ ]
GOOGHigh = [ ]
GOOGLow = [ ]
GOOGAdj = [ ]
GOOGVolume = [ ]
# Populate lists from downloaded data
for i in range(1, 755):
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])
plot(GOOGAdj)
title("Google Adjusted Close")
ylabel(r"GOOG Closing Price ($USD)", fontsize = 12)
xlabel(r"Date", fontsize = 12)
grid(True)
I get the following error:
NameError: name 'plot' is not defined
Any tips on what I'm doing wrong? Or how to get this to run? If I include "from pylab import *" at the top of the code, I don't get the error, but nothing happens.
ipython --pylab
, it loads the pylab stuff automatically, and also uses some tricks so the console doesn't block when plot windows are open. – Thomas K Oct 18 '11 at 12:16