akshare 1.15.65__py3-none-any.whl → 1.15.67__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
@@ -2975,9 +2975,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2975
2975
  1.15.63 fix: fix stock_financial_abstract interface
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
+ 1.15.66 fix: fix fund_etf_dividend_sina interface
2979
+ 1.15.67 fix: fix stock_hold_change_cninfo interface
2978
2980
  """
2979
2981
 
2980
- __version__ = "1.15.65"
2982
+ __version__ = "1.15.67"
2981
2983
  __author__ = "AKFamily"
2982
2984
 
2983
2985
  import sys
@@ -2999,6 +3001,11 @@ if sys.version_info < (3, 9):
2999
3001
 
3000
3002
  del sys
3001
3003
 
3004
+ """
3005
+ 巨潮资讯-数据中心-专题统计-股东股本-股本变动
3006
+ """
3007
+ from akshare.stock.stock_hold_control_cninfo import stock_hold_change_cninfo
3008
+
3002
3009
  """
3003
3010
  基金费率
3004
3011
  """
@@ -4485,6 +4492,7 @@ from akshare.stock_feature.stock_yjyg_cninfo import stock_report_disclosure
4485
4492
  from akshare.fund.fund_etf_sina import (
4486
4493
  fund_etf_hist_sina,
4487
4494
  fund_etf_category_sina,
4495
+ fund_etf_dividend_sina,
4488
4496
  )
4489
4497
 
4490
4498
  """
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/11/22 14:00
4
+ Date: 2025/1/5 19:00
5
5
  Desc: 新浪财经-基金行情
6
6
  https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
