def before_trading(context):
today=str(context.now)[:11].replace(" ", "")
if(today in [\'2020-07-27\']):
context.codes = get_blocks("沪深300样本股",1)
cnt = 0
nocnt = 0
highDict = {}
for i in context.codes:
if(\'000001\' in str(i)):
cnt += 1
highList = history_bars(i,25,\'year\',\'HIGH\',True,True,True)
if(len(highList)>0):
logger.info(str(cnt) + \'-\' + str(i) + \'_\' + str(highList))
high = max(highList)
highDict[i] = high
logger.info(high)
输出信息:
16:00:08 > 1-SZ000001_[ 0.64467478 2.53604126 6.06175756 4.53776789 5.49017811 4.03022337
3.75728083 3.51919174 3.08429384 2.57084537 1.66653919 3.31052732
12.15398884 11.04231262 8.64829731 7.95268059 6.14731216 5.75259018
8.05435848 10.3441391 13.56143665 9.3225193 14.59305477 14.4877243
17.30486107]
16:00:08 > 17.304861068725586
这个是是对的,SZ000001最高值是17.30
把if(\'000001\' in str(i)):改成if(\'000063\' in str(i)): 看000063这之股
输出信息:
16:04:10 > 1-SZ000063_[ 1.53820026 2.61544085 4.40728521 4.45009995 4.22399759 3.40352678
3.11243248 5.2818327 6.94574118 10.63704014 15.33628368 18.77048302
19.59446526 21.30210114 22.41457748 14.54691029 14.79070854 15.72560978
28.19568443 18.48200226 41.38999939 38.90000153 38.5 ]
16:04:10 > 41.38999938964844
最高值是41.39 跟K线对不上,这个是错的。 我把1990年到现在的日K数据,60天的分钟数据都下载了。不应该是数据问题啊,复权和不复权的数据都对不上
![dvubb 图片点击可在新窗口打开查看](skins/default/filetype/png.gif)
此主题相关图片如下:1.jpg
![dvubb 图片点击可在新窗口打开查看](UploadFile/2020-7/202072916131491652.png)