akshare 1.15.26__py3-none-any.whl → 1.15.27__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of akshare might be problematic. Click here for more details.

akshare/__init__.py CHANGED
@@ -2936,9 +2936,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2936
2936
  1.15.24 fix: fix get_dce_daily interface
2937
2937
  1.15.25 fix: fix stock_news_main_cx interface
2938
2938
  1.15.26 fix: fix option_dce_daily interface
2939
+ 1.15.27 fix: fix stock_zh_index_spot_em interface
2939
2940
  """
2940
2941
 
2941
- __version__ = "1.15.26"
2942
+ __version__ = "1.15.27"
2942
2943
  __author__ = "AKFamily"
2943
2944
 
2944
2945
  import sys
@@ -682,7 +682,7 @@ def get_futures_daily(
682
682
 
683
683
  if __name__ == "__main__":
684
684
  get_futures_daily_df = get_futures_daily(
685
- start_date="20240101", end_date="20240101", market="DCE"
685
+ start_date="20241118", end_date="20241118", market="DCE"
686
686
  )
687
687
  print(get_futures_daily_df)
688
688
 
@@ -125,15 +125,97 @@ def stock_zh_index_spot_sina() -> pd.DataFrame:
125
125
  return big_df
126
126
 
127
127
 
128
+ def __stock_zh_main_spot_em() -> pd.DataFrame:
129
+ """
130
+ 东方财富网-行情中心-沪深重要指数
131
+ https://quote.eastmoney.com/center/hszs.html
132
+ :return: 指数的实时行情数据
133
+ :rtype: pandas.DataFrame
134
+ """
135
+ url = "https://33.push2.eastmoney.com/api/qt/clist/get"
136
+ params = {
137
+ "pn": "1",
138
+ "pz": "5000",
139
+ "po": "1",
140
+ "np": "1",
141
+ "ut": "bd1d9ddb04089700cf9c27f6f7426281",
142
+ "fltt": "2",
143
+ "invt": "2",
144
+ "dect": "1",
145
+ "wbp2u": "|0|0|0|web",
146
+ "fid": "",
147
+ "fs": "b:MK0010",
148
+ "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,"
149
+ "f23,f24,f25,f26,f22,f11,f62,f128,f136,f115,f152",
150
+ "_": "1704327268532",
151
+ }
152
+ r = requests.get(url, params=params)
153
+ data_json = r.json()
154
+ temp_df = pd.DataFrame(data_json["data"]["diff"])
155
+ temp_df.reset_index(inplace=True)
156
+ temp_df["index"] = temp_df["index"] + 1
157
+ temp_df.rename(
158
+ columns={
159
+ "index": "序号",
160
+ "f2": "最新价",
161
+ "f3": "涨跌幅",
162
+ "f4": "涨跌额",
163
+ "f5": "成交量",
164
+ "f6": "成交额",
165
+ "f7": "振幅",
166
+ "f10": "量比",
167
+ "f12": "代码",
168
+ "f14": "名称",
169
+ "f15": "最高",
170
+ "f16": "最低",
171
+ "f17": "今开",
172
+ "f18": "昨收",
173
+ },
174
+ inplace=True,
175
+ )
176
+ temp_df = temp_df[
177
+ [
178
+ "序号",
179
+ "代码",
180
+ "名称",
181
+ "最新价",
182
+ "涨跌幅",
183
+ "涨跌额",
184
+ "成交量",
185
+ "成交额",
186
+ "振幅",
187
+ "最高",
188
+ "最低",
189
+ "今开",
190
+ "昨收",
191
+ "量比",
192
+ ]
193
+ ]
194
+ temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
195
+ temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
196
+ temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
197
+ temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
198
+ temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
199
+ temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce")
200
+ temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
201
+ temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
202
+ temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce")
203
+ temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce")
204
+ temp_df["量比"] = pd.to_numeric(temp_df["量比"], errors="coerce")
205
+ return temp_df
206
+
207
+
128
208
  def stock_zh_index_spot_em(symbol: str = "上证系列指数") -> pd.DataFrame:
129
209
  """
130
210
  东方财富网-行情中心-沪深京指数
131
211
  https://quote.eastmoney.com/center/gridlist.html#index_sz
132
- :param symbol: "上证系列指数"; choice of {"上证系列指数", "深证系列指数", "指数成份", "中证系列指数"}
212
+ :param symbol: "上证系列指数"; choice of {"沪深重要指数", "上证系列指数", "深证系列指数", "指数成份", "中证系列指数"}
133
213
  :type symbol: str
134
214
  :return: 指数的实时行情数据
135
215
  :rtype: pandas.DataFrame
