akshare 1.15.94__py3-none-any.whl → 1.15.96__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
@@ -3004,9 +3004,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
3004
3004
  1.15.92 fix: fix stock_main_fund_flow interface
3005
3005
  1.15.93 fix: fix fund_etf_spot_em interface
3006
3006
  1.15.94 fix: fix stock_zh_index_spot_em interface
3007
+ 1.15.95 fix: fix stock_us_spot_em interface
3008
+ 1.15.96 fix: fix bond_cov_comparison interface
3007
3009
  """
3008
3010
 
3009
- __version__ = "1.15.94"
3011
+ __version__ = "1.15.96"
3010
3012
  __author__ = "AKFamily"
3011
3013
 
3012
3014
  import sys
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/3/20 17:50
4
+ Date: 2025/2/17 12:50
5
5
  Desc: 新浪财经-债券-沪深可转债-实时行情数据和历史行情数据
6
6
  https://vip.stock.finance.sina.com.cn/mkt/#hskzz_z
7
7
  """
8
8
 
9
+ import math
9
10
  import datetime
10
11
  import re
11
12
 
@@ -95,7 +96,7 @@ def _code_id_map() -> dict:
95
96
  url = "https://80.push2.eastmoney.com/api/qt/clist/get"
96
97
  params = {
97
98
  "pn": "1",
98
- "pz": "5000",
99
+ "pz": "200",
99
100
  "po": "1",
100
101
  "np": "1",
101
102
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -108,13 +109,26 @@ def _code_id_map() -> dict:
108
109
  }
109
110
  r = requests.get(url, params=params)
110
111
  data_json = r.json()
111
- temp_df = pd.DataFrame(data_json["data"]["diff"])
112
+ total_page = math.ceil(data_json["data"]["total"] / 200)
113
+ temp_list = []
114
+ tqdm = get_tqdm()
115
+ for page in tqdm(range(1, total_page + 1), leave=False):
116
+ params.update(
117
+ {
118
+ "pn": page,
119
+ }
120
+ )
121
+ r = requests.get(url, params=params, timeout=15)
122
+ data_json = r.json()
123
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
124
+ temp_list.append(inner_temp_df)
125
+ temp_df = pd.concat(temp_list, ignore_index=True)
112
126
  temp_df["market_id"] = 1
113
127
  temp_df.columns = ["sh_code", "sh_id"]
114
128
  code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"]))
115
129
  params = {
116
130
  "pn": "1",
117
- "pz": "5000",
131
+ "pz": "200",
118
132
  "po": "1",
119
133
  "np": "1",
120
134
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -127,7 +141,20 @@ def _code_id_map() -> dict:
127
141
  }
128
142
  r = requests.get(url, params=params)
129
143
  data_json = r.json()
130
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
144
+ total_page = math.ceil(data_json["data"]["total"] / 200)
145
+ temp_list = []
146
+ tqdm = get_tqdm()
147
+ for page in tqdm(range(1, total_page + 1), leave=False):
148
+ params.update(
149
+ {
150
+ "pn": page,
151
+ }
152
+ )
153
+ r = requests.get(url, params=params, timeout=15)
154
+ data_json = r.json()
155
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
156
+ temp_list.append(inner_temp_df)
157
+ temp_df_sz = pd.concat(temp_list, ignore_index=True)
131
158
  temp_df_sz["sz_id"] = 0
132
159
  code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"])))
133
160
  return code_id_dict
@@ -478,7 +505,7 @@ def bond_cov_comparison() -> pd.DataFrame:
478
505
  url = "https://16.push2.eastmoney.com/api/qt/clist/get"
479
506
  params = {
480
507
  "pn": "1",
481
- "pz": "5000",
508
+ "pz": "200",
482
509
  "po": "1",
483
510
  "np": "1",
484
511
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -492,8 +519,21 @@ def bond_cov_comparison() -> pd.DataFrame:
492
519
  }
493
520
  r = requests.get(url, params=params)
494
521
  text_data = r.text
