mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-13 07:46:53 +08:00
Merge remote-tracking branch 'origin/main' into finco
This commit is contained in:
@@ -27,7 +27,6 @@ class TestHFBacktest(TestAutoData):
|
||||
return pd.DataFrame(orders, columns=headers)
|
||||
|
||||
def test_trading(self):
|
||||
|
||||
# date = "2020-02-03"
|
||||
# inst = "SH600068"
|
||||
# pos = 2.0167
|
||||
|
||||
@@ -21,7 +21,6 @@ class TestHandler(DataHandlerLP):
|
||||
fit_end_time=None,
|
||||
drop_raw=True,
|
||||
):
|
||||
|
||||
infer_processors = check_transform_proc(infer_processors, fit_start_time, fit_end_time)
|
||||
learn_processors = check_transform_proc(learn_processors, fit_start_time, fit_end_time)
|
||||
|
||||
@@ -51,7 +50,6 @@ class TestHandler(DataHandlerLP):
|
||||
|
||||
|
||||
class TestHandlerStorage(TestAutoData):
|
||||
|
||||
market = "all"
|
||||
|
||||
start_time = "2010-01-01"
|
||||
@@ -82,7 +80,6 @@ class TestHandlerStorage(TestAutoData):
|
||||
)
|
||||
|
||||
with TimeInspector.logt("random fetch with DataFrame Storage"):
|
||||
|
||||
# single stock
|
||||
for i in range(100):
|
||||
random_index = np.random.randint(len(instruments), size=1)[0]
|
||||
@@ -96,7 +93,6 @@ class TestHandlerStorage(TestAutoData):
|
||||
data_handler.fetch(selector=(fetch_stocks, slice(fetch_start_time, fetch_end_time)), level=None)
|
||||
|
||||
with TimeInspector.logt("random fetch with HashingStock Storage"):
|
||||
|
||||
# single stock
|
||||
for i in range(100):
|
||||
random_index = np.random.randint(len(instruments), size=1)[0]
|
||||
|
||||
@@ -11,7 +11,6 @@ class SepDF(unittest.TestCase):
|
||||
return "".join(str(obj).split())
|
||||
|
||||
def test_index_data(self):
|
||||
|
||||
np.random.seed(42)
|
||||
|
||||
index = [
|
||||
|
||||
@@ -77,7 +77,6 @@ class TestRolling(TestAutoData):
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_update_label(self):
|
||||
|
||||
task = copy.deepcopy(CSI300_GBDT_TASK)
|
||||
|
||||
task["record"] = {
|
||||
|
||||
@@ -22,7 +22,6 @@ QLIB_DIR.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
class TestStorage(TestAutoData):
|
||||
def test_calendar_storage(self):
|
||||
|
||||
calendar = CalendarStorage(freq="day", future=False, provider_uri=self.provider_uri)
|
||||
assert isinstance(calendar[:], Iterable), f"{calendar.__class__.__name__}.__getitem__(s: slice) is not Iterable"
|
||||
assert isinstance(calendar.data, Iterable), f"{calendar.__class__.__name__}.data is not Iterable"
|
||||
|
||||
@@ -35,7 +35,7 @@ class TestDumpData(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
GetData().csv_data_cn(SOURCE_DIR)
|
||||
GetData().download_data(file_name="csv_data_cn.zip", target_dir=SOURCE_DIR)
|
||||
TestDumpData.DUMP_DATA = DumpDataAll(csv_path=SOURCE_DIR, qlib_dir=QLIB_DIR, include_fields=cls.FIELDS)
|
||||
TestDumpData.STOCK_NAMES = list(map(lambda x: x.name[:-4].upper(), SOURCE_DIR.glob("*.csv")))
|
||||
provider_uri = str(QLIB_DIR.resolve())
|
||||
|
||||
@@ -33,7 +33,6 @@ class TestGetData(unittest.TestCase):
|
||||
shutil.rmtree(str(DATA_DIR.resolve()))
|
||||
|
||||
def test_0_qlib_data(self):
|
||||
|
||||
GetData().qlib_data(
|
||||
name="qlib_data_simple", target_dir=QLIB_DIR, region="cn", interval="1d", delete_old=False, exists_skip=True
|
||||
)
|
||||
@@ -42,7 +41,7 @@ class TestGetData(unittest.TestCase):
|
||||
self.assertFalse(df.dropna().empty, "get qlib data failed")
|
||||
|
||||
def test_1_csv_data(self):
|
||||
GetData().csv_data_cn(SOURCE_DIR)
|
||||
GetData().download_data(file_name="csv_data_cn.zip", target_dir=SOURCE_DIR)
|
||||
stock_name = set(map(lambda x: x.name[:-4].upper(), SOURCE_DIR.glob("*.csv")))
|
||||
self.assertEqual(len(stock_name), 85, "get csv data failed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user