136
216
  """
217
+ if symbol == "沪深重要指数":
218
+ return __stock_zh_main_spot_em()
137
219
  url = "https://48.push2.eastmoney.com/api/qt/clist/get"
138
220
  symbol_map = {
139
221
  "上证系列指数": "m:1 s:2",
@@ -386,7 +468,7 @@ if __name__ == "__main__":
386
468
  stock_zh_index_spot_sina_df = stock_zh_index_spot_sina()
387
469
  print(stock_zh_index_spot_sina_df)
388
470
 
389
- stock_zh_index_spot_em_df = stock_zh_index_spot_em(symbol="中证系列指数")
471
+ stock_zh_index_spot_em_df = stock_zh_index_spot_em(symbol="沪深重要指数")
390
472
  print(stock_zh_index_spot_em_df)
391
473
 
392
474
  stock_zh_index_daily_tx_df = stock_zh_index_daily_tx(symbol="sh000919")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.15.26
3
+ Version: 1.15.27
4
4
  Summary: AKShare is an elegant and simple financial data interface library for Python, built for human beings!
5
5
  Home-page: https://github.com/akfamily/akshare
6
6
  Author: AKFamily
@@ -1,4 +1,4 @@
1
- akshare/__init__.py,sha256=3OjA_N1Ftt4-7aH6Fa3L2cGqy2iqjxuyzJy3WfOENv0,183986
1
+ akshare/__init__.py,sha256=hIhHRVxmbFqO5Cac5AckgmFa3NLXOZrGWNURUdnVLy4,184036
2
2
  akshare/datasets.py,sha256=-qdwaQjgBlftX84uM74KJqCYJYkQ50PV416_neA4uls,995
3
3
  akshare/exceptions.py,sha256=WEJjIhSmJ_xXNW6grwV4nufE_cfmmyuhmueVGiN1VAg,878
4
4
  akshare/request.py,sha256=HtFFf9MhfEibR-ETWe-1Tts6ELU4VKSqA-ghaXjegQM,4252
@@ -111,7 +111,7 @@ akshare/futures/futures_comex_em.py,sha256=V-mkKQkH5N8PyaZWKdyggb2lTnY8DDDxiUPt-
111
111
  akshare/futures/futures_comm_ctp.py,sha256=V8TEKO0R0i6LfE8DDFqrMA3JGwNlpmaQCvvMugKZ1I8,1004
112
112
  akshare/futures/futures_comm_qihuo.py,sha256=uQfabZ63qME8sTaxUbIUVQBVi8yTaPPDhD7voR9PEx0,10504
113
113
  akshare/futures/futures_contract_detail.py,sha256=auwzNdaoFi5hoJY6rNkO54v5FD2gmEkQu7B90yEDtkc,1175
114
- akshare/futures/futures_daily_bar.py,sha256=i_wRExBVHzM6SVlDZSaFj0aI2uf77HwQmTUPOCfGrnM,25281
114
+ akshare/futures/futures_daily_bar.py,sha256=E1zx4VswHra2Gh30wKgWuHRO36tsTvKYfjC0dOMTBPY,25281
115
115
  akshare/futures/futures_foreign.py,sha256=oSIoAg5oy-CIlPWHkQffcvZGu02Y2GWOrt-6aPA53Xg,2059
116
116
  akshare/futures/futures_hf_em.py,sha256=OEUltaq1LKabl9eTQoNxswnl1BLKpB27eiIHwbu_Rh4,3178
117
117
  akshare/futures/futures_hq_sina.py,sha256=eK1gEan4DPvpYmln8-tNnzh_J_733s95DBr--NqNYVA,9576
@@ -171,7 +171,7 @@ akshare/index/index_research_sw.py,sha256=Mm1YtiP-PXhDysJwmFidX3RZSZZ92AyXpjl_tV
171
171
  akshare/index/index_spot.py,sha256=HrXt2QC9i1pYEh7wyJPKjtexctzSIUyMjEzk5BQq_K8,1696
172
172
  akshare/index/index_stock_hk.py,sha256=nPFzRrjyiUpRK-OSDsdi5AFCKHNKqOVji6WJcQxOvNo,9781
173
173
  akshare/index/index_stock_us_sina.py,sha256=IxOk4G49oasv7EfEQenL9-GLuelyUus6c4JPyRlaOzY,1551
174
- akshare/index/index_stock_zh.py,sha256=WkXd3A8gc1hgPJPR4znRbLfrqMeTivLS7L449TlOBdE,14873
174
+ akshare/index/index_stock_zh.py,sha256=kZBVg6ypqT38WXYoRVsk28WNZMvRs7WHBZJdbTsjBHY,17668
175
175
  akshare/index/index_stock_zh_csindex.py,sha256=jVF29Byn2guaZ4QsXwwL1C5qtqk_m1ja-dgDnKnfz8s,13267
176
176
  akshare/index/index_sugar.py,sha256=B_Nj9Q6JP-Y_d7myZ0C79izTxxrbuZIp1Vv_CilVMOc,5006
177
177
  akshare/index/index_sw.py,sha256=n757dUfNEsaZGk_eCxeetZi3pktBBYLVEMM7f9U_XjM,10174
@@ -383,8 +383,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
383
383
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
384
384
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
385
385
  tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
386
- akshare-1.15.26.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
387
- akshare-1.15.26.dist-info/METADATA,sha256=XkNTYEhjtO_FHIQ6Op9jL9D1qyNbe0kk42zwP0yT9Vo,14259
388
- akshare-1.15.26.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
389
- akshare-1.15.26.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
390
- akshare-1.15.26.dist-info/RECORD,,
386
+ akshare-1.15.27.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
387
+ akshare-1.15.27.dist-info/METADATA,sha256=srJhbJd1CSBkp2wU99dJp-ko8YJeNnqTyDp4_1rSYYs,14259
388
+ akshare-1.15.27.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
389
+ akshare-1.15.27.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
390
+ akshare-1.15.27.dist-info/RECORD,,