mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-07 13:00:58 +08:00
[840] - Test case for operators. (#841)
* [840] - Test case for operators. * Move import to the head of file and add test_setting.
This commit is contained in:
@@ -2,6 +2,9 @@ import unittest
|
||||
from .data import GetData
|
||||
from .. import init
|
||||
from ..constant import REG_CN
|
||||
from qlib.data.filter import NameDFilter
|
||||
from qlib.data import D
|
||||
from qlib.data.data import Cal, DatasetD
|
||||
|
||||
|
||||
class TestAutoData(unittest.TestCase):
|
||||
@@ -51,3 +54,24 @@ class TestAutoData(unittest.TestCase):
|
||||
dataset_cache=None,
|
||||
**cls._setup_kwargs,
|
||||
)
|
||||
|
||||
|
||||
class TestOperatorData(TestAutoData):
|
||||
@classmethod
|
||||
def setUpClass(cls, enable_1d_type="simple", enable_1min=False) -> None:
|
||||
# use default data
|
||||
super().setUpClass(enable_1d_type, enable_1min)
|
||||
nameDFilter = NameDFilter(name_rule_re="SH600110")
|
||||
instruments = D.instruments("csi300", filter_pipe=[nameDFilter])
|
||||
start_time = "2005-01-04"
|
||||
end_time = "2005-12-31"
|
||||
freq = "day"
|
||||
|
||||
instruments_d = DatasetD.get_instruments_d(instruments, freq)
|
||||
cls.instruments_d = instruments_d
|
||||
cal = Cal.calendar(start_time, end_time, freq)
|
||||
cls.cal = cal
|
||||
cls.start_time = cal[0]
|
||||
cls.end_time = cal[-1]
|
||||
cls.inst = list(instruments_d.keys())[0]
|
||||
cls.spans = list(instruments_d.values())[0]
|
||||
|
||||
Reference in New Issue
Block a user