使用python获取历史数据,如果使用:bar_close=history_bars('RM05',bar_len,'1m',['datetime','volume','high','OPEN','CLOSE'])时得到结果为:
[[2.01812282e+13 1.44400000e+03 2.09900000e+03 2.09800000e+03 2.09900000e+03]
[2.01812282e+13 2.54000000e+03 2.09900000e+03 2.09800000e+03
2.09700000e+03]
[2.01812282e+13 5.60000000e+03 2.09900000e+03 2.09800000e+03
2.09700000e+03]]
为什么全部变成了这样?
如果获取的数据中不包括时间,如果:bar_close=history_bars('RM05',bar_len,'1m',['volume','high','OPEN','CLOSE'])
得到结果正常:
[[1444. 2099. 2098. 2099.]
[2540. 2099. 2098. 2097.]
[5600. 2099. 2098. 2097.]]
但我想得到每个K的时间,怎么办?
为了方便做数值统计,该函数返回的类型是ndarray,日期时间格式是float类型的,不是你以为的datetime类型,你把数值转换到字符串应该就能看清楚了