From 4c3c80acb77e09e35fc5c4a360ce7a54163a15fe Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 19 Apr 2019 22:39:37 +0800 Subject: [PATCH] [Mod]clear thread handler when downloading data failed --- vnpy/app/cta_backtester/engine.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vnpy/app/cta_backtester/engine.py b/vnpy/app/cta_backtester/engine.py index b7267fe2..9da8e6f7 100644 --- a/vnpy/app/cta_backtester/engine.py +++ b/vnpy/app/cta_backtester/engine.py @@ -329,14 +329,14 @@ class BacktesterEngine(BaseEngine): symbol, exchange, Interval(interval), start, end ) - if not data: + if data: + database_manager.save_bar_data(data) + self.write_log(f"{vt_symbol}-{interval}历史数据下载完成") + else: self.write_log(f"数据下载失败,无法获取{vt_symbol}的历史数据") - database_manager.save_bar_data(data) - # Clear thread object handler. self.thread = None - self.write_log(f"{vt_symbol}-{interval}历史数据下载完成") def start_downloading( self,