%matplotlib inline
%time from hikyuu.interactive.interactive import *
std::cout are redirected to python::stdout std::cerr are redirected to python::stderr [2019-03-28 21:06:57.166] [trace] SQLITE3: c:\stock/stock.db [2019-03-28 21:06:57.168] [info] Loading market information... [2019-03-28 21:06:57.170] [info] Loading stock type information... [2019-03-28 21:06:57.172] [info] Loading stock information... [2019-03-28 21:07:01.286] [info] Loading KData... [2019-03-28 21:07:01.298] [info] Preloading all day kdata to buffer! [2019-03-28 21:07:11.410] [info] 10.1222s Loaded Data. Wall time: 16.8 s
使用 create_figure 函数快速创建查看证券K线信息的常见组合窗口
help(create_figure)
Help on function create_figure in module hikyuu.interactive.drawplot: create_figure(n=1, figsize=None) 生成含有指定坐标轴数量的窗口,最大只支持4个坐标轴。 :param int n: 坐标轴数量 :param figsize: (宽, 高) :return: (ax1, ax2, ...) 根据指定的坐标轴数量而定,超出[1,4]个坐标轴时,返回None
#不同坐标轴数量,其显示窗口布局
create_figure(figsize=(6,4))
create_figure(2, figsize=(6,4))
create_figure(3, figsize=(6,4))
create_figure(4, figsize=(6,4))
(<matplotlib.axes._axes.Axes at 0x13c9e6a3710>, <matplotlib.axes._axes.Axes at 0x13c9e6c9cc0>, <matplotlib.axes._axes.Axes at 0x13c9e6fc128>, <matplotlib.axes._axes.Axes at 0x13c9e723550>)
s = sm['sh000001']
k = s.getKData(Query(-200))
#创建两个显示坐标轴的窗口
ax1,ax2 = create_figure(2)
#在第一个坐标轴中绘制K线和EMA
k.plot(axes=ax1)
ma = EMA(CLOSE(k))
ma.plot(axes=ax1, legend_on=True)
#在第二个坐标轴中绘制艾尔德力度指标
v = VIGOR(KDATA(k))
v.plot(axes=ax2, legend_on=True)
ax1,ax2, ax3 = create_figure(3)
k.plot(axes=ax1)
ma.plot(axes=ax1, legend_on=True)
ax_draw_macd(axes=ax2, kdata=k)
ax_draw_macd2(axes=ax3, ref=ma, kdata=k)
el.draw(s)
vl.draw(s)
vl.draw2(s)
kf.draw(s)
kf.draw2(blocka)