1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-29 17:11:20 +08:00
Files
qlib/tests/ops/test_elem_operator.py
luocy16 2bb8a4ce0e Supporting Arctic Backend Provider & Orderbook, Tick Data Example (#744)
* change weight_decay & batchsize

* del weight_decay

* big weight_decay

* mid weight_decay

* small layer

* 2 layer

* full layer

* no weight decay

* divide into two data source

* change parse field

* delete some debug

* add Toperator

* new format of arctic

* fix cache bug to arctic read

* fix connection problem

* add some operator

* final version for arcitc

* clear HZ cache

* remove not used function

* add topswrappers

* successfully import data and run first test

* A simpler version to support arctic

* Successfully run all high-freq expressions

* Black format and fix add docs

* Add docs for download and test data

* update scripts and docs

* Add docs

* fix bug

* Refine docs

* fix test bug

* fix CI error

* clean code

Co-authored-by: bxdd <bxddream@gmail.com>
Co-authored-by: wangwenxi.handsome <wangwenxi.handsome@gmail.com>
Co-authored-by: Young <afe.young@gmail.com>
2022-01-18 09:13:11 +08:00

34 lines
864 B
Python

import unittest
from qlib.data import DatasetProvider
from qlib.tests import TestOperatorData
from qlib.config import C
class TestOperatorDataSetting(TestOperatorData):
def test_setting(self):
self.assertEqual(len(self.instruments_d), 1)
self.assertGreater(len(self.cal), 0)
class TestElementOperator(TestOperatorData):
def setUp(self) -> None:
freq = "day"
expressions = [
"$change",
"Abs($change)",
]
columns = ["change", "abs"]
self.data = DatasetProvider.inst_calculator(
self.inst, self.start_time, self.end_time, freq, expressions, self.spans, C, []
)
self.data.columns = columns
def test_abs(self):
abs_values = self.data["abs"]
self.assertGreater(abs_values[2], 0)
if __name__ == "__main__":
unittest.main()