I am currently trying to pull high,low, and closing stock data from Yahoo finance, and graph it using Turtle. I was able to pull the data from the url into a list but I can't figure out how to graph it. I know the dates have to be the x-axis, and the values for high, low, and close data have to the Y-axis. I also know that high, low, and closing data have to be shown on three separate lines. Can anyone point me in the direction of how to do this?
def graphStock(symbol,start,end):
highList = []
lowList = []
closeList= []
dateList = []
url01 = 'http://ichart.finance.yahoo.com/table.csv?s=%s&' % symbol + \
'a=%s&' % str(int(start[4:6]) - 1) + \
'b=%s&' % str(int(start[6:8])) + \
'c=%s&' % str(int(start[0:4])) + \
'd=%s&' % str(int(end[4:6]) - 1) + \
'e=%s&' % str(int(end[6:8])) + \
'f=%s&' % str(int(end[0:4])) + \
'g=d&' + \
'ignore=.csv'
days = urllib.request.urlopen(url01).readlines()
data = [bytes.decode(day).split(',') for day in days]
for line in data[1:]:
date = line[0]
high = line[2]
low = line[3]
close = line[4]
if line in data:
dateList.append(date)
highList.append(high)
lowList.append(low)
closeList.append(close)
return graphStock