From 127e863c3b116c28ad9a46fa989e31cb66f81325 Mon Sep 17 00:00:00 2001 From: 1122455801 Date: Mon, 10 Jun 2019 23:45:08 +0800 Subject: [PATCH] Update backtesting.py --- vnpy/app/cta_strategy/backtesting.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vnpy/app/cta_strategy/backtesting.py b/vnpy/app/cta_strategy/backtesting.py index 115881cc..c63fda23 100644 --- a/vnpy/app/cta_strategy/backtesting.py +++ b/vnpy/app/cta_strategy/backtesting.py @@ -328,9 +328,11 @@ class BacktestingEngine: """""" self.output("开始计算策略统计指标") - if not df: + # Check DataFrame input exterior + if df is None: df = self.daily_df + # Check for init DataFrame if df is None: # Set all statistics to 0 if no trade. start_date = "" @@ -474,9 +476,11 @@ class BacktestingEngine: def show_chart(self, df: DataFrame = None): """""" - if not df: + # Check DataFrame input exterior + if df is None: df = self.daily_df - + + # Check for init DataFrame if df is None: return