mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-11 14:56:55 +08:00
update tests
This commit is contained in:
@@ -7,6 +7,9 @@ from ..config import REG_CN
|
|||||||
|
|
||||||
|
|
||||||
class TestAutoData(unittest.TestCase):
|
class TestAutoData(unittest.TestCase):
|
||||||
|
|
||||||
|
_setup_kwargs = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls) -> None:
|
def setUpClass(cls) -> None:
|
||||||
# use default data
|
# use default data
|
||||||
@@ -17,4 +20,4 @@ class TestAutoData(unittest.TestCase):
|
|||||||
GetData().qlib_data(
|
GetData().qlib_data(
|
||||||
name="qlib_data_simple", region="cn", version="latest", interval="1d", target_dir=provider_uri
|
name="qlib_data_simple", region="cn", version="latest", interval="1d", target_dir=provider_uri
|
||||||
)
|
)
|
||||||
init(provider_uri=provider_uri, region=REG_CN)
|
init(provider_uri=provider_uri, region=REG_CN, **cls._setup_kwargs)
|
||||||
|
|||||||
@@ -62,13 +62,8 @@ class Distance(PairOperator):
|
|||||||
class TestRegiterCustomOps(TestAutoData):
|
class TestRegiterCustomOps(TestAutoData):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls) -> None:
|
def setUpClass(cls) -> None:
|
||||||
# use default data
|
cls._setup_kwargs.update({"custom_ops":[Diff, Distance]})
|
||||||
provider_uri = "~/.qlib/qlib_data/cn_data_simple_1" # target_dir
|
super().setUpClass()
|
||||||
if not exists_qlib_data(provider_uri):
|
|
||||||
print(f"Qlib data is not found in {provider_uri}")
|
|
||||||
|
|
||||||
GetData().qlib_data(name="qlib_data_simple", region="cn", interval="1d", target_dir=provider_uri)
|
|
||||||
qlib.init(provider_uri=provider_uri, custom_ops=[Diff, Distance], region=REG_CN)
|
|
||||||
|
|
||||||
def test_regiter_custom_ops(self):
|
def test_regiter_custom_ops(self):
|
||||||
instruments = ["SH600000"]
|
instruments = ["SH600000"]
|
||||||
|
|||||||
Reference in New Issue
Block a user