[Mod] add error handle when querying history data from BybitGateway

This commit is contained in:
vn.py 2019-11-12 14:17:32 +08:00
parent 5753b87c31
commit 3cd0a23854

View File

@ -531,8 +531,16 @@ class BybitRestApi(RestClient):
break break
else: else:
data = resp.json() data = resp.json()
if not data:
ret_msg = data["ret_msg"]
if ret_msg != "ok":
msg = f"获取历史数据出错,错误信息:{ret_msg}"
self.gateway.write_log(msg)
break
if not data["result"]:
msg = f"获取历史数据为空,开始时间:{start_time},数量:{count}" msg = f"获取历史数据为空,开始时间:{start_time},数量:{count}"
self.gateway.write_log(msg)
break break
buf = [] buf = []