等级: 免费版
- 注册:
- 2021-6-2
- 曾用名:
|
1 在Python策略目录下的程序,提取数据,一开始,只有80个,需要1500个源码输出见下
def DDD(tbar,hh,zq='15m',ss=1):
cAr15 = {}
for i in np.array(["ZJIC00","ZJIF00","ZJIH00"]):
cAr15[i] = history_bars(i, 1500, '15m','close')
print([i,len(cAr15[i])])
def handle_bar(context):
# 开始编写你的主要的算法逻辑。
DDD(tbar=3,hh=[0,0,0,0,0],zq='15m', ss=1)
pass
信息窗口》(按5分钟回测输出)
08:30:27 > ['ZJIC00', 80]
08:30:28 > ['ZJIF00', 80]
08:30:28 > ['ZJIH00', 80]
08:30:28 > ['ZJIC00', 80]
08:30:28 > ['ZJIF00', 80]
08:30:28 > ['ZJIH00', 80]
08:30:28 > ['ZJIC00', 81]
08:30:28 > ['ZJIF00', 81]
08:30:28 > ['ZJIH00', 81]
08:30:28 > ['ZJIC00', 81]
08:30:28 > ['ZJIF00', 81]
08:30:28 > ['ZJIH00', 81]
08:30:28 > ['ZJIC00', 81]
08:30:28 > ['ZJIF00', 81]
08:30:28 > ['ZJIH00', 81]
2 在我的模块里,再写相应代码,编译可以正常获得数据
from PythonApi import *
import numpy as np
def DDD():
cAr = {}
for i in np.array(["ZJIC00","ZJIF00","ZJIH00"]):
cAr[i] = history_bars(i, 1500, '15m','close')
print([i,cAr[i],len(cAr[i])])
DDD()
输出
> 开始编译 <jzt_MyPython1> ......
>
08:29:32 > ['ZJIC00', array([7041.31591797, 7016.5859375 , 7017.57519531, ..., 6363. ,
6366.39990234, 6368.39990234]), 1500]
08:29:32 > ['ZJIF00', array([4876.66162109, 4865.89746094, 4865.49902344, ..., 4269.20019531,
4270.60009766, 4268. ]), 1500]
08:29:32 > ['ZJIH00', array([3251.3984375 , 3245.76000977, 3244.9543457 , ..., 2939. ,
2944.19995117, 2940.60009766]), 1500]
> 编译成功!
请问是什么原因,怎么解决呢?谢谢
|
|