akshare 1.14.82__py3-none-any.whl → 1.14.84__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
@@ -2893,9 +2893,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
2893
2893
  1.14.80 fix: fix stock_hot_rank_wc interface
2894
2894
  1.14.81 fix: fix stock_hsgt_hist_em interface
2895
2895
  1.14.82 fix: fix stock_comment_detail_scrd_desire_daily_em interface
2896
+ 1.14.83 fix: fix stock_comment_detail_zhpj_lspf_em interface
2897
+ 1.14.84 fix: fix drewry_wci_index interface
2896
2898
  """
2897
2899
 
2898
- __version__ = "1.14.82"
2900
+ __version__ = "1.14.84"
2899
2901
  __author__ = "AKFamily"
2900
2902
 
2901
2903
  import sys
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/9/30 15:30
4
+ Date: 2024/9/26 18:00
5
5
  Desc: Drewry 集装箱指数
6
6
  https://www.drewry.co.uk/supply-chain-advisors/supply-chain-expertise/world-container-index-assessed-by-drewry
7
7
  https://infogram.com/world-container-index-1h17493095xl4zj
8
8
  """
9
+
9
10
  import pandas as pd
10
11
  import requests
11
12
  from bs4 import BeautifulSoup
@@ -17,7 +18,8 @@ def drewry_wci_index(symbol: str = "composite") -> pd.DataFrame:
17
18
  """
18
19
  Drewry 集装箱指数
19
20
  https://infogram.com/world-container-index-1h17493095xl4zj
20
- :param symbol: choice of {"composite", "shanghai-rotterdam", "rotterdam-shanghai", "shanghai-los angeles", "los angeles-shanghai", "shanghai-genoa", "new york-rotterdam", "rotterdam-new york"}
21
+ :param symbol: choice of {"composite", "shanghai-rotterdam", "rotterdam-shanghai", "shanghai-los angeles",
22
+ "los angeles-shanghai", "shanghai-genoa", "new york-rotterdam", "rotterdam-new york"}
21
23
  :type symbol: str
22
24
  :return: Drewry 集装箱指数
23
25
  :rtype: pandas.DataFrame
@@ -34,24 +36,23 @@ def drewry_wci_index(symbol: str = "composite") -> pd.DataFrame:
34
36
  }
35
37
  url = "https://infogram.com/world-container-index-1h17493095xl4zj"
36
38
  r = requests.get(url)
37
- soup = BeautifulSoup(r.text, "lxml")
39
+ soup = BeautifulSoup(r.text, features="lxml")
38
40
  data_text = soup.find_all("script")[-4].string.strip("window.infographicData=")[:-1]
39
41
  data_json = demjson.decode(data_text)
40
- temp_df = pd.DataFrame(data_json["elements"][2]["data"][symbol_map[symbol]])
41
- temp_df = temp_df.iloc[1:, :]
42
+ data_json_need = data_json["elements"]["content"]["content"]["entities"][
43
+ "7a55585f-3fb3-44e6-9b54-beea1cd20b4d"
44
+ ]["data"][symbol_map[symbol]]
45
+ date_list = [item[0]["value"] for item in data_json_need[1:]]
46
+ try:
47
+ value_list = [item[1]["value"] for item in data_json_need[1:]]
48
+ except TypeError:
49
+ value_list = [item[1]["value"] for item in data_json_need[1:-1]]
50
+ temp_df = pd.DataFrame([date_list, value_list]).T
42
51
  temp_df.columns = ["date", "wci"]
43
- temp_df["date"] = [item["value"] for item in temp_df["date"]]
44
- temp_df["wci"] = [item["value"] for item in temp_df["wci"]]
45
- day = temp_df["date"].str.split("-", expand=True).iloc[:, 0].str.strip()
46
- month = temp_df["date"].str.split("-", expand=True).iloc[:, 1].str.strip()
47
- month = month.str.replace("July", "Jul")
48
- year = temp_df["date"].str.split("-", expand=True).iloc[:, 2].str.strip()
49
- temp_df["date"] = day + "-" + month + "-" + year
50
- # 修正数据源中日期格式的错误
51
- temp_df["date"] = temp_df["date"].str.replace("Sept", "Sep")
52
- temp_df["date"] = pd.to_datetime(temp_df["date"], format="%d-%b-%y").dt.date
52
+ temp_df["date"] = pd.to_datetime(
53
+ temp_df["date"], format="%d-%b-%y", errors="coerce"
54
+ ).dt.date
53
55
  temp_df["wci"] = pd.to_numeric(temp_df["wci"], errors="coerce")
54
- temp_df.reset_index(inplace=True, drop=True)
55
56
  return temp_df
56
57
 
57
58
 
@@ -28,7 +28,8 @@ def stock_comment_em() -> pd.DataFrame:
28
28
  "pageSize": "500",
29
29
  "pageNumber": "1",
30
30
  "reportName": "RPT_DMSK_TS_STOCKNEW",
31
- "quoteColumns": "f2~01~SECURITY_CODE~CLOSE_PRICE,f8~01~SECURITY_CODE~TURNOVERRATE,f3~01~SECURITY_CODE~CHANGE_RATE,f9~01~SECURITY_CODE~PE_DYNAMIC",
31
+ "quoteColumns": "f2~01~SECURITY_CODE~CLOSE_PRICE,f8~01~SECURITY_CODE~TURNOVERRATE,"
32
+ "f3~01~SECURITY_CODE~CHANGE_RATE,f9~01~SECURITY_CODE~PE_DYNAMIC",
32
33
  "columns": "ALL",
33
34
  "filter": "",
34
35
  "token": "894050c76af8597a853f5b408b759f5d",
@@ -137,11 +138,11 @@ def stock_comment_detail_zlkp_jgcyd_em(symbol: str = "600000") -> pd.DataFrame:
137
138
  data_json = r.json()
138
139
  temp_df = pd.DataFrame(data_json["result"]["data"])
139
140
  temp_df = temp_df[["TRADE_DATE", "ORG_PARTICIPATE"]]
140
- temp_df.columns = ["date", "value"]
141
- temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date
142
- temp_df.sort_values(["date"], inplace=True)
141
+ temp_df.columns = ["交易日", "机构参与度"]
142
+ temp_df["交易日"] = pd.to_datetime(temp_df["交易日"], errors="coerce").dt.date
143
+ temp_df.sort_values(["交易日"], inplace=True)
143
144
  temp_df.reset_index(inplace=True, drop=True)
144
- temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce") * 100
145
+ temp_df["机构参与度"] = pd.to_numeric(temp_df["机构参与度"], errors="coerce") * 100
145
146
  return temp_df
146
147
 
147
148
 
@@ -154,36 +155,31 @@ def stock_comment_detail_zhpj_lspf_em(symbol: str = "600000") -> pd.DataFrame:
154
155
  :return: 综合评价-历史评分
155
156
  :rtype: pandas.DataFrame
156
157
  """
