akshare 1.15.87__py3-none-any.whl → 1.15.88__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
@@ -2997,9 +2997,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2997
2997
  1.15.85 fix: fix stock_gddh_em interface
2998
2998
  1.15.86 fix: fix stock_zdhtmx_em interface
2999
2999
  1.15.87 fix: fix futures_index_ccidx interface
3000
+ 1.15.88 fix: fix stock_zh_a_spot_em interface
3000
3001
  """
3001
3002
 
3002
- __version__ = "1.15.87"
3003
+ __version__ = "1.15.88"
3003
3004
  __author__ = "AKFamily"
3004
3005
 
3005
3006
  import sys
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/7/13 18:00
4
+ Date: 2025/2/15 21:00
5
5
  Desc: 东方财富网-行情首页-沪深京 A 股
6
6
  https://quote.eastmoney.com/
7
7
  """
8
8
 
9
9
  from functools import lru_cache
10
-
10
+ import math
11
11
  import pandas as pd
12
12
  import requests
13
+ from akshare.utils.tqdm import get_tqdm
13
14
 
14
15
 
15
16
  def stock_zh_a_spot_em() -> pd.DataFrame:
@@ -22,7 +23,7 @@ def stock_zh_a_spot_em() -> pd.DataFrame:
22
23
  url = "https://82.push2.eastmoney.com/api/qt/clist/get"
23
24
  params = {
24
25
  "pn": "1",
25
- "pz": "50000",
26
+ "pz": "200",
26
27
  "po": "1",
27
28
  "np": "1",
28
29
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -34,11 +35,22 @@ def stock_zh_a_spot_em() -> pd.DataFrame:
34
35
  "f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
35
36
  "_": "1623833739532",
36
37
  }
37
- r = requests.get(url, timeout=15, params=params)
38
+ r = requests.get(url, params=params, timeout=15)
38
39
  data_json = r.json()
