mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-04 19:41:00 +08:00
fix issue 1729
This commit is contained in:
@@ -396,14 +396,7 @@ class CSI500Index(CSIIndex):
|
||||
today = pd.Timestamp.now()
|
||||
date_range = pd.DataFrame(pd.date_range(start="2007-01-15", end=today, freq="7D"))[0].dt.date
|
||||
ret_list = []
|
||||
col = ["date", "symbol", "code_name"]
|
||||
for date in tqdm(date_range, desc="Download CSI500"):
|
||||
rs = bs.query_zz500_stocks(date=str(date))
|
||||
zz500_stocks = []
|
||||
while (rs.error_code == "0") & rs.next():
|
||||
zz500_stocks.append(rs.get_row_data())
|
||||
result = pd.DataFrame(zz500_stocks, columns=col)
|
||||
result["symbol"] = result["symbol"].apply(lambda x: x.replace(".", "").upper())
|
||||
result = self.get_data_from_baostock(date)
|
||||
ret_list.append(result[["date", "symbol"]])
|
||||
bs.logout()
|
||||
@@ -465,4 +458,5 @@ class CSI500Index(CSIIndex):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
fire.Fire(get_instruments)
|
||||
# fire.Fire(get_instruments)
|
||||
get_instruments(index_name="CSI500", qlib_dir="C:/Users/v-lvlinlang/Desktop/20230914175824_qlib_data_cn_1d_latest", method="parse_instruments")
|
||||
|
||||
2
setup.py
2
setup.py
@@ -82,7 +82,7 @@ REQUIRED = [
|
||||
"dill",
|
||||
"dataclasses;python_version<'3.7'",
|
||||
"filelock",
|
||||
"jinja2<3.1.0", # for passing the readthedocs workflow.
|
||||
"jinja2", # for passing the readthedocs workflow.
|
||||
"gym",
|
||||
# Installing the latest version of protobuf for python versions below 3.8 will cause unit tests to fail.
|
||||
"protobuf<=3.20.1;python_version<='3.8'",
|
||||
|
||||
Reference in New Issue
Block a user