157
- url = f"https://data.eastmoney.com/stockcomment/api/{symbol}.json"
158
- try_count = 10
159
- data_json = None
160
- while try_count:
161
- try:
162
- r = requests.get(url)
163
- data_json = r.json()
164
- break
165
- except requests.exceptions.JSONDecodeError:
166
- try_count -= 1
167
- time.sleep(1)
168
- continue
169
- current_year = data_json["ApiResults"]["zhpj"]["ComprehensiveScoreRank1"][0][0][
170
- "TradeDate"
171
- ].split("/")[0]
172
-
173
- temp_df = pd.DataFrame(
174
- [
175
- data_json["ApiResults"]["zhpj"]["HistoryScore"]["XData"],
176
- data_json["ApiResults"]["zhpj"]["HistoryScore"]["Ydata"]["Score"],
177
- data_json["ApiResults"]["zhpj"]["HistoryScore"]["Ydata"]["Price"],
178
- ]
179
- ).T
180
- temp_df.columns = ["日期", "评分", "股价"]
181
- temp_df["日期"] = current_year + "-" + temp_df["日期"]
182
- temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
183
- temp_df.sort_values(by=["日期"], inplace=True)
158
+ url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
159
+ params = {
160
+ "filter": f'(SECURITY_CODE="{symbol}")',
161
+ "columns": "ALL",
162
+ "source": "WEB",
163
+ "client": "WEB",
164
+ "reportName": "RPT_STOCK_HISTORYMARK",
165
+ "sortColumns": "DIAGNOSE_DATE",
166
+ "sortTypes": "1",
167
+ }
168
+ r = requests.get(url=url, params=params)
169
+ data_json = r.json()
170
+ temp_df = pd.DataFrame(data_json["result"]["data"])
171
+ temp_df.rename(
172
+ columns={
173
+ "TOTAL_SCORE": "评分",
174
+ "DIAGNOSE_DATE": "交易日",
175
+ },
176
+ inplace=True,
177
+ )
178
+ temp_df = temp_df[["交易日", "评分"]]
179
+ temp_df["交易日"] = pd.to_datetime(temp_df["交易日"], errors="coerce").dt.date
180
+ temp_df.sort_values(by=["交易日"], inplace=True)
184
181
  temp_df.reset_index(inplace=True, drop=True)
185
182
  temp_df["评分"] = pd.to_numeric(temp_df["评分"], errors="coerce")
186
- temp_df["股价"] = pd.to_numeric(temp_df["股价"], errors="coerce")
187
183
  return temp_df
