From 0caa9a48a5a3c78ddbaa7684fd40cef036a3f112 Mon Sep 17 00:00:00 2001 From: Huoran Li Date: Tue, 26 Jul 2022 14:18:01 +0800 Subject: [PATCH] Pylint issue --- qlib/contrib/data/handler.py | 10 +++++----- qlib/rl/data/pickle_styled.py | 3 --- qlib/rl/utils/__init__.py | 3 ++- qlib/strategy/base.py | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/qlib/contrib/data/handler.py b/qlib/contrib/data/handler.py index d9d09dbff..5eae8b89d 100644 --- a/qlib/contrib/data/handler.py +++ b/qlib/contrib/data/handler.py @@ -284,7 +284,7 @@ class Alpha158(DataHandlerLP): fields += ["Rsquare($close, %d)" % d for d in windows] names += ["RSQR%d" % d for d in windows] if use("RESI"): - # The redisdual for linear regression for the past d days, represent the trend linearity for past d days. + # The redisdual for linear regression for the past d days, represent the trend linearity for past d days. fields += ["Resi($close, %d)/$close" % d for d in windows] names += ["RESI%d" % d for d in windows] if use("MAX"): @@ -297,7 +297,7 @@ class Alpha158(DataHandlerLP): names += ["MIN%d" % d for d in windows] if use("QTLU"): # The 80% quantile of past d day's close price, divided by latest close price to remove unit - # Used with MIN and MAX + # Used with MIN and MAX fields += ["Quantile($close, %d, 0.8)/$close" % d for d in windows] names += ["QTLU%d" % d for d in windows] if use("QTLD"): @@ -305,7 +305,7 @@ class Alpha158(DataHandlerLP): fields += ["Quantile($close, %d, 0.2)/$close" % d for d in windows] names += ["QTLD%d" % d for d in windows] if use("RANK"): - # Get the percentile of current close price in past d day's close price. + # Get the percentile of current close price in past d day's close price. # Represent the current price level comparing to past N days, add additional information to moving average. fields += ["Rank($close, %d)" % d for d in windows] names += ["RANK%d" % d for d in windows] @@ -316,14 +316,14 @@ class Alpha158(DataHandlerLP): if use("IMAX"): # The number of days between current date and previous highest price date. # Part of Aroon Indicator https://www.investopedia.com/terms/a/aroon.asp - # The indicator measures the time between highs and the time between lows over a time period. + # The indicator measures the time between highs and the time between lows over a time period. # The idea is that strong uptrends will regularly see new highs, and strong downtrends will regularly see new lows. fields += ["IdxMax($high, %d)/%d" % (d, d) for d in windows] names += ["IMAX%d" % d for d in windows] if use("IMIN"): # The number of days between current date and previous lowest price date. # Part of Aroon Indicator https://www.investopedia.com/terms/a/aroon.asp - # The indicator measures the time between highs and the time between lows over a time period. + # The indicator measures the time between highs and the time between lows over a time period. # The idea is that strong uptrends will regularly see new highs, and strong downtrends will regularly see new lows. fields += ["IdxMin($low, %d)/%d" % (d, d) for d in windows] names += ["IMIN%d" % d for d in windows] diff --git a/qlib/rl/data/pickle_styled.py b/qlib/rl/data/pickle_styled.py index 526adb657..07d53f411 100644 --- a/qlib/rl/data/pickle_styled.py +++ b/qlib/rl/data/pickle_styled.py @@ -88,9 +88,6 @@ def _read_pickle(filename_without_suffix: Path) -> pd.DataFrame: class IntradayBacktestData: - def __init__(self) -> None: - super(IntradayBacktestData, self).__init__() - @abstractmethod def __repr__(self) -> str: raise NotImplementedError diff --git a/qlib/rl/utils/__init__.py b/qlib/rl/utils/__init__.py index 158381608..7c7ba205d 100644 --- a/qlib/rl/utils/__init__.py +++ b/qlib/rl/utils/__init__.py @@ -4,7 +4,7 @@ from .data_queue import DataQueue from .env_wrapper import EnvWrapper, EnvWrapperStatus from .finite_env import FiniteEnvType, vectorize_env -from .log import ConsoleWriter, CsvWriter, LogCollector, LogLevel, LogWriter +from .log import ConsoleWriter, CsvWriter, LogBuffer, LogCollector, LogLevel, LogWriter __all__ = [ "LogLevel", @@ -17,4 +17,5 @@ __all__ = [ "ConsoleWriter", "CsvWriter", "EnvWrapperStatus", + "LogBuffer", ] diff --git a/qlib/strategy/base.py b/qlib/strategy/base.py index 5e61221a8..27df347fc 100644 --- a/qlib/strategy/base.py +++ b/qlib/strategy/base.py @@ -3,7 +3,7 @@ from __future__ import annotations from abc import ABCMeta, abstractmethod -from typing import Any, Generator, Optional, TYPE_CHECKING +from typing import Any, Generator, Optional, TYPE_CHECKING, Union if TYPE_CHECKING: from qlib.backtest.exchange import Exchange