(self)
| 129 | |
| 130 | @pytest.mark.slow |
| 131 | def test_expr(self): |
| 132 | fields = [ |
| 133 | "P(Mean($$roewa_q, 1))", |
| 134 | "P($$roewa_q)", |
| 135 | "P(Mean($$roewa_q, 2))", |
| 136 | "P(Ref($$roewa_q, 1))", |
| 137 | "P((Ref($$roewa_q, 1) +$$roewa_q) / 2)", |
| 138 | ] |
| 139 | instruments = ["sh600519"] |
| 140 | data = D.features(instruments, fields, start_time="2019-01-01", end_time="2019-07-19", freq="day") |
| 141 | expect = """ |
| 142 | P(Mean($$roewa_q, 1)) P($$roewa_q) P(Mean($$roewa_q, 2)) P(Ref($$roewa_q, 1)) P((Ref($$roewa_q, 1) +$$roewa_q) / 2) |
| 143 | instrument datetime |
| 144 | sh600519 2019-07-01 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 145 | 2019-07-02 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 146 | 2019-07-03 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 147 | 2019-07-04 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 148 | 2019-07-05 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 149 | 2019-07-08 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 150 | 2019-07-09 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 151 | 2019-07-10 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 152 | 2019-07-11 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 153 | 2019-07-12 0.094737 0.094737 0.219691 0.344644 0.219691 |
| 154 | 2019-07-15 0.000000 0.000000 0.047369 0.094737 0.047369 |
| 155 | 2019-07-16 0.000000 0.000000 0.047369 0.094737 0.047369 |
| 156 | 2019-07-17 0.000000 0.000000 0.047369 0.094737 0.047369 |
| 157 | 2019-07-18 0.175322 0.175322 0.135029 0.094737 0.135029 |
| 158 | 2019-07-19 0.175322 0.175322 0.135029 0.094737 0.135029 |
| 159 | """ |
| 160 | self.check_same(data.tail(15), expect) |
| 161 | |
| 162 | def test_unlimit(self): |
| 163 | # fields = ["P(Mean($$roewa_q, 1))", "P($$roewa_q)", "P(Mean($$roewa_q, 2))", "P(Ref($$roewa_q, 1))", "P((Ref($$roewa_q, 1) +$$roewa_q) / 2)"] |
nothing calls this directly
no test coverage detected