188
184
 
189
185
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: akshare
3
- Version: 1.14.82
3
+ Version: 1.14.84
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=YO9Udam6vO1ZAFhd8UC05cTlFrdL4plge5YA8Ue3_JY,181919
1
+ akshare/__init__.py,sha256=siaAbZ64GnNdzkScy_hOfwhcG3zhBZGLWEgWtD90PLA,182024
2
2
  akshare/datasets.py,sha256=-qdwaQjgBlftX84uM74KJqCYJYkQ50PV416_neA4uls,995
3
3
  akshare/air/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
4
4
  akshare/air/air_hebei.py,sha256=xIXNGLK7IGYqrkteM9fxnHAwWqk6PCQs6D9-ggZ7byY,4442
@@ -158,7 +158,7 @@ akshare/index/index_cflp.py,sha256=iPn_0kePK74eScwC7rj0IhC-3w-kGQWtWlwsW-J0nbs,4
158
158
  akshare/index/index_cni.py,sha256=qravLXiETWlegIMV_EIUTDbGQfdC2zsj4LykWzC8Lko,8563
159
159
  akshare/index/index_cons.py,sha256=3jrDfdxhNr9c4NVsTVOyORZwKBFNUU8giERYoIKkUUY,7682
160
160
  akshare/index/index_cx.py,sha256=aAmsIKkswKFNOhAsW0QOhp-q6q1aFOSBtqcDaZhIh6A,16775
161
- akshare/index/index_drewry.py,sha256=PR38IXgKH5q_d5uli12Q_T4Y8cKlRO576uINehPWjgg,3175
161
+ akshare/index/index_drewry.py,sha256=BM7V6P8K4QUFQArsdaWRu5qJUZaCoyNz97_b8dmLeCw,2937
162
162
  akshare/index/index_eri.py,sha256=7X0KNDBntEkE_qSb2jb6IBv-S8PsevLFdxGT8nKT3W0,2111
163
163
  akshare/index/index_fear_greed_funddb.py,sha256=7Z6GqYkKPJHNHMEN-uZNu2KnNNLTWvJcVlYpfAShJJc,2378
164
164
  akshare/index/index_hog.py,sha256=kb867BVagt70_ycZMn22ks5Z9jlVbMiuTsvq5ygjeig,1657
@@ -296,7 +296,7 @@ akshare/stock_feature/stock_analyst_em.py,sha256=Md3_G-Px0O1lk4dx5dCEKl8Vjgwt79S
296
296
  akshare/stock_feature/stock_board_industry_ths.py,sha256=bn4vPXaK_ybU-qUttQshnzFC1L_S9reO2OydmAt7sGI,12488
297
297
  akshare/stock_feature/stock_buffett_index_lg.py,sha256=NpNccHmGjtqLz6aUladB6InPzO2pjoImbgCgmNEYUuM,2027
298
298
  akshare/stock_feature/stock_classify_sina.py,sha256=Lg7ROG5W9HioFRplJI2rZ6tAAHM09N3g9qF6kReIQYI,3210
299
- akshare/stock_feature/stock_comment_em.py,sha256=JX_CanyJdHPr-tAEobOJegk0csikJqcykBdzrxFUNDs,14180
299
+ akshare/stock_feature/stock_comment_em.py,sha256=xDq2a5j46VuqWHvB_WPZiv6NUZ4ln6dVxicYMGDNE_0,13947
300
300
  akshare/stock_feature/stock_concept_futu.py,sha256=jKJ9mfdJXgXwcMb3gVpbDl5ivr-zcMkuGO7jjgyA3os,6228
301
301
  akshare/stock_feature/stock_congestion_lg.py,sha256=iTEcmL0HoSqWGfxv_gSM-qA4O23aqUH7qHl9asDtoO0,1299
302
302
  akshare/stock_feature/stock_cyq_em.py,sha256=ijHL6BWGDLI8dctYQ4pYWDK2UHOSfn5mRu0c9E5zwp0,11017
@@ -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.14.82.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
- akshare-1.14.82.dist-info/METADATA,sha256=KcKXIUdRYEV1AvzrfsfGYiYCJgd0D0al40Z5sSzMcVc,14112
385
- akshare-1.14.82.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
386
- akshare-1.14.82.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
- akshare-1.14.82.dist-info/RECORD,,
383
+ akshare-1.14.84.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
384
+ akshare-1.14.84.dist-info/METADATA,sha256=dQ1bPRyg9ju6jfQG2hSJhIVA-I7jQLjs20dPBY1Jm0s,14112
385
+ akshare-1.14.84.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
386
+ akshare-1.14.84.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
387
+ akshare-1.14.84.dist-info/RECORD,,