# ローソク足も表示できるみたいです
# 移動平均の計算
ma_periods = [5, 10, 25, 50, 100, 200]
for n in ma_periods:
df['ma{}'.format(n)] = df['Adj Close'].rolling(n).mean().round()
# ドンチャンチャネルの計算
df['channel_upper'] = df['High'].rolling(100).max().round()
df['channel_lower'] = df['Low'].rolling(100).min().round()
# ロウソク足のぶんのデータの設定
df['Time'] = df.index.astype(np.int64)//10**6
series = [{'type':'candlestick',
'name':'candle',
'data':df[['Time', 'Open', 'High', 'Low', 'Close']].as_matrix().round()}]
# 移動平均のぶん
series += [{'type':'line',
'name':'ma{}d'.format(n),
'data':df[['Time', 'ma{}'.format(n)]].dropna().as_matrix()
} for n in ma_periods]
# チャネルのぶん
series += [{'type':'line',
'name': name,
'data': df[['Time', name]].dropna().as_matrix()
} for name in ['channel_upper', 'channel_lower']]
# こんなかんじでオプションが指定できるみたいです
options = {'rangeSelector':{'selected':0},
'xAxis':{'gridLineWidth':1, 'gridLineDashStyle':'Dot'},
'yAxis':{'gridLineWidth':1, 'gridLineDashStyle':'Dot'}}
# 初期表示するやつを指定
display = ['candle', 'ma100d', 'channel_upper', 'channel_lower']
charts.plot(series, stock=True, show='inline', options=options, display=display)