Update backtesting.py

This commit is contained in:
1122455801 2019-06-10 23:45:08 +08:00
parent ace002609a
commit 127e863c3b

View File

@ -328,9 +328,11 @@ class BacktestingEngine:
"""""" """"""
self.output("开始计算策略统计指标") self.output("开始计算策略统计指标")
if not df: # Check DataFrame input exterior
if df is None:
df = self.daily_df df = self.daily_df
# Check for init DataFrame
if df is None: if df is None:
# Set all statistics to 0 if no trade. # Set all statistics to 0 if no trade.
start_date = "" start_date = ""
@ -474,9 +476,11 @@ class BacktestingEngine:
def show_chart(self, df: DataFrame = None): def show_chart(self, df: DataFrame = None):
"""""" """"""
if not df: # Check DataFrame input exterior
if df is None:
df = self.daily_df df = self.daily_df
# Check for init DataFrame
if df is None: if df is None:
return return