akshare 1.16.33__py3-none-any.whl → 1.16.34__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,10 @@ 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
3045
3046
  """
3046
3047
 
3047
- __version__ = "1.16.33"
3048
+ __version__ = "1.16.34"
3048
3049
  __author__ = "AKFamily"
3049
3050
 
3050
3051
  import sys
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: akshare
3
- Version: 1.16.33
3
+ Version: 1.16.34
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=DutWejDt-Bjv3GwoxVtS2P2QUVlB9bRucy-j0-EH6YQ,190292
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_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
@@ -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.34.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
392
+ akshare-1.16.34.dist-info/METADATA,sha256=pddVy6ctAKgEYJFTjzhTNGbHbtTHCRhI-d91Lqg679g,13653
393
+ akshare-1.16.34.dist-info/WHEEL,sha256=EaM1zKIUYa7rQnxGiOCGhzJABRwy4WO57rWMR3_tj4I,91
394
+ akshare-1.16.34.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
395
+ akshare-1.16.34.dist-info/RECORD,,