我是用来控制国内期货的自动启停的,可能一天也可以正常运行,但是偶尔会出现以下问题,什么原因
Traceback (most recent call last): File “”, line 982, in init_ctx File “”, line 119, in File “”, line 65, in main File “”, line 27, in api URLError:
部分代码如下: if currentime()>0.2100 and currentime()<0.2359 and currentwday()!=6 and currentwday()!=0 and status==False:#非周末每天8点55到3点01开启机器人 status=True LogStatus(“0.2100–0.2359,Restart”) robotftrade=api(‘RestartRobot’,RobotFTrade) Log(“robotftrade执行启动,api==”,robotftrade) swtradetrade=api(‘RestartRobot’,swTrade) Log(“swtradetrade执行启动,api==”,swtradetrade) Sleep(10000) if currentime()<0.0855 or currentwday()==6 or currentwday()==0 and status==True :#小于8点55或者是星期六或者星期天停止机器人 status=False LogStatus(“0.0000–0.900 or weekend,StopRobot”) robotftrade=api(‘StopRobot’,RobotFTrade) Log(“robotftrade执行停止,api==”,robotftrade) swtradetrade=api(‘StopRobot’,swTrade) Log(“swtradetrade执行停止,api==”,swtradetrade) Sleep(10000)