update get_index_code_name_list

This commit is contained in:
fasiondog 2024-02-23 18:08:45 +08:00
parent 6d1c176257
commit d1a76e877f

View File

@ -130,12 +130,12 @@ def get_index_code_name_list() -> list:
:return: [{'market_code': 'SHxxx'}, ...]
"""
if hasattr(ak, 'stock_zh_index_spot_sina'):
if hasattr(ak, 'stock_zh_index_spot_em'):
df = ak.stock_zh_index_spot_em()
elif hasattr(ak, 'stock_zh_index_spot_sina'):
df = ak.stock_zh_index_spot_sina()
elif hasattr(ak, 'stock_zh_index_daily_tx'):
df = ak.stock_zh_index_daily_tx()
elif hasattr(ak, 'stock_zh_index_spot_em'):
df = ak.stock_zh_index_spot_em()
else:
df = ak.stock_zh_index_spot()
return [{'market_code': df.loc[i][''].upper(), 'name': df.loc[i]['']} for i in range(len(df))]