From 6b8824dd298c33872a1364057204b5871b79444a Mon Sep 17 00:00:00 2001 From: "Yifan Deng (FA Talent)" Date: Mon, 14 Dec 2020 16:09:21 +0800 Subject: [PATCH] Update Sign in ops.py --- qlib/data/ops.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qlib/data/ops.py b/qlib/data/ops.py index 72cfa4520..8c7699fb8 100644 --- a/qlib/data/ops.py +++ b/qlib/data/ops.py @@ -144,7 +144,11 @@ class Sign(ElemOperator): super(Sign, self).__init__(feature, "sign") def _load_internal(self, instrument, start_index, end_index, freq): + """ + To avoid error raised by bool type input, we transform the data into float32. + """ series = self.feature.load(instrument, start_index, end_index, freq) + # TODO: More precision types should be configurable series = series.astype(np.float32) return getattr(np, self.func)(series)