39
- if not data_json["data"]["diff"]:
40
- return pd.DataFrame()
41
- temp_df = pd.DataFrame(data_json["data"]["diff"])
40
+ total_page = math.ceil(data_json["data"]["total"] / 200)
41
+ temp_list = []
42
+ tqdm = get_tqdm()
43
+ for page in tqdm(range(1, total_page + 1), leave=False):
44
+ params.update(
45
+ {
46
+ "pn": page,
47
+ }
48
+ )
49
+ r = requests.get(url, params=params, timeout=15)
50
+ data_json = r.json()
51
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
52
+ temp_list.append(inner_temp_df)
53
+ temp_df = pd.concat(temp_list, ignore_index=True)
42
54
  temp_df.columns = [
43
55
  "_",
44
56
  "最新价",
@@ -950,7 +962,7 @@ def code_id_map_em() -> dict:
950
962
  url = "https://80.push2.eastmoney.com/api/qt/clist/get"
951
963
  params = {
952
964
  "pn": "1",
953
- "pz": "50000",
965
+ "pz": "200",
954
966
  "po": "1",
955
967
  "np": "1",
956
968
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -963,15 +975,27 @@ def code_id_map_em() -> dict:
963
975
  }
964
976
  r = requests.get(url, timeout=15, params=params)
965
977
  data_json = r.json()
966
- if not data_json["data"]["diff"]:
967
- return dict()
968
- temp_df = pd.DataFrame(data_json["data"]["diff"])
978
+ total_page = math.ceil(data_json["data"]["total"] / 200)
979
+ temp_list = []
980
+ tqdm = get_tqdm()
981
+ for page in tqdm(range(1, total_page + 1), leave=False):
982
+ params.update(
983
+ {
984
+ "pn": page,
985
+ }
986
+ )
987
+ r = requests.get(url, params=params, timeout=15)
988
+ data_json = r.json()
989
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
990
+ temp_list.append(inner_temp_df)
991
+ temp_df = pd.concat(temp_list, ignore_index=True)
969
992
  temp_df["market_id"] = 1
970
993
  temp_df.columns = ["sh_code", "sh_id"]
971
994
  code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"]))
995
+
972
996
  params = {
973
997
  "pn": "1",
974
- "pz": "50000",
998
+ "pz": "200",
975
999
  "po": "1",
976
1000
  "np": "1",
977
1001
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -984,14 +1008,26 @@ def code_id_map_em() -> dict:
984
1008
  }
985
1009
  r = requests.get(url, timeout=15, params=params)
986
1010
  data_json = r.json()
987
- if not data_json["data"]["diff"]:
988
- return dict()
989
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
1011
+ total_page = math.ceil(data_json["data"]["total"] / 200)
1012
+ temp_list = []
1013
+ tqdm = get_tqdm()
1014
+ for page in tqdm(range(1, total_page + 1), leave=False):
1015
+ params.update(
1016
+ {
1017
+ "pn": page,
1018
+ }
1019
+ )
1020
+ r = requests.get(url, params=params, timeout=15)
1021
+ data_json = r.json()
1022
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
1023
+ temp_list.append(inner_temp_df)
1024
+ temp_df_sz = pd.concat(temp_list, ignore_index=True)
990
1025
  temp_df_sz["sz_id"] = 0
991
1026
  code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"])))
1027
+
992
1028
  params = {
993
1029
  "pn": "1",
994
- "pz": "50000",
1030
+ "pz": "200",
995
1031
  "po": "1",
996
1032
  "np": "1",
997
1033
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -1004,9 +1040,20 @@ def code_id_map_em() -> dict:
1004
1040
  }
1005
1041
  r = requests.get(url, timeout=15, params=params)
1006
1042
  data_json = r.json()
1007
- if not data_json["data"]["diff"]:
1008
- return dict()
1009
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
1043
+ total_page = math.ceil(data_json["data"]["total"] / 200)
1044
+ temp_list = []
1045
+ tqdm = get_tqdm()
1046
+ for page in tqdm(range(1, total_page + 1), leave=False):
1047
+ params.update(
1048
+ {
1049
+ "pn": page,
1050
+ }
1051
+ )
1052
+ r = requests.get(url, params=params, timeout=15)
1053
+ data_json = r.json()
1054
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
1055
+ temp_list.append(inner_temp_df)
1056
+ temp_df_sz = pd.concat(temp_list, ignore_index=True)
1010
1057
  temp_df_sz["bj_id"] = 0
1011
1058
  code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["bj_id"])))
1012
1059
  return code_id_dict
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: akshare
3
- Version: 1.15.87
3
+ Version: 1.15.88
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=IYBCt-ujchTg4VREWnkTnX-buYA9aQmbWH849eD0ZeQ,186930
1
+ akshare/__init__.py,sha256=gEpUq0f70kCddphXfN8QdsdQ6egav-PGL6ViQngJquw,186976
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
@@ -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=H8bbC0LJBvDTRnrhZvFtrMM8Y6H4LZk-C0KIPar1aQs,69201
314
+ akshare/stock_feature/stock_hist_em.py,sha256=ibI1uQvI-UwkQ9dvSWLMmGdOLbr9u_e083SUxbV20_8,70766
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.87.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
- akshare-1.15.87.dist-info/METADATA,sha256=0TbL6iLOFFIXCWenS6eBnCFZnVlY4F-1mx2W6GEXpQA,13679
385
- akshare-1.15.87.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
386
- akshare-1.15.87.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
- akshare-1.15.87.dist-info/RECORD,,
383
+ akshare-1.15.88.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
+ akshare-1.15.88.dist-info/METADATA,sha256=lYsezcOpQVLyZNgUWutwHRctWoEeUAUUXrQA2CUEtrM,13679
385
+ akshare-1.15.88.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
386
+ akshare-1.15.88.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
+ akshare-1.15.88.dist-info/RECORD,,