Skip to content

Instantly share code, notes, and snippets.

Created Sep 27, 2020
What would you like to do?
Candlestick chart sample with DataFrame
from math import pi
from bokeh.plotting import figure
from import output_notebook, show
from bokeh.resources import INLINE
df_ = df[-100:-1].copy()
inc = df_.Close > df_.Open
dec = df_.Open > df_.Close
w = 12*60*60*1000
p = figure(x_axis_type="datetime", plot_width=800, plot_height=500, title = "Apple Inc stock price - 2020")
p.segment(df_.index, df_.High, df_.index, df_.Low, color="black")
p.vbar(df_.index[inc], w, df_.Open[inc], df_.Close[inc], fill_color="lawngreen", line_color="red")
p.vbar(df_.index[dec], w, df_.Open[dec], df_.Close[dec], fill_color="tomato", line_color="lime")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment