In [1]:
%matplotlib inline
%time from hikyuu.interactive import *
std::cout are redirected to python::stdout
std::cerr are redirected to python::stderr
2021-02-12 17:03:43.490 [HKU-I] - Using SQLITE3 BaseInfoDriver (BaseInfoDriver.cpp:58)
2021-02-12 17:03:43.492 [HKU-I] - Loading market information... (StockManager.cpp:473)
2021-02-12 17:03:43.494 [HKU-I] - Loading stock type information... (StockManager.cpp:486)
2021-02-12 17:03:43.495 [HKU-I] - Loading stock information... (StockManager.cpp:422)
2021-02-12 17:03:43.578 [HKU-I] - Loading stock weight... (StockManager.cpp:503)
2021-02-12 17:03:44.859 [HKU-I] - Loading KData... (StockManager.cpp:138)
2021-02-12 17:03:44.864 [HKU-I] - Preloading all day kdata to buffer! (StockManager.cpp:161)
2021-02-12 17:03:44.889 [HKU-I] - 0.03s Loaded Data. (StockManager.cpp:149)
Wall time: 2.62 s

获取实时日线数据

目前仅支持获取实时日线数据,使用函数 realtimeUpdate(source, delta=60)。其中,source支持 'sina' | 'qq' | 'tushare',默认使用 tushare。

tushare 需安装 Python tushare 库,pip install tushare.

使用 sina 或 qq 时,应注意控制两次获取数据之间的间隔时长(使用参数delta,默认时长60s),以免 ip 被 sina 或 qq 列入黑名单。

In [2]:
%time realtime_update('sina')
更新完毕! 2021-02-12 17:03:51.398109
Wall time: 6.1 s
In [3]:
%time realtime_update('qq')
更新间隔小于60秒,未更新
上次更新时间:  2021-02-12 17:03:51.398109
Wall time: 999 µs
In [ ]: