1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-09 05:50:59 +08:00

black format

This commit is contained in:
bxdd
2021-01-25 17:59:48 +00:00
parent ffedb6382f
commit 06dbd02b99
8 changed files with 34 additions and 19 deletions

View File

@@ -132,7 +132,7 @@ class CalendarProvider(abc.ABC):
_calendar_index = {x: i for i, x in enumerate(_calendar)} # for fast search
H["c"][flag] = _calendar, _calendar_index
return _calendar, _calendar_index
def _uri(self, start_time, end_time, freq, future=False):
"""Get the uri of calendar generation task."""
return hash_args(start_time, end_time, freq, future)

View File

@@ -87,7 +87,6 @@ class DatasetH(Dataset):
"""
super().__init__(handler, segments)
def init(self, init_type: str = DataHandlerLP.IT_FIT_SEQ, enable_cache: bool = False):
"""
Initialize the data of Qlib
@@ -98,7 +97,7 @@ class DatasetH(Dataset):
- if `init_type` == DataHandlerLP.IT_FIT_SEQ:
the input of `DataHandlerLP.fit` will be the output of the previous processor
- if `init_type` == DataHandlerLP.IT_FIT_IND:
the input of `DataHandlerLP.fit` will be the original df

View File

@@ -389,6 +389,7 @@ class DataHandlerLP(DataHandler):
if self.drop_raw:
del self._data
# init type
IT_FIT_SEQ = "fit_seq" # the input of `fit` will be the output of the previous processor
IT_FIT_IND = "fit_ind" # the input of `fit` will be the original df
@@ -431,7 +432,7 @@ class DataHandlerLP(DataHandler):
df = getattr(self, {self.DK_R: "_data", self.DK_I: "_infer", self.DK_L: "_learn"}[data_key])
except AttributeError:
print("please set drop_raw = False if you want to use raw data")
raise
raise
return df
def fetch(

View File

@@ -94,7 +94,9 @@ class DLWParser(DataLoader):
return exprs, names
@abc.abstractmethod
def load_group_df(self, instruments, exprs: list, names: list, start_time=None, end_time=None, freq="day") -> pd.DataFrame:
def load_group_df(
self, instruments, exprs: list, names: list, start_time=None, end_time=None, freq="day"
) -> pd.DataFrame:
"""
load the dataframe for specific group
@@ -148,7 +150,9 @@ class QlibDataLoader(DLWParser):
print("swap level", swap_level)
super().__init__(config)
def load_group_df(self, instruments, exprs: list, names: list, start_time=None, end_time=None, freq="day") -> pd.DataFrame:
def load_group_df(
self, instruments, exprs: list, names: list, start_time=None, end_time=None, freq="day"
) -> pd.DataFrame:
if instruments is None:
warnings.warn("`instruments` is not set, will load all stocks")
instruments = "all"