In [1]:
import numpy as np
import pandas as pd
from kanichart import StockChart

np.random.seed(1)
data = (np.random.uniform(-0.1, 0.1, 500) + 1).cumprod()
data = pd.DataFrame(data, index=pd.date_range("2018-01-01", periods=500, freq="T"))
data = data.resample("5T").ohlc()
data.columns = data.columns.droplevel()
ma = data.close.rolling(window=3, ).mean()

stock = StockChart()
stock.add_chart('candlestick', 'RNDM', data)
stock.add_chart('line', 'RNDM_ma', ma, False)
stock.add_chart('candlestick', 'RNDM', data)
stock.plot()
Out[1]:
In [2]:
stock = StockChart()
stock.add_chart_from_jsonp('candlestick', 'OHLC', 'http://127.0.0.1:5004/ohlc')
stock.plot()
Out[2]: