akshare 1.16.33__py3-none-any.whl → 1.16.35__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.
akshare/__init__.py CHANGED
@@ -3042,9 +3042,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
3042
3042
  1.16.31 add: add index_global_hist_em interface
3043
3043
  1.16.32 fix: fix news_economic_baidu interface
3044
3044
  1.16.33 fix: fix fund_open_fund_daily_em interface
3045
+ 1.16.34 fix: fix stock_individual_fund_flow_rank interface
3046
+ 1.16.35 fix: fix futures_global_spot_em interface
3045
3047
  """
3046
3048
 
3047
- __version__ = "1.16.33"
3049
+ __version__ = "1.16.35"
3048
3050
  __author__ = "AKFamily"
3049
3051
 
3050
3052
  import sys
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2025/3/5 19:00
4
+ Date: 2025/3/9 22:00
5
5
  Desc: 东方财富网-行情中心-期货市场-国际期货
6
6
  https://quote.eastmoney.com/center/gridlist.html#futures_global
7
7
  """
@@ -93,7 +93,7 @@ def futures_global_spot_em() -> pd.DataFrame:
93
93
  """
94
94
  url = "https://futsseapi.eastmoney.com/list/COMEX,NYMEX,COBOT,SGX,NYBOT,LME,MDEX,TOCOM,IPE"
95
95
  params = {
96
- "orderBy": "zdf",
96
+ "orderBy": "dm",
97
97
  "sort": "desc",
98
98
  "pageSize": "20",
99
99
  "pageIndex": "0",
@@ -1,17 +1,18 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2025/2/17 14:30
4
+ Date: 2025/3/9 19:00
5
5
  Desc: 东方财富网-数据中心-资金流向
6
6
  https://data.eastmoney.com/zjlx/detail.html
7
7
  """
8
8
 
9
- import json
9
+ import math
10
10
  import time
11
11
  from functools import lru_cache
12
12
 
13
13
  import pandas as pd
14
14
  import requests
15
+ from akshare.utils.tqdm import get_tqdm
15
16
 
16
17
 
17
18
  def stock_individual_fund_flow(
@@ -43,8 +44,8 @@ def stock_individual_fund_flow(
43
44
  "_": int(time.time() * 1000),
44
45
  }
45
46
  r = requests.get(url, params=params, headers=headers)
46
- json_data = r.json()
47
- content_list = json_data["data"]["klines"]
47
+ data_json = r.json()
48
+ content_list = data_json["data"]["klines"]
48
49
  temp_df = pd.DataFrame([item.split(",") for item in content_list])
49
50
  temp_df.columns = [
50
51
  "日期",
@@ -147,9 +148,9 @@ def stock_individual_fund_flow_rank(indicator: str = "5日") -> pd.DataFrame:
147
148
  params = {
148
149
  "fid": indicator_map[indicator][0],
149
150
  "po": "1",
150
- "pz": "50000",
151
+ "pz": "200",
151
152
  "pn": "1",
152
- "np": "2",
153
+ "np": "1",
153
154
  "fltt": "2",
154
155
  "invt": "2",
155
156
  "ut": "b2884a393a59ad64002292a3e90d46a5",
@@ -158,7 +159,20 @@ def stock_individual_fund_flow_rank(indicator: str = "5日") -> pd.DataFrame:
158
159
  }
159
160
  r = requests.get(url, params=params)
160
161
  data_json = r.json()
161
- temp_df = pd.DataFrame(data_json["data"]["diff"]).T
162
+ total_page = math.ceil(data_json["data"]["total"] / 200)
163
+ temp_list = []
164
+ tqdm = get_tqdm()
165
+ for page in tqdm(range(1, total_page + 1), leave=False):
166
+ params.update(
167
+ {
168
+ "pn": page,
169
+ }
170
+ )
171
+ r = requests.get(url, params=params, timeout=15)
172
+ data_json = r.json()
173
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
174
+ temp_list.append(inner_temp_df)
175
+ temp_df = pd.concat(temp_list, ignore_index=True)
162
176
  temp_df.reset_index(inplace=True)
163
177
  temp_df["index"] = range(1, len(temp_df) + 1)
164
178
  if indicator == "今日":
@@ -348,13 +362,11 @@ def stock_market_fund_flow() -> pd.DataFrame:
348
362
  "fields1": "f1,f2,f3,f7",
349
363
  "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65",
350
364
  "ut": "b2884a393a59ad64002292a3e90d46a5",
351
- "cb": "jQuery183003743205523325188_1589197499471",
352
365
  "_": int(time.time() * 1000),
353
366
  }
354
367
  r = requests.get(url, params=params, headers=headers)
355
- text_data = r.text
356
- json_data = json.loads(text_data[text_data.find("{") : -2])
357
- content_list = json_data["data"]["klines"]
368
+ data_json = r.json()
369
+ content_list = data_json["data"]["klines"]
358
370
  temp_df = pd.DataFrame([item.split(",") for item in content_list])
359
371
  temp_df.columns = [
360
372
  "日期",
@@ -468,9 +480,9 @@ def stock_sector_fund_flow_rank(
468
480
  }
469
481
  params = {
470
482
  "pn": "1",
471
- "pz": "5000",
483
+ "pz": "200",
472
484
  "po": "1",
473
- "np": "2",
485
+ "np": "1",
474
486
  "ut": "b2884a393a59ad64002292a3e90d46a5",
475
487
  "fltt": "2",
476
488
  "invt": "2",
@@ -479,13 +491,25 @@ def stock_sector_fund_flow_rank(
479
491
  "stat": indicator_map[indicator][1],
480
492
  "fields": indicator_map[indicator][2],
481
493
  "rt": "52975239",
482
- "cb": "jQuery18308357908311220152_1589256588824",
483
494
  "_": int(time.time() * 1000),
484
495
  }
485
496
  r = requests.get(url, params=params, headers=headers)
486
- data_text = r.text
487
- data_json = json.loads(data_text[data_text.find("{") : -2])
488
- temp_df = pd.DataFrame(data_json["data"]["diff"]).T
497
+ data_json = r.json()
498
+ total_page = math.ceil(data_json["data"]["total"] / 200)
499
+ temp_list = []
500
+ tqdm = get_tqdm()
501
+ for page in tqdm(range(1, total_page + 1), leave=False):
502
+ params.update(
503
+ {
504
+ "pn": page,
505
+ }
506
+ )
507
+ r = requests.get(url, params=params, timeout=15)
508
+ data_json = r.json()
509
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
510
+ temp_list.append(inner_temp_df)
511
+ temp_df = pd.concat(temp_list, ignore_index=True)
512
+
489
513
  if indicator == "今日":
490
514
  temp_df.columns = [
491
515
  "-",
@@ -1,14 +1,18 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2025/3/4 23:00
4
+ Date: 2025/3/9 23:00
5
5
  Desc: 东方财富网-行情中心-沪深港通
6
6
  https://quote.eastmoney.com/center/gridlist.html#ah_comparison
7
7
  """
8
8
 
9
+ import math
10
+
9
11
  import pandas as pd
10
12
  import requests
11
13
 
14
+ from akshare.utils.tqdm import get_tqdm
15
+
12
16
 
13
17
  def stock_zh_ah_spot_em() -> pd.DataFrame:
14
18
  """
@@ -19,14 +23,14 @@ def stock_zh_ah_spot_em() -> pd.DataFrame:
19
23
  """
20
24
  url = "https://push2.eastmoney.com/api/qt/clist/get"
21
25
  params = {
22
- "np": "2",
26
+ "np": "1",
23
27
  "fltt": "1",
24
28
  "invt": "2",
25
29
  "fs": "b:DLMK0101",
26
30
  "fields": "f193,f191,f192,f12,f13,f14,f1,f2,f4,f3,f152,f186,f190,f187,f189,f188",
27
31
  "fid": "f3",
28
32
  "pn": "1",
29
- "pz": "50000",
33
+ "pz": "200",
30
34
  "po": "1",
31
35
  "dect": "1",
32
36
  "ut": "fa5fd1943c7b386f172d6893dbfba10b",
@@ -35,7 +39,7 @@ def stock_zh_ah_spot_em() -> pd.DataFrame:
35
39
  }
36
40
  r = requests.get(url, params=params)
37
41
  data_json = r.json()
38
- temp_df = pd.DataFrame(data_json["data"]["diff"]).T
42
+ temp_df = pd.DataFrame(data_json["data"]["diff"])
39
43
  temp_df.reset_index(inplace=True)
40
44
  temp_df["index"] = temp_df["index"].astype(int) + 1
41
45
  temp_df.rename(
@@ -85,14 +89,14 @@ def stock_hsgt_sh_hk_spot_em() -> pd.DataFrame:
85
89
  """
86
90
  url = "https://push2.eastmoney.com/api/qt/clist/get"
87
91
  params = {
88
- "np": "2",
92
+ "np": "1",
89
93
  "fltt": "1",
90
94
  "invt": "2",
91
95
  "fs": "b:DLMK0144",
92
96
  "fields": "f12,f13,f14,f19,f1,f2,f4,f3,f152,f17,f18,f15,f16,f5,f6",
93
- "fid": "f3",
97
+ "fid": "f12",
94
98
  "pn": "1",
95
- "pz": "50000",
99
+ "pz": "200",
96
100
  "po": "1",
97
101
  "dect": "1",
98
102
  "ut": "fa5fd1943c7b386f172d6893dbfba10b",
@@ -101,12 +105,22 @@ def stock_hsgt_sh_hk_spot_em() -> pd.DataFrame:
101
105
  }
102
106
  r = requests.get(url, params=params)
103
107
  data_json = r.json()
104
- temp_df = pd.DataFrame(data_json["data"]["diff"]).T
105
- temp_df.reset_index(inplace=True)
106
- temp_df["index"] = temp_df["index"].astype(int) + 1
108
+ total_page = math.ceil(data_json["data"]["total"] / 200)
109
+ temp_list = []
110
+ tqdm = get_tqdm()
111
+ for page in tqdm(range(1, total_page + 1), leave=False):
112
+ params.update(
113
+ {
114
+ "pn": page,
115
+ }
116
+ )
117
+ r = requests.get(url, params=params, timeout=15)
118
+ data_json = r.json()
119
+ inner_temp_df = pd.DataFrame(data_json["data"]["diff"])
120
+ temp_list.append(inner_temp_df)
121
+ temp_df = pd.concat(temp_list, ignore_index=True)
107
122
  temp_df.rename(
108
123
  columns={
109
- "index": "序号",
110
124
  "f12": "代码",
111
125
  "f14": "名称",
112
126
  "f2": "最新价",
@@ -124,7 +138,6 @@ def stock_hsgt_sh_hk_spot_em() -> pd.DataFrame:
124
138
 
125
139
  temp_df = temp_df[
126
140
  [
127
- "序号",
128
141
  "代码",
129
142
  "名称",
130
143
  "最新价",
@@ -147,6 +160,10 @@ def stock_hsgt_sh_hk_spot_em() -> pd.DataFrame:
147
160
  temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce") / 1000
148
161
  temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce") / 100000000
149
162
  temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce") / 100000000
163
+ temp_df.sort_values(["代码"], ignore_index=True, inplace=True)
164
+ temp_df.reset_index(inplace=True)
165
+ temp_df["index"] = temp_df["index"].astype(int) + 1
166
+ temp_df.rename(columns={"index": "序号"}, inplace=True)
150
167
  return temp_df
151
168
 
152
169
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: akshare
3
- Version: 1.16.33
3
+ Version: 1.16.35
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=149jwYrbRrBD45x85gXsT1vqZ13Q0tVet_QvKs6b7n8,190233
1
+ akshare/__init__.py,sha256=vAG55v1T8N_eCiPJG-o7jIrXQtUZpcwbcqVeE4tEZ9M,190342
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
@@ -115,7 +115,7 @@ akshare/futures/futures_comm_qihuo.py,sha256=uQfabZ63qME8sTaxUbIUVQBVi8yTaPPDhD7
115
115
  akshare/futures/futures_contract_detail.py,sha256=auwzNdaoFi5hoJY6rNkO54v5FD2gmEkQu7B90yEDtkc,1175
116
116
  akshare/futures/futures_daily_bar.py,sha256=pultXs8digLfWT0dzyWs0AtFk3Fi2uZDT-zxbg_PcOM,25299
117
117
  akshare/futures/futures_foreign.py,sha256=2cbMA-eug_jriDFwKZWmA_TbPW2GQAjscpZHBrs287E,2131
118
- akshare/futures/futures_hf_em.py,sha256=vEgJav-g_PNO_Jh4Xup27PIt-ARGqVk9TjNXK_3eC-E,7966
118
+ akshare/futures/futures_hf_em.py,sha256=eCksGjWRRWXUT61ulzc2UifjTQzC8BNOKqKq7JB20oU,7965
119
119
  akshare/futures/futures_hist_em.py,sha256=Q8I20qRjp2ujiJMCCNBvTHXmrIth22p2k6KpvbkC3dk,6472
120
120
  akshare/futures/futures_hq_sina.py,sha256=HZBAve1yxp1fnwgEy_2CqVoniTXRkt8KI3REt0N0TiY,9575
121
121
  akshare/futures/futures_index_ccidx.py,sha256=_kgWioCOpFNn8WUcL5qKHGb3rUHzrbrx2AszprKpBh4,4460
@@ -243,7 +243,7 @@ akshare/stock/stock_cg_guarantee.py,sha256=ts7qcQhhyN1PHB7Q4XlMn38HhfVvubOvky9RZ
243
243
  akshare/stock/stock_cg_lawsuit.py,sha256=6Y92pPw0JgyrInteqHuU07G1jwmdX2wjaDtrJN8y6Hg,4129
244
244
  akshare/stock/stock_dividend_cninfo.py,sha256=_vipLQu94qBDoPkaIWZKRFA0mFfgroUMnn5EdLcjAc4,3195
245
245
  akshare/stock/stock_dzjy_em.py,sha256=QMo2w-_I9UnmCr1IXk_InFeW5ok_GpRE9HdWFDUdGyM,22556
246
- akshare/stock/stock_fund_em.py,sha256=xGbMhFGOaxN7zhDlxcHWjo2WRZ95pu9dsvBSb2tDBYc,48972
246
+ akshare/stock/stock_fund_em.py,sha256=Ki7BC8XvkrJoMSfUf6bgH2t0JqPhTQQ2jgG8C43IjBA,49648
247
247
  akshare/stock/stock_fund_hold.py,sha256=iFEmRFber7MF6aPi0QOJxpvYjO7I26KouUvC-xTQdCk,6056
248
248
  akshare/stock/stock_gsrl_em.py,sha256=oy5vO681ZPTEehZgz10T8jgIQ8dNm_E7MXGr1PGoHqI,1951
249
249
  akshare/stock/stock_hk_famous.py,sha256=uF1iUkrwvMMxvxE3-O7byxQ-oS0SjlMBwOEraTBA41s,3018
@@ -256,7 +256,7 @@ akshare/stock/stock_hold_num_cninfo.py,sha256=JY9LcZMhhTiCHfQJv4pwMrLrpUxTKGLE4o
256
256
  akshare/stock/stock_hot_rank_em.py,sha256=WMbadW1CFU3ppZHMSPjG2HtXgs7PgYGugNqmyrRQQe4,7349
257
257
  akshare/stock/stock_hot_search_baidu.py,sha256=Zex1iZB2qaqsxYPj6EmuzAXLbAa53W8LcePivGwrwAs,1769
258
258
  akshare/stock/stock_hot_up_em.py,sha256=sRwbpAHLzAylobUAIlVKuQo8vbuTA0Jt6gb1oiSgNwA,2509
259
- akshare/stock/stock_hsgt_em.py,sha256=54eKgUM_F-bp6-bEsS2g5fQ928_6Fign76X8KCbWrMY,5250
259
+ akshare/stock/stock_hsgt_em.py,sha256=ZyKRk-ORYyZZkXMzg7-iUsXZTwzhGBsVCl2wzpPc4uw,5817
260
260
  akshare/stock/stock_industry.py,sha256=7axm0G1EZc-G6uX9mNX4d3bHHYS_hq2tKFytxEj9YJM,5767
261
261
  akshare/stock/stock_industry_cninfo.py,sha256=dJ19zPeKRTbUrAoa8fpBB25caZuIjX92RePG8Pz-9h8,6560
262
262
  akshare/stock/stock_industry_pe_cninfo.py,sha256=0OjjsFGG90zJRZEBqaCsjKSpSAgrp3PpXzMtom_ll_s,4287
@@ -388,8 +388,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
388
388
  akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
389
389
  tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
390
390
  tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
391
- akshare-1.16.33.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
392
- akshare-1.16.33.dist-info/METADATA,sha256=1BDAXIW9V6w6IgtZXJyMAgZOlsrTpTAdquBUNXdFrvI,13653
393
- akshare-1.16.33.dist-info/WHEEL,sha256=EaM1zKIUYa7rQnxGiOCGhzJABRwy4WO57rWMR3_tj4I,91
394
- akshare-1.16.33.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
395
- akshare-1.16.33.dist-info/RECORD,,
391
+ akshare-1.16.35.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
392
+ akshare-1.16.35.dist-info/METADATA,sha256=9e0Iq61KfT8dieIOQTPKWjvnebu4fnngqBOcEK__FDQ,13653
393
+ akshare-1.16.35.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
394
+ akshare-1.16.35.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
395
+ akshare-1.16.35.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.9.1)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5