mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-10 22:36:55 +08:00
fix
This commit is contained in:
@@ -24,48 +24,6 @@ from qlib.data.data import Cal
|
|||||||
|
|
||||||
from highfreq_ops import DayFirst, DayLast, FFillNan, Date, Select, IsNull
|
from highfreq_ops import DayFirst, DayLast, FFillNan, Date, Select, IsNull
|
||||||
|
|
||||||
|
|
||||||
def save_dataset(dataset, path: [Path, str]):
|
|
||||||
"""
|
|
||||||
save dataset to path
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
path : [Path, str]
|
|
||||||
path to save
|
|
||||||
"""
|
|
||||||
dataset.to_pickle(path=path)
|
|
||||||
|
|
||||||
|
|
||||||
def load_dataset(path: [Path, str], init_type=DataHandlerLP.IT_LS):
|
|
||||||
"""
|
|
||||||
load dataset from path
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
path : [Path, str]
|
|
||||||
path to load
|
|
||||||
|
|
||||||
init_type : str
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- if `init_type` == DataHandlerLP.IT_LS:
|
|
||||||
|
|
||||||
The state of the object has been load by pickle
|
|
||||||
"""
|
|
||||||
fd = open(path, "rb")
|
|
||||||
dataset = pickle.load(fd)
|
|
||||||
dataset.init(init_type=init_type)
|
|
||||||
fd.close()
|
|
||||||
return dataset
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
# use default data
|
# use default data
|
||||||
@@ -78,7 +36,7 @@ if __name__ == "__main__":
|
|||||||
auto_mount=False,
|
auto_mount=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
MARKET = "test_10"
|
MARKET = "all"
|
||||||
BENCHMARK = "SH000300"
|
BENCHMARK = "SH000300"
|
||||||
|
|
||||||
start_time = "2019-01-01 00:00:00"
|
start_time = "2019-01-01 00:00:00"
|
||||||
|
|||||||
Reference in New Issue
Block a user