akshare 1.15.66__py3-none-any.whl → 1.15.68__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
@@ -2976,9 +2976,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2976
2976
  1.15.64 fix: fix stock_zh_index_value_csindex interface
2977
2977
  1.15.65 fix: fix option_czce_daily interface
2978
2978
  1.15.66 fix: fix fund_etf_dividend_sina interface
2979
+ 1.15.67 fix: fix stock_hold_change_cninfo interface
2980
+ 1.15.68 fix: fix stock_research_report_em interface
2979
2981
  """
2980
2982
 
2981
- __version__ = "1.15.66"
2983
+ __version__ = "1.15.68"
2982
2984
  __author__ = "AKFamily"
2983
2985
 
2984
2986
  import sys
@@ -3000,6 +3002,11 @@ if sys.version_info < (3, 9):
3000
3002
 
3001
3003
  del sys
3002
3004
 
3005
+ """
3006
+ 巨潮资讯-数据中心-专题统计-股东股本-股本变动
3007
+ """
3008
+ from akshare.stock.stock_hold_control_cninfo import stock_hold_change_cninfo
3009
+
3003
3010
  """
3004
3011
  基金费率
3005
3012
  """
@@ -195,6 +195,85 @@ def stock_hold_management_detail_cninfo(symbol: str = "增持") -> pd.DataFrame:
195
195
  return temp_df
196
196
 
197
197
 
198
+ def stock_hold_change_cninfo(symbol: str = "全部") -> pd.DataFrame:
199
+ """
200
+ 巨潮资讯-数据中心-专题统计-股东股本-股本变动
201
+ https://webapi.cninfo.com.cn/#/thematicStatistics
202
+ :param symbol: choice of {"深市主板", "沪市", "创业板", "科创板", "北交所", "全部"}
203
+ :type symbol: str
204
+ :return: 股本变动
205
+ :rtype: pandas.DataFrame
206
+ """
207
+ symbol_map = {
208
+ "深市主板": "012002",
209
+ "沪市": "012001",
210
+ "创业板": "012015",
211
+ "科创板": "012029",
212
+ "北交所": "012046",
213
+ "全部": "",
214
+ }
215
+ url = "https://webapi.cninfo.com.cn/api/sysapi/p_sysapi1029"
216
+ js_code = py_mini_racer.MiniRacer()
217
+ js_content = _get_file_content_cninfo("cninfo.js")
218
+ js_code.eval(js_content)
219
+ mcode = js_code.call("getResCode1")
220
+ headers = {
221
+ "Accept": "/",
222
+ "Accept-Enckey": mcode,
223
+ "Accept-Encoding": "gzip, deflate",
224
+ "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
225
+ "Cache-Control": "no-cache",
226
+ "Content-Length": "0",
227
+ "Host": "webapi.cninfo.com.cn",
228
+ "Origin": "https://webapi.cninfo.com.cn",
229
+ "Pragma": "no-cache",
230
+ "Proxy-Connection": "keep-alive",
231
+ "Referer": "https://webapi.cninfo.com.cn/",
232
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
233
+ "Chrome/93.0.4577.63 Safari/537.36",
234
+ "X-Requested-With": "XMLHttpRequest",
235
+ }
236
+ params = {
237
+ "market": symbol_map[symbol],
238
+ }
239
+ r = requests.get(url, headers=headers, params=params)
240
+ data_json = r.json()
241
+ temp_df = pd.DataFrame(data_json["records"])
242
+ temp_df.columns = [
243
+ "已流通股份",
244
+ "总股本",
245
+ "交易市场",
246
+ "证券简称",
247
+ "公告日期",
248
+ "变动原因",
249
+ "证券代码",
250
+ "变动日期",
251
+ "流通受限股份",
252
+ "已流通比例",
253
+ ]
254
+ temp_df = temp_df[
255
+ [
256
+ "证券代码",
257
+ "证券简称",
258
+ "交易市场",
259
+ "公告日期",
260
+ "变动日期",
261
+ "变动原因",
262
+ "总股本",
263
+ "已流通股份",
264
+ "已流通比例",
265
+ "流通受限股份",
266
+ ]
267
+ ]
268
+ temp_df["变动日期"] = pd.to_datetime(temp_df["变动日期"], errors="coerce").dt.date
269
+ temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"], errors="coerce").dt.date
270
+ temp_df["总股本"] = pd.to_numeric(temp_df["总股本"], errors="coerce")
271
+ temp_df["已流通股份"] = pd.to_numeric(temp_df["已流通股份"], errors="coerce")
272
+ temp_df["已流通比例"] = pd.to_numeric(temp_df["已流通比例"], errors="coerce")
273
+ temp_df["流通受限股份"] = pd.to_numeric(temp_df["流通受限股份"], errors="coerce")
274
+ return temp_df
275
+
276
+
198
277
  if __name__ == "__main__":
199
278
  stock_hold_control_cninfo_df = stock_hold_control_cninfo(symbol="全部")
200
279
  print(stock_hold_control_cninfo_df)
@@ -203,3 +282,6 @@ if __name__ == "__main__":
203
282
  symbol="增持"
204
283
  )
205
284
  print(stock_hold_management_detail_cninfo_df)
285
+
286
+ stock_hold_change_cninfo_df = stock_hold_change_cninfo(symbol="全部")
287
+ print(stock_hold_change_cninfo_df)
@@ -1,13 +1,15 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/8/20 20:00
4
+ Date: 2025/1/9 21:35
5
5
  Desc: 东方财富网-数据中心-研究报告-个股研报
6
6
  https://data.eastmoney.com/report/stock.jshtml
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
- from tqdm import tqdm
11
+
12
+ from akshare.utils.tqdm import get_tqdm
11
13
 
12
14
 
13
15
  def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
@@ -40,7 +42,9 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
40
42
  r = requests.get(url, params=params)
41
43
  data_json = r.json()
42
44
  total_page = data_json["TotalPage"]
45
+ current_year = data_json["currentYear"]
43
46
  big_df = pd.DataFrame()
47
+ tqdm = get_tqdm()
44
48
  for page in tqdm(range(1, total_page + 1), leave=False):
45
49
  params.update(
46
50
  {
@@ -53,9 +57,15 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
53
57
  r = requests.get(url, params=params)
54
58
  data_json = r.json()
55
59
  temp_df = pd.DataFrame(data_json["data"])
56
- big_df = pd.concat([big_df, temp_df], axis=0, ignore_index=True)
60
+ big_df = pd.concat(objs=[big_df, temp_df], axis=0, ignore_index=True)
57
61
  big_df.reset_index(inplace=True)
58
62
  big_df["index"] = big_df["index"] + 1
63
+ predict_this_year_eps_title = f"{current_year}-盈利预测-收益"
64
+ predict_this_year_pe_title = f"{current_year}-盈利预测-市盈率"
65
+ predict_next_year_eps_title = f"{current_year + 1}-盈利预测-收益"
66
+ predict_next_year_pe_title = f"{current_year + 1}-盈利预测-市盈率"
67
+ predict_next_two_year_eps_title = f"{current_year + 2}-盈利预测-收益"
68
+ predict_next_two_year_pe_title = f"{current_year + 2}-盈利预测-市盈率"
59
69
  big_df.rename(
60
70
  columns={
61
71
  "index": "序号",
@@ -68,12 +78,12 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
68
78
  "publishDate": "日期",
69
79
  "infoCode": "-",
70
80
  "column": "-",
71
- "predictNextTwoYearEps": "-",
72
- "predictNextTwoYearPe": "-",
73
- "predictNextYearEps": "2024-盈利预测-收益",
74
- "predictNextYearPe": "2024-盈利预测-市盈率",
75
- "predictThisYearEps": "2023-盈利预测-收益",
76
- "predictThisYearPe": "2023-盈利预测-市盈率",
81
+ "predictNextTwoYearEps": predict_next_two_year_eps_title,
82
+ "predictNextTwoYearPe": predict_next_two_year_pe_title,
83
+ "predictNextYearEps": predict_next_year_eps_title,
84
+ "predictNextYearPe": predict_next_year_pe_title,
85
+ "predictThisYearEps": predict_this_year_eps_title,
86
+ "predictThisYearPe": predict_this_year_pe_title,
77
87
  "predictLastYearEps": "-",
78
88
  "predictLastYearPe": "-",
79
89
  "actualLastTwoYearEps": "-",
@@ -122,20 +132,38 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
122
132
  "东财评级",
123
133
  "机构",
124
134
  "近一月个股研报数",
125
- "2023-盈利预测-收益",
126
- "2023-盈利预测-市盈率",
127
- "2024-盈利预测-收益",
128
- "2024-盈利预测-市盈率",
135
+ predict_this_year_eps_title,
136
+ predict_this_year_pe_title,
137
+ predict_next_year_eps_title,
138
+ predict_next_year_pe_title,
139
+ predict_next_two_year_eps_title,
140
+ predict_next_two_year_pe_title,
129
141
  "行业",
130
142
  "日期",
131
143
  ]
132
144
  ]
133
145
  big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date
134
- big_df["近一月个股研报数"] = pd.to_numeric(big_df["近一月个股研报数"], errors="coerce")
135
- big_df["2023-盈利预测-收益"] = pd.to_numeric(big_df["2023-盈利预测-收益"], errors="coerce")
136
- big_df["2023-盈利预测-市盈率"] = pd.to_numeric(big_df["2023-盈利预测-市盈率"], errors="coerce")
137
- big_df["2024-盈利预测-收益"] = pd.to_numeric(big_df["2024-盈利预测-收益"], errors="coerce")
138
- big_df["2024-盈利预测-市盈率"] = pd.to_numeric(big_df["2024-盈利预测-市盈率"], errors="coerce")
146
+ big_df["近一月个股研报数"] = pd.to_numeric(
147
+ big_df["近一月个股研报数"], errors="coerce"
148
+ )
149
+ big_df[predict_this_year_eps_title] = pd.to_numeric(
150
+ big_df[predict_this_year_eps_title], errors="coerce"
151
+ )
152
+ big_df[predict_this_year_pe_title] = pd.to_numeric(
153
+ big_df[predict_this_year_pe_title], errors="coerce"
154
+ )
155
+ big_df[predict_next_year_eps_title] = pd.to_numeric(
156
+ big_df[predict_next_year_eps_title], errors="coerce"
157
+ )
158
+ big_df[predict_next_year_pe_title] = pd.to_numeric(
159
+ big_df[predict_next_year_pe_title], errors="coerce"
160
+ )
161
+ big_df[predict_next_two_year_eps_title] = pd.to_numeric(
162
+ big_df[predict_next_two_year_eps_title], errors="coerce"
163
+ )
164
+ big_df[predict_next_two_year_pe_title] = pd.to_numeric(
165
+ big_df[predict_next_two_year_pe_title], errors="coerce"
166
+ )
139
167
  return big_df
140
168
 
141
169
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: akshare
3
- Version: 1.15.66
3
+ Version: 1.15.68
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
@@ -37,6 +37,18 @@ Provides-Extra: full
37
37
  Requires-Dist: akqmt; extra == "full"
38
38
  Provides-Extra: qmt
39
39
  Requires-Dist: akqmt; extra == "qmt"
40
+ Dynamic: author
41
+ Dynamic: author-email
42
+ Dynamic: classifier
43
+ Dynamic: description
44
+ Dynamic: description-content-type
45
+ Dynamic: home-page
46
+ Dynamic: keywords
47
+ Dynamic: license
48
+ Dynamic: provides-extra
49
+ Dynamic: requires-dist
50
+ Dynamic: requires-python
51
+ Dynamic: summary
40
52
 
41
53
  **欢迎加入专注于财经数据和量化投资的知识社区,请点击[了解更多](https://akshare.akfamily.xyz/learn.html)**
42
54
 
@@ -1,4 +1,4 @@
1
- akshare/__init__.py,sha256=W-0PqOedEFTzY7utCqr6lS4ENUQq4SA6SaYtQtJ9-5o,185637
1
+ akshare/__init__.py,sha256=nDjQ0YwguxGlJLLrsigRdQM_YyM2gk4JhLFaNJesmEs,185892
2
2
  akshare/datasets.py,sha256=rKuRNZrqi6IMsZ9nyvO3Rx02js0tH3zMLjz8HQNAoPQ,963
3
3
  akshare/exceptions.py,sha256=WEJjIhSmJ_xXNW6grwV4nufE_cfmmyuhmueVGiN1VAg,878
4
4
  akshare/request.py,sha256=HtFFf9MhfEibR-ETWe-1Tts6ELU4VKSqA-ghaXjegQM,4252
@@ -243,7 +243,7 @@ akshare/stock/stock_hk_famous.py,sha256=g-p1cdRibei9fw2HEMPyarLP-wT4bFwIK7Mxi77j
243
243
  akshare/stock/stock_hk_fhpx_ths.py,sha256=68soKJIOMoAGuCvJIMZBVU-2wL_umtv67SuqVzl2C14,2191
244
244
  akshare/stock/stock_hk_hot_rank_em.py,sha256=IhLGahWXfYPQRrCoB1Ph7DRbs_39BcrmXpIgXgEkttg,4746
245
245
  akshare/stock/stock_hk_sina.py,sha256=sRX977vZ_nbuJ2Y7a8WA6efHp79h2ikocH3xfZ1hLfg,9586
246
- akshare/stock/stock_hold_control_cninfo.py,sha256=NpUDtfYCDQGhqX1ZAL8Uy2yslZ2zc15YBrzOt5_4k6o,7065
246
+ akshare/stock/stock_hold_control_cninfo.py,sha256=J1CGX1tZ22UJdOWAkED19o7vdE10Hke91cEbiN1RIYQ,10038
247
247
  akshare/stock/stock_hold_control_em.py,sha256=iBgnSEV7aYdsS2Ce7ELIUqVo-polfYdqcd6UmEuVN7g,7349
248
248
  akshare/stock/stock_hold_num_cninfo.py,sha256=JY9LcZMhhTiCHfQJv4pwMrLrpUxTKGLE4oRD6pvflsU,3706
249
249
  akshare/stock/stock_hot_rank_em.py,sha256=WMbadW1CFU3ppZHMSPjG2HtXgs7PgYGugNqmyrRQQe4,7349
@@ -330,7 +330,7 @@ akshare/stock_feature/stock_market_legu.py,sha256=_LeyGUGyZFeD-1fnJPc4eIQkeoWAmo
330
330
  akshare/stock_feature/stock_pankou_em.py,sha256=A3lu1hKddXwMFo9vKPLCQfL3Zh77xr2IbcAtKs8Lc9Y,5599
331
331
  akshare/stock_feature/stock_qsjy_em.py,sha256=7EHroLZC3-X_3WNhb7GV9MPQHbxjtkfKI_YEbTvnSb0,3913
332
332
  akshare/stock_feature/stock_report_em.py,sha256=jhePrTKGIYzdz8idiPoDs1vEajd73XRIFpZyWQggKa4,18075
333
- akshare/stock_feature/stock_research_report_em.py,sha256=XFQadpUI2l0-Ik8BQWf-eCC4uFC1xxt9VNiZ9NU2zp0,4888
333
+ akshare/stock_feature/stock_research_report_em.py,sha256=z6nsoai1wUK5EfMoef-7KBd-BqqAGgKdoR01qukWBwk,5900
334
334
  akshare/stock_feature/stock_sns_sseinfo.py,sha256=TGGLw5P77Hh-sSHgw_KKoK29d1m_V_2GDQXe9m_XFew,4556
335
335
  akshare/stock_feature/stock_sy_em.py,sha256=GysP1WvPpqCLhbCRXH5sxwmXCPYvgtbJYQ_jltDqaA0,17721
336
336
  akshare/stock_feature/stock_technology_ths.py,sha256=4u9z7H6MYEutOYAQvYfzgc_FxG6XlhkMLujSotAbraw,30827
@@ -378,8 +378,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
378
378
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
379
379
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
380
380
  tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
381
- akshare-1.15.66.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
382
- akshare-1.15.66.dist-info/METADATA,sha256=_KY49PPY1WCkGJIqVLl35Brda6xP5cSjQmQZGvcTlY8,13423
383
- akshare-1.15.66.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
384
- akshare-1.15.66.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
385
- akshare-1.15.66.dist-info/RECORD,,
381
+ akshare-1.15.68.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
382
+ akshare-1.15.68.dist-info/METADATA,sha256=mJRpdmFzUtCoaXKb9LEdXsuZm61ra36h67V7FyY7py4,13679
383
+ akshare-1.15.68.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
384
+ akshare-1.15.68.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
385
+ akshare-1.15.68.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5