| 8 | |
| 9 | class TestOperatorDataSetting(TestOperatorData): |
| 10 | def test_setting(self): |
| 11 | # All the query below passes |
| 12 | df = D.features(["SH600519"], ["ChangeInstrument('SH000300', $close)"]) |
| 13 | |
| 14 | # get market return for "SH600519" |
| 15 | df = D.features(["SH600519"], ["ChangeInstrument('SH000300', Feature('close')/Ref(Feature('close'),1) -1)"]) |
| 16 | df = D.features(["SH600519"], ["ChangeInstrument('SH000300', $close/Ref($close,1) -1)"]) |
| 17 | # excess return |
| 18 | df = D.features( |
| 19 | ["SH600519"], ["($close/Ref($close,1) -1) - ChangeInstrument('SH000300', $close/Ref($close,1) -1)"] |
| 20 | ) |
| 21 | print(df) |
| 22 | |
| 23 | def test_case2(self): |
| 24 | def test_case(instruments, queries, note=None): |