From 13a9b7cea053e90036af6b6565375bd8c8c2a541 Mon Sep 17 00:00:00 2001 From: Young Date: Fri, 20 Aug 2021 09:50:47 +0000 Subject: [PATCH] type error bug --- qlib/backtest/report.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qlib/backtest/report.py b/qlib/backtest/report.py index 84ae4d5d4..6272258b7 100644 --- a/qlib/backtest/report.py +++ b/qlib/backtest/report.py @@ -392,8 +392,10 @@ class Indicator: if isinstance(price_s, pd.Series): price_s = IndexData(price_s.values, list(price_s.index)) - if isinstance(price_s, (int, float)): + elif isinstance(price_s, (int, float, np.floating)): price_s = IndexData([price_s], [trade_start_time]) + else: + raise NotImplementedError(f"This type of input is not supported") # NOTE: there are some zeros in the trading price. These cases are known meaningless # for aligning the previous logic, remove it.