Files
wehub-resource-sync e64161ec32
CI / ci (3.11) (push) Has been cancelled
CI / ci (3.10) (push) Has been cancelled
CI / dependabot (push) Has been cancelled
Release / release_and_publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:36:15 +08:00

28 lines
737 B
Python
Executable File

import qlib
qlib.init(provider_uri="~/.qlib/qlib_data/cn_data")
from qlib.data import D
instruments = D.instruments()
fields = ["$open", "$close", "$high", "$low", "$volume", "$factor"]
data = D.features(instruments, fields, freq="day").swaplevel().sort_index().loc["2008-12-29":].sort_index()
data.to_hdf("./daily_pv_all.h5", key="data")
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()
.sort_index()
)
data.to_hdf("./daily_pv_debug.h5", key="data")