def plot_csv(stock_data, symbol):
"""
params:
- stock_data(list) : list of dict objects containing stock data
- name(str) : output file name specified by `-output` param.
"""
try:
df = pd.read_csv('{}.csv'.format(symbol))
except:
write_to_csv(stock_data, symbol)
df = pd.read_csv('{}.csv'.format(symbol))
p1 = figure(x_axis_type="datetime", title="Stock Closing Price")
p1.grid.grid_line_alpha = 0.3
p1.xaxis.axis_label = 'Date'
p1.yaxis.axis_label = 'Price'
p1.line(datetime(list(df['date'])), list(df['close']),
color='#A6CEE3', legend=symbol)
output_file("{}.html".format(symbol), title="Stock Closing Prices")
show(p1) # open a browser
评论列表
文章目录