3.62K 浏览
0

运行系统自带的程序没有问题,运行自己写的程序总是报获取行情超时
程序异常:获取SHFE.bu1912的行情超时,请检查客户端及网络是否正常,且合约代码填写正确,line271
SYMBOL = ‘SHFE.bu1912’ # CZCE.SPD CF001&CF005
GRID_AMOUNT = 4
START_STD = 0
LENGTH = 60
api = TqApi()
grid_region_long = [1.5] * GRID_AMOUNT
grid_region_short = [1.5] * GRID_AMOUNT
grid_volume_longe = [i for i in range(GRID_AMOUNT+1)]
grid_volume_short = [i for i in range(GRID_AMOUNT+1)]
grid_std_long = [reduce(lambda x,y:x-y,grid_region_long[:i] , START_STD) for i in range(GRID_AMOUNT+1)]
grid_std_short = [reduce(lambda x,y:x+y,grid_region_long[:i] , START_STD) for i in range(GRID_AMOUNT+1)]

quote = api.get_quote(SYMBOL)
target_pos = TargetPosTask(api,SYMBOL)
Klines = api.get_kline_serial(SYMBOL,60*60)

0

这是你直接复制粘贴过来的源代码吗?SYMBOL后面的 ‘SHFE.bu1912’ 用了中文引号,应该换成英文符号

我重新下载了新的版本好像可以了。不知道是不是版本的问题。还有一个问题,如果我把合约换成 CZCE.SPD CF001&CF005 这样标准化价差合约。回测就会出错。是不是不支持标准版价差合约???