mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-06 20:41:09 +08:00
Remove useless code to pass pylint
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
# Licensed under the MIT License.
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import pickle
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@@ -12,8 +11,6 @@ from qlib.config import REG_CN
|
|||||||
from qlib.contrib.ops.high_freq import BFillNan, Cut, Date, DayCumsum, DayLast, FFillNan, IsInf, IsNull, Select
|
from qlib.contrib.ops.high_freq import BFillNan, Cut, Date, DayCumsum, DayLast, FFillNan, IsInf, IsNull, Select
|
||||||
from qlib.data.dataset import DatasetH
|
from qlib.data.dataset import DatasetH
|
||||||
|
|
||||||
_dataset = None
|
|
||||||
|
|
||||||
|
|
||||||
class LRUCache:
|
class LRUCache:
|
||||||
def __init__(self, pool_size: int = 200):
|
def __init__(self, pool_size: int = 200):
|
||||||
@@ -58,8 +55,6 @@ class DataWrapper:
|
|||||||
def get(self, stock_id: str, date: pd.Timestamp, backtest: bool = False):
|
def get(self, stock_id: str, date: pd.Timestamp, backtest: bool = False):
|
||||||
start_time, end_time = date.replace(hour=0, minute=0, second=0), date.replace(hour=23, minute=59, second=59)
|
start_time, end_time = date.replace(hour=0, minute=0, second=0), date.replace(hour=23, minute=59, second=59)
|
||||||
|
|
||||||
dataset = self.backtest_dataset if backtest else self.feature_dataset
|
|
||||||
|
|
||||||
if backtest:
|
if backtest:
|
||||||
dataset = self.backtest_dataset
|
dataset = self.backtest_dataset
|
||||||
cache = self.backtest_cache
|
cache = self.backtest_cache
|
||||||
@@ -75,8 +70,6 @@ class DataWrapper:
|
|||||||
|
|
||||||
|
|
||||||
def init_qlib(config: dict, part: Optional[str] = None) -> None:
|
def init_qlib(config: dict, part: Optional[str] = None) -> None:
|
||||||
global _dataset
|
|
||||||
|
|
||||||
provider_uri_map = {
|
provider_uri_map = {
|
||||||
"day": config["provider_uri_day"].as_posix(),
|
"day": config["provider_uri_day"].as_posix(),
|
||||||
"1min": config["provider_uri_1min"].as_posix(),
|
"1min": config["provider_uri_1min"].as_posix(),
|
||||||
@@ -113,26 +106,3 @@ def init_qlib(config: dict, part: Optional[str] = None) -> None:
|
|||||||
redis_port=-1,
|
redis_port=-1,
|
||||||
clear_mem_cache=False, # init_qlib will be called for multiple times. Keep the cache for improving performance
|
clear_mem_cache=False, # init_qlib will be called for multiple times. Keep the cache for improving performance
|
||||||
)
|
)
|
||||||
|
|
||||||
# this won't work if it's put outside in case of multiprocessing
|
|
||||||
|
|
||||||
if part is None:
|
|
||||||
feature_path = config["feature_root_dir"] / "feature.pkl"
|
|
||||||
backtest_path = config["feature_root_dir"] / "backtest.pkl"
|
|
||||||
else:
|
|
||||||
feature_path = config["feature_root_dir"] / "feature" / (part + ".pkl")
|
|
||||||
backtest_path = config["feature_root_dir"] / "backtest" / (part + ".pkl")
|
|
||||||
|
|
||||||
with feature_path.open("rb") as f:
|
|
||||||
print(feature_path)
|
|
||||||
feature_dataset = pickle.load(f)
|
|
||||||
with backtest_path.open("rb") as f:
|
|
||||||
backtest_dataset = pickle.load(f)
|
|
||||||
|
|
||||||
_dataset = DataWrapper(
|
|
||||||
feature_dataset,
|
|
||||||
backtest_dataset,
|
|
||||||
config["feature_columns_today"],
|
|
||||||
config["feature_columns_yesterday"],
|
|
||||||
_internal=True,
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user