以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- python历史数据格式问题(history_bars) (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=167425) |
-- 作者:tristan -- 发布时间:2018/12/30 13:33:35 -- python历史数据格式问题(history_bars) 使用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的时间,怎么办? |
-- 作者:无为剑 -- 发布时间:2018/12/30 20:01:48 -- 为了方便做数值统计,该函数返回的类型是ndarray,日期时间格式是float类型的,不是你以为的datetime类型,你把数值转换到字符串应该就能看清楚了 |