495
- json_data = demjson.decode(text_data)
496
- temp_df = pd.DataFrame(json_data["data"]["diff"])
522
+ data_json = demjson.decode(text_data)
523
+ total_page = math.ceil(data_json["data"]["total"] / 200)
524
+ temp_list = []
525
+ tqdm = get_tqdm()
526
+ for page in tqdm(range(1, total_page + 1), leave=False):
527
+ params.update(
528
+ {
529
+ "pn": page,
530
+ }
531
+ )
532
+ r = requests.get(url, params=params, timeout=15)
533
+ data_json = r.json()
534
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
535
+ temp_list.append(inner_temp_df)
536
+ temp_df = pd.concat(temp_list, ignore_index=True)
497
537
  temp_df.reset_index(inplace=True)
498
538
  temp_df["index"] = range(1, len(temp_df) + 1)
499
539
  temp_df.columns = [
@@ -496,8 +496,15 @@ if __name__ == "__main__":
496
496
  stock_zh_index_spot_sina_df = stock_zh_index_spot_sina()
497
497
  print(stock_zh_index_spot_sina_df)
498
498
 
499
- stock_zh_index_spot_em_df = stock_zh_index_spot_em(symbol="沪深重要指数")
500
- print(stock_zh_index_spot_em_df)
499
+ for item in [
500
+ "沪深重要指数",
501
+ "上证系列指数",
502
+ "深证系列指数",
503
+ "指数成份",
504
+ "中证系列指数",
505
+ ]:
506
+ stock_zh_index_spot_em_df = stock_zh_index_spot_em(symbol=item)
507
+ print(stock_zh_index_spot_em_df)
501
508
 
502
509
  stock_zh_index_daily_tx_df = stock_zh_index_daily_tx(symbol="sh000919")
503
510
  print(stock_zh_index_daily_tx_df)
@@ -1,88 +1,15 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/3/20 15:00
4
+ Date: 2025/2/16 18:30
5
5
  Desc: 东方财富-行情报价
6
6
  https://quote.eastmoney.com/sz000001.html
7
7
  """
8
8
 
9
- from functools import lru_cache
10
-
11
9
  import pandas as pd
12
10
  import requests
13
11
 
14
-
15
- @lru_cache()
16
- def __code_id_map_em() -> dict:
17
- """
18
- 东方财富-股票和市场代码
19
- https://quote.eastmoney.com/center/gridlist.html#hs_a_board
20
- :return: 股票和市场代码
21
- :rtype: dict
22
- """
23
- url = "https://80.push2.eastmoney.com/api/qt/clist/get"
24
- params = {
25
- "pn": "1",
26
- "pz": "50000",
27
- "po": "1",
28
- "np": "1",
29
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
30
- "fltt": "2",
31
- "invt": "2",
32
- "fid": "f3",
33
- "fs": "m:1 t:2,m:1 t:23",
34
- "fields": "f12",
35
- "_": "1623833739532",
36
- }
37
- r = requests.get(url, params=params)
38
- data_json = r.json()
39
- if not data_json["data"]["diff"]:
40
- return dict()
41
- temp_df = pd.DataFrame(data_json["data"]["diff"])
42
- temp_df["market_id"] = 1
43
- temp_df.columns = ["sh_code", "sh_id"]
44
- code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"]))
45
- params = {
46
- "pn": "1",
47
- "pz": "50000",
48
- "po": "1",
49
- "np": "1",
50
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
51
- "fltt": "2",
52
- "invt": "2",
53
- "fid": "f3",
54
- "fs": "m:0 t:6,m:0 t:80",
55
- "fields": "f12",
56
- "_": "1623833739532",
57
- }
58
- r = requests.get(url, params=params)
59
- data_json = r.json()
60
- if not data_json["data"]["diff"]:
61
- return dict()
62
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
63
- temp_df_sz["sz_id"] = 0
64
- code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"])))
65
- params = {
66
- "pn": "1",
67
- "pz": "50000",
68
- "po": "1",
69
- "np": "1",
70
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
71
- "fltt": "2",
72
- "invt": "2",
73
- "fid": "f3",
74
- "fs": "m:0 t:81 s:2048",
75
- "fields": "f12",
76
- "_": "1623833739532",
77
- }
78
- r = requests.get(url, params=params)
79
- data_json = r.json()
80
- if not data_json["data"]["diff"]:
81
- return dict()
82
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
83
- temp_df_sz["bj_id"] = 0
84
- code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["bj_id"])))
85
- return code_id_dict
12
+ from akshare.stock_feature.stock_hist_em import code_id_map_em
86
13
 
87
14
 
88
15
  def stock_bid_ask_em(symbol: str = "000001") -> pd.DataFrame:
@@ -95,7 +22,7 @@ def stock_bid_ask_em(symbol: str = "000001") -> pd.DataFrame:
95
22
  :rtype: pandas.DataFrame
96
23
  """
97
24
  url = "https://push2.eastmoney.com/api/qt/stock/get"
98
- code_id_map_em_dict = __code_id_map_em()
25
+ code_id_map_em_dict = code_id_map_em()
99
26
  params = {
100
27
  "fltt": "2",
101
28
  "invt": "2",
@@ -1349,7 +1349,7 @@ def stock_hk_spot_em() -> pd.DataFrame:
1349
1349
  url = "https://72.push2.eastmoney.com/api/qt/clist/get"
1350
1350
  params = {
1351
1351
  "pn": "1",
1352
- "pz": "50000",
1352
+ "pz": "200",
1353
1353
  "po": "1",
1354
1354
  "np": "1",
1355
1355
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -1363,7 +1363,20 @@ def stock_hk_spot_em() -> pd.DataFrame:
1363
1363
  }
1364
1364
  r = requests.get(url, timeout=15, params=params)
1365
1365
  data_json = r.json()
1366
- temp_df = pd.DataFrame(data_json["data"]["diff"])
1366
+ total_page = math.ceil(data_json["data"]["total"] / 200)
1367
+ temp_list = []
1368
+ tqdm = get_tqdm()
1369
+ for page in tqdm(range(1, total_page + 1), leave=False):
1370
+ params.update(
1371
+ {
1372
+ "pn": page,
1373
+ }
1374
+ )
1375
+ r = requests.get(url, params=params, timeout=15)
1376
+ data_json = r.json()
1377
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
1378
+ temp_list.append(inner_temp_df)
1379
+ temp_df = pd.concat(temp_list, ignore_index=True)
1367
1380
  temp_df.columns = [
1368
1381
  "_",
1369
1382
  "最新价",
@@ -1732,7 +1745,7 @@ def stock_us_spot_em() -> pd.DataFrame:
1732
1745
  url = "https://72.push2.eastmoney.com/api/qt/clist/get"
1733
1746
  params = {
1734
1747
  "pn": "1",
1735
- "pz": "20000",
1748
+ "pz": "200",
1736
1749
  "po": "1",
1737
1750
  "np": "1",
1738
1751
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -1746,7 +1759,20 @@ def stock_us_spot_em() -> pd.DataFrame:
1746
1759
  }
1747
1760
  r = requests.get(url, timeout=15, params=params)
1748
1761
  data_json = r.json()
1749
- temp_df = pd.DataFrame(data_json["data"]["diff"])
1762
+ total_page = math.ceil(data_json["data"]["total"] / 200)
1763
+ temp_list = []
1764
+ tqdm = get_tqdm()
1765
+ for page in tqdm(range(1, total_page + 1), leave=False):
1766
+ params.update(
1767
+ {
1768
+ "pn": page,
1769
+ }
1770
+ )
1771
+ r = requests.get(url, params=params, timeout=15)
1772
+ data_json = r.json()
1773
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
1774
+ temp_list.append(inner_temp_df)
1775
+ temp_df = pd.concat(temp_list, ignore_index=True)
1750
1776
  temp_df.columns = [
1751
1777
  "_",
1752
1778
  "最新价",
@@ -2054,9 +2080,9 @@ if __name__ == "__main__":
2054
2080
  print(stock_us_hist_min_em_df)
2055
2081
 
2056
2082
  stock_zh_a_hist_min_em_df = stock_zh_a_hist_min_em(
2057
- symbol="000001",
2058
- start_date="2024-03-20 09:30:00",
2059
- end_date="2024-03-20 15:00:00",
2083
+ symbol="002881",
2084
+ start_date="2025-02-14 09:30:00",
2085
+ end_date="2025-02-14 15:00:00",
2060
2086
  period="5",
2061
2087
  adjust="hfq",
2062
2088
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: akshare
3
- Version: 1.15.94
3
+ Version: 1.15.96
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=we_LAFKFonnukFubcTKsykI_fHLlgAqwg_5OI478eRQ,187287
1
+ akshare/__init__.py,sha256=O6QRS4yLoVvgcYmSl5gPP3Zp7FzMNOp5WIqMMuVf_Lk,187378
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
@@ -30,7 +30,7 @@ akshare/bond/bond_info_cm.py,sha256=VBu9UM9tUcGDRV07pndU9yttLDF_Nk3b0vU0n65qpHs,
30
30
  akshare/bond/bond_issue_cninfo.py,sha256=tPoZhF-_sIX9ztCKB0K0-Z4Kd9b-389bP3_CdFK7Wb0,21672
31
31
  akshare/bond/bond_nafmii.py,sha256=cekcobyXKMG1zDuM8wHWOn__SuWELxYmUwfGVmLRP40,2155
32
32
  akshare/bond/bond_summary.py,sha256=ECwCRcs5YMIro4I1Yayf6SZ8nz1Hr97RhmKT6aGaQDg,3581
33
- akshare/bond/bond_zh_cov.py,sha256=yL77itRK0rFCeQP_M524lW1740D5Q1IZW6eLvjXf2H4,23750
33
+ akshare/bond/bond_zh_cov.py,sha256=bdTEi-uS4WfvHW59fPn2AJGtrnsqRiKdH3eRKqjHtNM,25085
34
34
  akshare/bond/bond_zh_sina.py,sha256=msj7upgqaCTzC_MxzhUm7hVKtzHeWRUjlcjvZn2zlbw,4654
35
35
  akshare/bond/cons.py,sha256=SGqjMqRYwJlEb8UczxdcrtcD7I2SAVULXARGEedEQfE,1792
36
36
  akshare/cal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -167,7 +167,7 @@ akshare/index/index_research_sw.py,sha256=Mm1YtiP-PXhDysJwmFidX3RZSZZ92AyXpjl_tV
167
167
  akshare/index/index_spot.py,sha256=meTBTCp2DPVTX_N3qpCLtkI-0q3XhrJ3gndNugRBGKg,1767
168
168
  akshare/index/index_stock_hk.py,sha256=nPFzRrjyiUpRK-OSDsdi5AFCKHNKqOVji6WJcQxOvNo,9781
169
169
  akshare/index/index_stock_us_sina.py,sha256=IxOk4G49oasv7EfEQenL9-GLuelyUus6c4JPyRlaOzY,1551
170
- akshare/index/index_stock_zh.py,sha256=vwOmUs6B7XPJSVYK8A0kfRu8ewBkArIkxSYmpflOOLg,18563
170
+ akshare/index/index_stock_zh.py,sha256=A_-vZ0jk-UCBd4B0SbzAnctVUBilnc3IoSd-2EWZX6M,18724
171
171
  akshare/index/index_stock_zh_csindex.py,sha256=sRVoDD-fitqAMuDs0XPm1oCz2nZ2QTkvNswL1WvXpwo,4164
172
172
  akshare/index/index_sugar.py,sha256=B_Nj9Q6JP-Y_d7myZ0C79izTxxrbuZIp1Vv_CilVMOc,5006
173
173
  akshare/index/index_sw.py,sha256=hETMmFszQb7JDY8UHjLK8szfwkr7Ui_6QcseOoEfxaI,10456
@@ -230,7 +230,7 @@ akshare/spot/spot_sge.py,sha256=sXaUGPm8yEXogssNFyFgTlnpf363g7s3U6xO4Zyvk9g,8213
230
230
  akshare/stock/__init__.py,sha256=jSa9260d6aNZajaW68chI2mpPkDSXLOgi3eXrqo4MQ8,82
231
231
  akshare/stock/cons.py,sha256=0oyUW5Pu-iQ3qgh-TFemM_O5f1fAwVe-PsI4Qa8EYpQ,42956
232
232
  akshare/stock/stock_allotment_cninfo.py,sha256=OVjVdWp2XVRNbJvVgtgVVoBmPBJgBB4RyIIgA_9QHM8,6066
233
- akshare/stock/stock_ask_bid_em.py,sha256=ioVkmRMVs7A7Lj_PboxwIoZINNk73nAko80wIJX4RKU,5510
233
+ akshare/stock/stock_ask_bid_em.py,sha256=nXQhYIpU4k7GUc7nthWC29zVS9GhYb9ppQTLD0gycF4,3438
234
234
  akshare/stock/stock_board_concept_em.py,sha256=zCtHicBUcFN3GN2b5sKd0JV74KVSZKOOHDxS7v9DeCM,14042
235
235
  akshare/stock/stock_board_industry_em.py,sha256=AfRVUVZrgSJXaoKAK81Ga-_m3hfv8YZzczBnnBdFq-I,16195
236
236
  akshare/stock/stock_cg_equity_mortgage.py,sha256=Pui5aWKKPwGuKjF_GNpejDzsMGNPrxiaJviLz3x2e9I,3426
@@ -311,7 +311,7 @@ akshare/stock_feature/stock_gdhs.py,sha256=Z6ZMy1A03BqMu9TghcIu2Sd_wwEtpIH7qawHu
311
311
  akshare/stock_feature/stock_gdzjc_em.py,sha256=SHJH5iS3_NhvjTqRXF0vPooZl0s_ASeyZmNCC50ZYqs,4426
312
312
  akshare/stock_feature/stock_gpzy_em.py,sha256=FgyjVgdoxrtMM7WwxdQJxK0mYGJklIHaT9KmMCFmEPM,17869
313
313
  akshare/stock_feature/stock_gxl_lg.py,sha256=I8TpDEpFzadZSSyZisyIk6163mJlRxup91dmlBH4t4U,2641
314
- akshare/stock_feature/stock_hist_em.py,sha256=GZ3bTQDk62TodMAKBWpkMS8r_13-VnFV9-fGxAcbOYY,70768
314
+ akshare/stock_feature/stock_hist_em.py,sha256=1glmjIwnJ8c_G5Jk3QteK-Xjl3PNuk9_Meu8ylhUXLA,71648
315
315
  akshare/stock_feature/stock_hist_tx.py,sha256=WpLsbkG2didSx7lYNkSbTWNTrLhUKbcopfD18WO2Rlc,3397
316
316
  akshare/stock_feature/stock_hk_valuation_baidu.py,sha256=_sErx4UhNsSXJgXyPfrL0aPxkW53Mg1zH9gEKoziaCA,1968
317
317
  akshare/stock_feature/stock_hot_xq.py,sha256=NmoH4x-0hiDztj-YwzMFVIyOICQ2wUUBbhjt91q-tq4,9112
@@ -380,8 +380,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
380
380
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
381
381
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
382
382
  tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
383
- akshare-1.15.94.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
- akshare-1.15.94.dist-info/METADATA,sha256=jm8UvRnGQaPArvjDJoZruYr0M4Ky6y_qIOAiYLnU4_k,13679
385
- akshare-1.15.94.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
386
- akshare-1.15.94.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
- akshare-1.15.94.dist-info/RECORD,,
383
+ akshare-1.15.96.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
+ akshare-1.15.96.dist-info/METADATA,sha256=BoL4xFItQel6sCyaihQ3MqGkCMViEYHExw47z6F1w8U,13679
385
+ akshare-1.15.96.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
386
+ akshare-1.15.96.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
+ akshare-1.15.96.dist-info/RECORD,,