Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions rdagent/scenarios/qlib/experiment/factor_data_template/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@


fields = ["$open", "$close", "$high", "$low", "$volume", "$factor"]
data = (
(
D.features(instruments, fields, start_time="2018-01-01", end_time="2019-12-31", freq="day")
.swaplevel()
.sort_index()
)
.swaplevel()
.loc[data.reset_index()["instrument"].unique()[:100]]
.swaplevel()
# Debug slice: pick instruments that actually trade in the debug window.
# (Taking the first 100 of the full-history panel breaks on universes with
# delisted securities: names dead before 2018 are absent from this window.)
data_debug = (
D.features(instruments, fields, start_time="2018-01-01", end_time="2019-12-31", freq="day")
.sort_index()
)
keep = data_debug.index.get_level_values("instrument").unique()[:100]
data_debug = data_debug.loc[keep].swaplevel().sort_index()

data.to_hdf("./daily_pv_debug.h5", key="data")
data_debug.to_hdf("./daily_pv_debug.h5", key="data")
Loading