7
7
  """
@@ -132,15 +132,56 @@ def fund_etf_hist_sina(symbol: str = "sh510050") -> pd.DataFrame:
132
132
  temp_df = pd.DataFrame(dict_list)
133
133
  if temp_df.empty: # 处理获取数据为空的问题
134
134
  return pd.DataFrame()
135
- temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date
135
+ temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.tz_localize(
136
+ None
137
+ )
136
138
  temp_df["open"] = pd.to_numeric(temp_df["open"], errors="coerce")
137
139
  temp_df["high"] = pd.to_numeric(temp_df["high"], errors="coerce")
138
140
  temp_df["low"] = pd.to_numeric(temp_df["low"], errors="coerce")
139
141
  temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
140
142
  temp_df["volume"] = pd.to_numeric(temp_df["volume"], errors="coerce")
143
+
144
+ # 转换日期列为日期类型
145
+ temp_df["date"] = temp_df["date"].dt.date
146
+ temp_df = temp_df.sort_values(by="date", ascending=True)
141
147
  return temp_df
142
148
 
143
149
 
150
+ def fund_etf_dividend_sina(symbol: str = "sh510050") -> pd.DataFrame:
151
+ """
152
+ 新浪财经-基金-ETF 基金-累计分红
153
+ https://finance.sina.com.cn/fund/quotes/510050/bc.shtml
154
+ :param symbol: 基金名称, 可以通过 ak.fund_etf_category_sina() 函数获取
155
+ :type symbol: str
156
+ :return: 累计分红
157
+ :rtype: pandas.DataFrame
158
+ """
159
+ # 构建复权数据URL
160
+ factor_url = f"https://finance.sina.com.cn/realstock/company/{symbol}/hfq.js"
161
+ r = requests.get(factor_url)
162
+ text = r.text
163
+ if text.startswith("var"):
164
+ json_str = text.split("=")[1].strip().rsplit("}", maxsplit=1)[0].strip()
165
+ data = eval(json_str + "}") # 这里使用eval而不是json.loads因为数据格式特殊
166
+
167
+ if isinstance(data, dict) and "data" in data:
168
+ df = pd.DataFrame(data["data"])
169
+ # 重命名列
170
+ df.columns = ["date", "f", "s", "u"] if len(df.columns) == 4 else df.columns
171
+ # 移除1900-01-01的数据
172
+ df = df[df["date"] != "1900-01-01"]
173
+ # 转换日期
174
+ df["date"] = pd.to_datetime(df["date"])
175
+ # 转换数值类型
176
+ df[["f", "s", "u"]] = df[["f", "s", "u"]].astype(float)
177
+ # 按日期排序
178
+ df = df.sort_values("date", ascending=True, ignore_index=True)
179
+ temp_df = df[["date", "u"]].copy()
180
+ temp_df.columns = ["日期", "累计分红"]
181
+ temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
182
+ return temp_df
183
+
184
+
144
185
  if __name__ == "__main__":
145
186
  fund_etf_category_sina_df = fund_etf_category_sina(symbol="封闭式基金")
146
187
  print(fund_etf_category_sina_df)
@@ -156,3 +197,6 @@ if __name__ == "__main__":
156
197
 
157
198
  fund_etf_hist_sina_df = fund_etf_hist_sina(symbol="sh510300")
158
199
  print(fund_etf_hist_sina_df)
200
+
201
+ fund_etf_dividend_sina_df = fund_etf_dividend_sina(symbol="sh510050")
202
+ print(fund_etf_dividend_sina_df)
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.15.65
3
+ Version: 1.15.67
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=2qstXg3C_yb_TtnipqCfJFipnBWoBe2gFA32K-N7LWQ,185559
1
+ akshare/__init__.py,sha256=iHal0YVSSEaZA2Utd3s3IAKHnWDM9vY_IJKapTYwNKs,185840
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
@@ -87,7 +87,7 @@ akshare/fund/fund_announcement.py,sha256=g5rcIC9vQ4HapZd0b7cDbFYzHu9V6bOKhwxRHVf
87
87
  akshare/fund/fund_aum_em.py,sha256=dy1R1-0X48H8S-LPiuggNA5M-6MvQ08fnp5bytvCGPQ,3518
88
88
  akshare/fund/fund_em.py,sha256=nX0VA5JeiF-zRr1J10X-U9-pJj5KFDUAbovN1DWjvTo,40450
89
89
  akshare/fund/fund_etf_em.py,sha256=oEPVCg-CQvOfLS7bt69yshqPiUPbxDpWa-FnMF7GqIQ,17386
90
- akshare/fund/fund_etf_sina.py,sha256=3eYnpug02oSZfR6fuWsT5mZRMRNm39VYCLHKnWdvonM,5218
90
+ akshare/fund/fund_etf_sina.py,sha256=YV2KrqKMF_h8kgrywvWvRJx2oy62lhgizvHFk40E4Rk,7042
91
91
  akshare/fund/fund_etf_ths.py,sha256=vb_jy0h2-Kz2dNWUrwBYxPB0MAotv0KZgnFhE98ohSM,3432
92
92
  akshare/fund/fund_fee_em.py,sha256=rkA2qVEhuWBUTFlvEP-zY_4Fw7_vL9cDx9hR-P38yDk,4157
93
93
  akshare/fund/fund_fhsp_em.py,sha256=-zSwwveiCB4HHRxwAuaLDTQHmNe3FxwxxeoPeiG8JbM,5546
@@ -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
@@ -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.65.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
382
- akshare-1.15.65.dist-info/METADATA,sha256=Ny5RQMqJZ7-zwbDQqyJD8VpfNAy9YGK9grHwgk0g3_k,13423
383
- akshare-1.15.65.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
384
- akshare-1.15.65.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
385
- akshare-1.15.65.dist-info/RECORD,,
381
+ akshare-1.15.67.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
382
+ akshare-1.15.67.dist-info/METADATA,sha256=QP-7VeWE73Os58p3_RxV1KcWzBmnwc9qsSEfDNIZul8,13423
383
+ akshare-1.15.67.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
384
+ akshare-1.15.67.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
385
+ akshare-1.15.67.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.7.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5