date
2013-07-01 53.10917319
2013-07-02 54.31224742
2013-07-03 54.61204262
2013-07-05 54.17338125
2013-07-08 53.86579916
...
2017-06-26 143.57270901
2017-06-27 141.51491885
2017-06-28 143.58255490
2017-06-29 141.46568942
2017-06-30 141.80044954
Name: AAPL, Length: 1009, dtype: float64
# project_helper
import plotly.offline as offline_py
import plotly.graph_objs as go
def plot_stock(prices, title):
config = generate_config()
layout = go.Layout(title=title)
stock_trace = _generate_stock_trace(prices)
offline_py.iplot({'data': [stock_trace], 'layout': layout}, config=config)
def generate_config():
return {'showLink': False, 'displayModeBar': False, 'showAxisRangeEntryBoxes': True}
def _generate_stock_trace(prices):
return go.Scatter(
name='Index',
x=prices.index,
y=prices,
line={'color': helper.color_scheme['major_line']})