MCPcopy
hub / github.com/microsoft/qlib / test_expr2

Method test_expr2

tests/test_pit.py:230–254  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

228 self.check_same(s[~s.duplicated().values], expect)
229
230 def test_expr2(self):
231 instruments = ["sh600519"]
232 fields = ["P($$roewa_q)", "P($$yoyni_q)"]
233 fields += ["P(($$roewa_q / $$yoyni_q) / Ref($$roewa_q / $$yoyni_q, 1) - 1)"]
234 fields += ["P(Sum($$yoyni_q, 4))"]
235 fields += ["$close", "P($$roewa_q) * $close"]
236 data = D.features(instruments, fields, start_time="2019-01-01", end_time="2020-01-01", freq="day")
237 except_data = """
238 P($$roewa_q) P($$yoyni_q) P(($$roewa_q / $$yoyni_q) / Ref($$roewa_q / $$yoyni_q, 1) - 1) P(Sum($$yoyni_q, 4)) $close P($$roewa_q) * $close
239 instrument datetime
240 sh600519 2019-01-02 0.255220 0.243892 1.484224 1.661578 63.595333 16.230801
241 2019-01-03 0.255220 0.243892 1.484224 1.661578 62.641907 15.987467
242 2019-01-04 0.255220 0.243892 1.484224 1.661578 63.915985 16.312637
243 2019-01-07 0.255220 0.243892 1.484224 1.661578 64.286530 16.407207
244 2019-01-08 0.255220 0.243892 1.484224 1.661578 64.212196 16.388237
245 ... ... ... ... ... ... ...
246 2019-12-25 0.255819 0.219821 0.677052 1.081693 122.150467 31.248409
247 2019-12-26 0.255819 0.219821 0.677052 1.081693 122.301315 31.286999
248 2019-12-27 0.255819 0.219821 0.677052 1.081693 125.307404 32.056015
249 2019-12-30 0.255819 0.219821 0.677052 1.081693 127.763992 32.684456
250 2019-12-31 0.255819 0.219821 0.677052 1.081693 127.462303 32.607277
251
252 [244 rows x 6 columns]
253 """
254 self.check_same(data, except_data)
255
256 def test_pref_operator(self):
257 instruments = ["sh600519"]

Callers

nothing calls this directly

Calls 2

check_sameMethod · 0.95
featuresMethod · 0.80

Tested by

no test coverage detected