From c217e7c479a09eb41a57f9f26a23dcf0ad2332c5 Mon Sep 17 00:00:00 2001 From: Yifan Deng Date: Mon, 14 Dec 2020 01:35:03 +0800 Subject: [PATCH] Update ops.py Fix the bug when Sign followed by True/False --- qlib/data/ops.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qlib/data/ops.py b/qlib/data/ops.py index e17c0e4e6..72cfa4520 100644 --- a/qlib/data/ops.py +++ b/qlib/data/ops.py @@ -143,6 +143,11 @@ class Sign(ElemOperator): def __init__(self, feature): super(Sign, self).__init__(feature, "sign") + def _load_internal(self, instrument, start_index, end_index, freq): + series = self.feature.load(instrument, start_index, end_index, freq) + series = series.astype(np.float32) + return getattr(np, self.func)(series) + class Log(ElemOperator): """Feature Log