以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 高级功能研发区 (http://weistock.com/bbs/list.asp?boardid=5) ---- 有没有自动补充数据的行情函数? (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=172561) |
-- 作者:vonhayek -- 发布时间:2019/10/22 19:37:24 -- 有没有自动补充数据的行情函数? 有没有自动补充数据的行情函数? 调用时自带了最近半小时的数据? 开盘之后将连续运行几个小时, 只需要在开盘前补充一次数据? 盘中还需要做啥吗? 要是盘中还需要不停的手工干预补充, 那就有点麻烦了. -------------------- arr = history_bars(\'SZ300016\', 500, \'1m\', [\'datetime\', \'close\', \'volume\'], True, True, False) arr = history_bars_date(\'SZ300016\', \'2019-10-22 09:31:00\', \'2019-10-22 15:00:00\', \'1m\', [\'datetime\', \'close\', \'volume\']) if len(arr) > 0: arr[:, 0] -= 2.0191022e13 print([arr, len(arr)]) [array([[1.42800000e+05, 9.14000034e+00, 6.69050000e+04], [1.42900000e+05, 9.14999962e+00, 1.35100000e+03], [1.43000000e+05, 9.15999985e+00, 1.82400000e+03], [1.43100000e+05, 9.17000008e+00, 5.56000000e+02], [1.43200000e+05, 9.17000008e+00, 1.17700000e+03], [1.43300000e+05, 9.15999985e+00, 3.74000000e+02], [1.43400000e+05, 9.14999962e+00, 3.09000000e+02], [1.43500000e+05, 9.15999985e+00, 4.16000000e+02], ................................... [1.45200000e+05, 9.14999962e+00, 4.24000000e+02], [1.45300000e+05, 9.15999985e+00, 2.27000000e+02], [1.45400000e+05, 9.15999985e+00, 4.30000000e+02], [1.45500000e+05, 9.17000008e+00, 3.67000000e+02], [1.45600000e+05, 9.18000031e+00, 9.94000000e+02], [1.45700000e+05, 9.18999958e+00, 6.59000000e+02], [1.45800000e+05, 9.18999958e+00, 1.10000000e+01], [1.50000000e+05, 9.18999958e+00, 1.24000000e+03]]), 32]
|
-- 作者:vonhayek -- 发布时间:2019/10/22 19:49:38 -- 经常手工补充数据, 导致不能全自动化. 希望能改进为自动补充. 而且经常没有数据也不做任何提醒, 有时返回空array, 有时返回0.
|
-- 作者:yukizzc -- 发布时间:2019/10/22 22:18:18 -- 你只要第一次补充过后就行了,后面每天做好自动收盘当天的数据在盘后都会保存下来不需要再次补充了 |
-- 作者:vonhayek -- 发布时间:2019/10/23 15:06:30 -- from datetime import datetime as dt # arr = history_bars(\'SH603477\', 500, \'1m\', [\'datetime\', \'close\', \'volume\'], # True, True, False) arr = history_bars_date(\'SH603477\', dt(2019, 10, 23, 9, 31), dt(2019, 10, 23, 10, 15), \'1m\', [\'datetime\', \'close\', \'volume\'], True, True, True) # if len(arr) > 0: arr[:, 0] -= 2.019e13 print([arr, len(arr)]) ~~~~~~~~~~~~ 15:03:15 > [array([[1.01111210e+09, 1.01499996e+01, 3.85000000e+02], [1.01111220e+09, 1.01199999e+01, 5.40000000e+02], [1.01111230e+09, 1.01300001e+01, 1.50000000e+02], ..., [1.02314560e+09, 1.68400002e+01, 3.00000000e+01], [1.02314570e+09, 1.68400002e+01, 7.20000000e+01], [1.02315000e+09, 1.68400002e+01, 4.51000000e+02]]), 1712] 我只想要今天开盘的分钟数据, 怎么出来怎么多? |
-- 作者:vonhayek -- 发布时间:2019/10/23 15:54:14 -- from datetime import datetime as dt arr = history_bars(\'SH603477\', 240, \'1m\', [\'datetime\', \'close\', \'volume\'], True, True, True) # arr = history_bars_date(\'SH603477\', dt(2019, 10, 23, 9, 31), # dt(2019, 10, 23, 10, 15), \'1m\', # [\'datetime\', \'close\', \'volume\'], True, True, True) # if len(arr) > 0: arr[:, 0] -= 2.0191023e13 print([arr, len(arr)]) ~~~~~~~~~~ 15:51:21 > [array([[-8.57300000e+05, 1.53100004e+01, 1.00000000e+01], [-8.57200000e+05, 1.53100004e+01, 8.00000000e+00], [-8.56800000e+05, 1.53100004e+01, 1.00000000e+00], [-8.56700000e+05, 1.53100004e+01, 2.90000000e+01], [-8.56600000e+05, 1.53100004e+01, 1.00000000e+00], [-8.56400000e+05, 1.53100004e+01, 2.00000000e+00], [-8.56300000e+05, 1.53100004e+01, 2.00000000e+00], [-8.56100000e+05, 1.53100004e+01, 5.00000000e+00], ................................... [ 1.45100000e+05, 1.68400002e+01, 3.60000000e+01], [ 1.45200000e+05, 1.68400002e+01, 6.30700000e+03], [ 1.45300000e+05, 1.68400002e+01, 1.08600000e+03], [ 1.45400000e+05, 1.68400002e+01, 1.67000000e+02], [ 1.45500000e+05, 1.68400002e+01, 1.34000000e+02], [ 1.45600000e+05, 1.68400002e+01, 3.00000000e+01], [ 1.45700000e+05, 1.68400002e+01, 7.20000000e+01], [ 1.50000000e+05, 1.68400002e+01, 4.51000000e+02]]), 56] 补充过1分钟数据了, 也重启了软件. 我期望出来的数据是今天的, 但结果总是带有前几天的, 为啥? |
-- 作者:vonhayek -- 发布时间:2019/10/23 18:10:09 -- 原来是有些分钟成交量等于0, 已解决. |