akshare 1.14.76__py3-none-any.whl → 1.14.78__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 +3 -1
- akshare/stock/stock_xq.py +1 -1
- akshare/stock/stock_zh_b_sina.py +1 -1
- akshare/stock_feature/stock_analyst_em.py +36 -27
- {akshare-1.14.76.dist-info → akshare-1.14.78.dist-info}/METADATA +1 -1
- {akshare-1.14.76.dist-info → akshare-1.14.78.dist-info}/RECORD +9 -9
- {akshare-1.14.76.dist-info → akshare-1.14.78.dist-info}/WHEEL +1 -1
- {akshare-1.14.76.dist-info → akshare-1.14.78.dist-info}/LICENSE +0 -0
- {akshare-1.14.76.dist-info → akshare-1.14.78.dist-info}/top_level.txt +0 -0
akshare/__init__.py
CHANGED
|
@@ -2887,9 +2887,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
|
|
|
2887
2887
|
1.14.74 fix: fix stock_gpzy_pledge_ratio_em interface
|
|
2888
2888
|
1.14.75 fix: fix stock_sy_hy_em interface
|
|
2889
2889
|
1.14.76 fix: fix stock_sy_em interface
|
|
2890
|
+
1.14.77 fix: fix stock_zh_b_daily interface
|
|
2891
|
+
1.14.78 fix: fix stock_analyst_rank_em interface
|
|
2890
2892
|
"""
|
|
2891
2893
|
|
|
2892
|
-
__version__ = "1.14.
|
|
2894
|
+
__version__ = "1.14.78"
|
|
2893
2895
|
__author__ = "AKFamily"
|
|
2894
2896
|
|
|
2895
2897
|
import sys
|
akshare/stock/stock_xq.py
CHANGED
|
@@ -48,7 +48,7 @@ def stock_individual_spot_xq(
|
|
|
48
48
|
"""
|
|
49
49
|
session = requests.Session()
|
|
50
50
|
headers = {
|
|
51
|
-
"cookie": "xq_a_token=
|
|
51
|
+
"cookie": "xq_a_token=927886df384cbb16c88673ae7f519c76650c54b9;",
|
|
52
52
|
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 "
|
|
53
53
|
"(KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
|
|
54
54
|
}
|
akshare/stock/stock_zh_b_sina.py
CHANGED
|
@@ -367,7 +367,7 @@ def stock_zh_b_minute(
|
|
|
367
367
|
|
|
368
368
|
if __name__ == "__main__":
|
|
369
369
|
stock_zh_b_daily_hfq_df_one = stock_zh_b_daily(
|
|
370
|
-
symbol="sh900901", start_date="
|
|
370
|
+
symbol="sh900901", start_date="20071103", end_date="20240916", adjust=""
|
|
371
371
|
)
|
|
372
372
|
print(stock_zh_b_daily_hfq_df_one)
|
|
373
373
|
|
|
@@ -5,12 +5,14 @@ Date: 2023/8/20 20:00
|
|
|
5
5
|
Desc: 东方财富网-数据中心-研究报告-东方财富分析师指数
|
|
6
6
|
https://data.eastmoney.com/invest/invest/list.html
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
import pandas as pd
|
|
9
10
|
import requests
|
|
10
|
-
from tqdm import
|
|
11
|
+
from akshare.utils.tqdm import get_tqdm
|
|
12
|
+
from akshare.utils.cons import headers
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
def stock_analyst_rank_em(year: str = "
|
|
15
|
+
def stock_analyst_rank_em(year: str = "2024") -> pd.DataFrame:
|
|
14
16
|
"""
|
|
15
17
|
东方财富网-数据中心-研究报告-东方财富分析师指数-东方财富分析师指数
|
|
16
18
|
https://data.eastmoney.com/invest/invest/list.html
|
|
@@ -20,9 +22,6 @@ def stock_analyst_rank_em(year: str = "2023") -> pd.DataFrame:
|
|
|
20
22
|
:rtype: pandas.DataFrame
|
|
21
23
|
"""
|
|
22
24
|
url = "https://data.eastmoney.com/dataapi/invest/list"
|
|
23
|
-
headers = {
|
|
24
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
25
|
-
}
|
|
26
25
|
params = {
|
|
27
26
|
"sortColumns": "YEAR_YIELD",
|
|
28
27
|
"sortTypes": "-1",
|
|
@@ -40,12 +39,13 @@ def stock_analyst_rank_em(year: str = "2023") -> pd.DataFrame:
|
|
|
40
39
|
data_json = r.json()
|
|
41
40
|
total_page = data_json["result"]["pages"]
|
|
42
41
|
big_df = pd.DataFrame()
|
|
42
|
+
tqdm = get_tqdm()
|
|
43
43
|
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
44
44
|
params.update({"pageNumber": page})
|
|
45
45
|
r = requests.get(url, params=params, headers=headers)
|
|
46
46
|
data_json = r.json()
|
|
47
47
|
data_df = pd.DataFrame(data_json["result"]["data"])
|
|
48
|
-
big_df = pd.concat([big_df, data_df], ignore_index=True)
|
|
48
|
+
big_df = pd.concat(objs=[big_df, data_df], ignore_index=True)
|
|
49
49
|
|
|
50
50
|
big_df.reset_index(inplace=True)
|
|
51
51
|
big_df["index"] = list(range(1, len(big_df) + 1))
|
|
@@ -92,7 +92,9 @@ def stock_analyst_rank_em(year: str = "2023") -> pd.DataFrame:
|
|
|
92
92
|
]
|
|
93
93
|
big_df["更新日期"] = pd.to_datetime(big_df["更新日期"], errors="coerce").dt.date
|
|
94
94
|
big_df["年度指数"] = pd.to_numeric(big_df["年度指数"], errors="coerce")
|
|
95
|
-
big_df[f"{year}年收益率"] = pd.to_numeric(
|
|
95
|
+
big_df[f"{year}年收益率"] = pd.to_numeric(
|
|
96
|
+
big_df[f"{year}年收益率"], errors="coerce"
|
|
97
|
+
)
|
|
96
98
|
big_df["3个月收益率"] = pd.to_numeric(big_df["3个月收益率"], errors="coerce")
|
|
97
99
|
big_df["6个月收益率"] = pd.to_numeric(big_df["6个月收益率"], errors="coerce")
|
|
98
100
|
big_df["12个月收益率"] = pd.to_numeric(big_df["12个月收益率"], errors="coerce")
|
|
@@ -114,9 +116,6 @@ def stock_analyst_detail_em(
|
|
|
114
116
|
:rtype: pandas.DataFrame
|
|
115
117
|
"""
|
|
116
118
|
url = "https://datacenter.eastmoney.com/special/api/data/v1/get"
|
|
117
|
-
headers = {
|
|
118
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
119
|
-
}
|
|
120
119
|
if indicator == "最新跟踪成分股":
|
|
121
120
|
params = {
|
|
122
121
|
"reportName": "RPT_RESEARCHER_NTCSTOCK",
|
|
@@ -132,7 +131,7 @@ def stock_analyst_detail_em(
|
|
|
132
131
|
}
|
|
133
132
|
r = requests.get(url, params=params, headers=headers)
|
|
134
133
|
data_json = r.json()
|
|
135
|
-
temp_df = pd.DataFrame(data_json["result"][
|
|
134
|
+
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
136
135
|
temp_df.reset_index(inplace=True)
|
|
137
136
|
temp_df["index"] = list(range(1, len(temp_df) + 1))
|
|
138
137
|
temp_df.columns = [
|
|
@@ -164,9 +163,15 @@ def stock_analyst_detail_em(
|
|
|
164
163
|
"阶段涨跌幅",
|
|
165
164
|
]
|
|
166
165
|
]
|
|
167
|
-
temp_df["调入日期"] = pd.to_datetime(
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
temp_df["调入日期"] = pd.to_datetime(
|
|
167
|
+
temp_df["调入日期"], errors="coerce"
|
|
168
|
+
).dt.date
|
|
169
|
+
temp_df["最新评级日期"] = pd.to_datetime(
|
|
170
|
+
temp_df["最新评级日期"], errors="coerce"
|
|
171
|
+
).dt.date
|
|
172
|
+
temp_df["成交价格(前复权)"] = pd.to_numeric(
|
|
173
|
+
temp_df["成交价格(前复权)"], errors="coerce"
|
|
174
|
+
)
|
|
170
175
|
temp_df["最新价格"] = pd.to_numeric(temp_df["最新价格"], errors="coerce")
|
|
171
176
|
temp_df["阶段涨跌幅"] = pd.to_numeric(temp_df["阶段涨跌幅"], errors="coerce")
|
|
172
177
|
return temp_df
|
|
@@ -185,7 +190,7 @@ def stock_analyst_detail_em(
|
|
|
185
190
|
}
|
|
186
191
|
r = requests.get(url, params=params, headers=headers)
|
|
187
192
|
data_json = r.json()
|
|
188
|
-
temp_df = pd.DataFrame(data_json["result"][
|
|
193
|
+
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
189
194
|
temp_df.reset_index(inplace=True)
|
|
190
195
|
temp_df["index"] = list(range(1, len(temp_df) + 1))
|
|
191
196
|
temp_df.columns = [
|
|
@@ -214,8 +219,12 @@ def stock_analyst_detail_em(
|
|
|
214
219
|
"累计涨跌幅",
|
|
215
220
|
]
|
|
216
221
|
]
|
|
217
|
-
temp_df["调入日期"] = pd.to_datetime(
|
|
218
|
-
|
|
222
|
+
temp_df["调入日期"] = pd.to_datetime(
|
|
223
|
+
temp_df["调入日期"], errors="coerce"
|
|
224
|
+
).dt.date
|
|
225
|
+
temp_df["调出日期"] = pd.to_datetime(
|
|
226
|
+
temp_df["调出日期"], errors="coerce"
|
|
227
|
+
).dt.date
|
|
219
228
|
temp_df["累计涨跌幅"] = pd.to_numeric(temp_df["累计涨跌幅"], errors="coerce")
|
|
220
229
|
return temp_df
|
|
221
230
|
elif indicator == "历史指数":
|
|
@@ -231,22 +240,22 @@ def stock_analyst_detail_em(
|
|
|
231
240
|
}
|
|
232
241
|
r = requests.get(url, params=params, headers=headers)
|
|
233
242
|
data_json = r.json()
|
|
234
|
-
temp_df = pd.DataFrame(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
]
|
|
241
|
-
temp_df.columns = [
|
|
243
|
+
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
244
|
+
temp_df = temp_df[
|
|
245
|
+
[
|
|
246
|
+
"TRADE_DATE",
|
|
247
|
+
"INDEX_HVALUE",
|
|
248
|
+
]
|
|
249
|
+
]
|
|
250
|
+
temp_df.columns = ["date", "value"]
|
|
242
251
|
temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date
|
|
243
252
|
temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce")
|
|
244
|
-
temp_df.sort_values([
|
|
253
|
+
temp_df.sort_values(["date"], inplace=True, ignore_index=True)
|
|
245
254
|
return temp_df
|
|
246
255
|
|
|
247
256
|
|
|
248
257
|
if __name__ == "__main__":
|
|
249
|
-
stock_analyst_rank_em_df = stock_analyst_rank_em(year="
|
|
258
|
+
stock_analyst_rank_em_df = stock_analyst_rank_em(year="2024")
|
|
250
259
|
print(stock_analyst_rank_em_df)
|
|
251
260
|
|
|
252
261
|
stock_analyst_detail_em_df = stock_analyst_detail_em(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
akshare/__init__.py,sha256=
|
|
1
|
+
akshare/__init__.py,sha256=1hhjgDgUkwJJy4jo3abzWUtq08ur-7KLqzhHNQsysNc,181693
|
|
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
|
|
@@ -276,12 +276,12 @@ akshare/stock/stock_us_js.py,sha256=wwZpRvVHqjxwd0cb2O5vtRW8Zw90Kdl5O4XNwoevN64,
|
|
|
276
276
|
akshare/stock/stock_us_pink.py,sha256=jgkEjPm_qa4zSN1MH0unHJopSkcF-8Rqlp5Kus2KaQ8,3062
|
|
277
277
|
akshare/stock/stock_us_sina.py,sha256=3bD41Y5GqDTv52bx5jbjrt0psaHZS10UL_e7E2B6wW8,8146
|
|
278
278
|
akshare/stock/stock_weibo_nlp.py,sha256=eM7ofsNSrKiYeS0g38Qj9CxT6dkJZrn_pmziIiTqp4U,3286
|
|
279
|
-
akshare/stock/stock_xq.py,sha256=
|
|
279
|
+
akshare/stock/stock_xq.py,sha256=yFDfuAlO9lzXZPsBUy-1yajBi4vg0qLHPBS-wNoMHEg,4686
|
|
280
280
|
akshare/stock/stock_zh_a_sina.py,sha256=gryRmUwqF9PyNl-fPhD72y5nfNmLVEnvzjZDhAe-cpg,18862
|
|
281
281
|
akshare/stock/stock_zh_a_special.py,sha256=RRXkeZtRWm_maIPWgxvhBdX6eNybECjhSuEesZHRFJI,10294
|
|
282
282
|
akshare/stock/stock_zh_a_tick_tx.py,sha256=TJUAWLKAeoLEaVVJQlj0t-1smZGoAO0X0rPsUPVhZZ4,2131
|
|
283
283
|
akshare/stock/stock_zh_ah_tx.py,sha256=nq-dFlgHcgFS8in4HsbGyACTjfSTcixLaJC0yrQccbQ,9204
|
|
284
|
-
akshare/stock/stock_zh_b_sina.py,sha256=
|
|
284
|
+
akshare/stock/stock_zh_b_sina.py,sha256=5OkImYThNjEFxLpFWTcE-enn6_wV7MjfLWOfPWTNsYU,16058
|
|
285
285
|
akshare/stock/stock_zh_kcb_report.py,sha256=7zRovNGqXrPIYtUj9C3ivlYzfiudkaeBNiYPYlzDWkQ,2914
|
|
286
286
|
akshare/stock/stock_zh_kcb_sina.py,sha256=rpEOkqaOX5ebjs8B3teA1npBL8DpCQQXH8GRFu1ZY6o,9804
|
|
287
287
|
akshare/stock_feature/__init__.py,sha256=c2VDBGyg8nWZYLvtnnSqUoQ92Cu6dJ7UFOeJsB2Gff8,82
|
|
@@ -292,7 +292,7 @@ akshare/stock_feature/stock_a_indicator.py,sha256=jOb9EVtPgcDPVziy_ZAo0RqHL3eovi
|
|
|
292
292
|
akshare/stock_feature/stock_a_pe_and_pb.py,sha256=8R67gE1vUYtu9bLbZNXD88kHMcKSnBJNFMjvuZ2qcBQ,18307
|
|
293
293
|
akshare/stock_feature/stock_account_em.py,sha256=PA-531xnv5uerFrYGc40mk8q8O0DGciHC_XVlE9udis,3342
|
|
294
294
|
akshare/stock_feature/stock_all_pb.py,sha256=2yQLq03qXNbTB5AtJ-Q8uJldOluElH5zTjYneY3aaZ0,1194
|
|
295
|
-
akshare/stock_feature/stock_analyst_em.py,sha256=
|
|
295
|
+
akshare/stock_feature/stock_analyst_em.py,sha256=Md3_G-Px0O1lk4dx5dCEKl8Vjgwt79Sh-FSh_sW1Elo,9508
|
|
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
|
|
@@ -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.
|
|
384
|
-
akshare-1.14.
|
|
385
|
-
akshare-1.14.
|
|
386
|
-
akshare-1.14.
|
|
387
|
-
akshare-1.14.
|
|
383
|
+
akshare-1.14.78.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
|
|
384
|
+
akshare-1.14.78.dist-info/METADATA,sha256=8BPp0KkoBJHt9tfu04cd05-zoeUQD9ihwC28xZGbhGI,14112
|
|
385
|
+
akshare-1.14.78.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
386
|
+
akshare-1.14.78.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
|
|
387
|
+
akshare-1.14.78.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|