akshare 1.14.65__py3-none-any.whl → 1.14.67__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/cost/cost_living.py +7 -5
- akshare/futures/futures_hq_sina.py +3 -2
- akshare/stock/stock_rank_forecast.py +6 -5
- akshare/stock_fundamental/stock_profit_forecast_ths.py +19 -10
- {akshare-1.14.65.dist-info → akshare-1.14.67.dist-info}/METADATA +1 -1
- {akshare-1.14.65.dist-info → akshare-1.14.67.dist-info}/RECORD +11 -11
- {akshare-1.14.65.dist-info → akshare-1.14.67.dist-info}/WHEEL +1 -1
- tests/test_func.py +3 -5
- {akshare-1.14.65.dist-info → akshare-1.14.67.dist-info}/LICENSE +0 -0
- {akshare-1.14.65.dist-info → akshare-1.14.67.dist-info}/top_level.txt +0 -0
akshare/__init__.py
CHANGED
|
@@ -2876,9 +2876,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
|
|
|
2876
2876
|
1.14.63 add: add spot_quotations_sge interface
|
|
2877
2877
|
1.14.64 fix: fix stock_board_industry_spot_em interface
|
|
2878
2878
|
1.14.65 fix: fix option_dce_daily interface
|
|
2879
|
+
1.14.66 fix: fix stock_profit_forecast_ths interface
|
|
2880
|
+
1.14.67 fix: fix futures_foreign_commodity_realtime interface
|
|
2879
2881
|
"""
|
|
2880
2882
|
|
|
2881
|
-
__version__ = "1.14.
|
|
2883
|
+
__version__ = "1.14.67"
|
|
2882
2884
|
__author__ = "AKFamily"
|
|
2883
2885
|
|
|
2884
2886
|
import sys
|
akshare/cost/cost_living.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date: 2024/
|
|
4
|
+
Date: 2024/8/28 15:20
|
|
5
5
|
Desc: 世界各大城市生活成本数据
|
|
6
6
|
https://expatistan.com/cost-of-living/index
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
from io import StringIO
|
|
9
10
|
|
|
10
11
|
import pandas as pd
|
|
@@ -20,14 +21,14 @@ def _get_region() -> dict:
|
|
|
20
21
|
"""
|
|
21
22
|
url = "https://www.expatistan.com/cost-of-living/index"
|
|
22
23
|
r = requests.get(url)
|
|
23
|
-
soup = BeautifulSoup(r.text, "lxml")
|
|
24
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
|
24
25
|
half_url_list = [
|
|
25
26
|
item["href"]
|
|
26
|
-
for item in soup.find("ul", attrs={"class": "regions"}).find_all("a")
|
|
27
|
+
for item in soup.find(name="ul", attrs={"class": "regions"}).find_all("a")
|
|
27
28
|
]
|
|
28
29
|
name_list = [
|
|
29
30
|
item["href"].split("/")[-1]
|
|
30
|
-
for item in soup.find("ul", attrs={"class": "regions"}).find_all("a")
|
|
31
|
+
for item in soup.find(name="ul", attrs={"class": "regions"}).find_all("a")
|
|
31
32
|
]
|
|
32
33
|
name_url_dict = dict(zip(name_list, half_url_list))
|
|
33
34
|
name_url_dict["world"] = "/cost-of-living/index"
|
|
@@ -38,7 +39,8 @@ def cost_living(symbol: str = "world") -> pd.DataFrame:
|
|
|
38
39
|
"""
|
|
39
40
|
国家或地区生活成本数据
|
|
40
41
|
https://expatistan.com/cost-of-living/index
|
|
41
|
-
:param symbol: choice of {"europe", "north-america", "latin-america",
|
|
42
|
+
:param symbol: choice of {"europe", "north-america", "latin-america",
|
|
43
|
+
"asia", "middle-east", "africa", "oceania", "world"}
|
|
42
44
|
:type symbol: str
|
|
43
45
|
:return: 国家或地区生活成本数据
|
|
44
46
|
:rtype: pandas.DataFrame
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date: 2024/8/
|
|
4
|
+
Date: 2024/8/31 17:30
|
|
5
5
|
Desc: 新浪财经-外盘期货
|
|
6
6
|
https://finance.sina.com.cn/money/future/hf.html
|
|
7
7
|
"""
|
|
@@ -63,9 +63,10 @@ def futures_hq_subscribe_exchange_symbol() -> pd.DataFrame:
|
|
|
63
63
|
:rtype: pandas.DataFrame
|
|
64
64
|
"""
|
|
65
65
|
inner_dict = {
|
|
66
|
-
"
|
|
66
|
+
"新加坡铁矿石": "FEF",
|
|
67
67
|
"马棕油": "FCPO",
|
|
68
68
|
"日橡胶": "RSS3",
|
|
69
|
+
"美国原糖": "RS",
|
|
69
70
|
"CME比特币期货": "BTC",
|
|
70
71
|
"NYBOT-棉花": "CT",
|
|
71
72
|
"LME镍3个月": "NID",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/8/28 15:30
|
|
5
5
|
Desc: 巨潮资讯-数据中心-评级预测-投资评级
|
|
6
|
-
|
|
6
|
+
https://webapi.cninfo.com.cn/#/thematicStatistics?name=%E6%8A%95%E8%B5%84%E8%AF%84%E7%BA%A7
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import pandas as pd
|
|
@@ -22,7 +22,7 @@ def _get_file_content_cninfo(file: str = "cninfo.js") -> str:
|
|
|
22
22
|
:rtype: str
|
|
23
23
|
"""
|
|
24
24
|
setting_file_path = get_ths_js(file)
|
|
25
|
-
with open(setting_file_path) as f:
|
|
25
|
+
with open(setting_file_path, encoding="utf-8") as f:
|
|
26
26
|
file_data = f.read()
|
|
27
27
|
return file_data
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ def _get_file_content_cninfo(file: str = "cninfo.js") -> str:
|
|
|
30
30
|
def stock_rank_forecast_cninfo(date: str = "20230817") -> pd.DataFrame:
|
|
31
31
|
"""
|
|
32
32
|
巨潮资讯-数据中心-评级预测-投资评级
|
|
33
|
-
|
|
33
|
+
https://webapi.cninfo.com.cn/#/thematicStatistics?name=%E6%8A%95%E8%B5%84%E8%AF%84%E7%BA%A7
|
|
34
34
|
:param date: 查询日期
|
|
35
35
|
:type date: str
|
|
36
36
|
:return: 投资评级
|
|
@@ -54,7 +54,8 @@ def stock_rank_forecast_cninfo(date: str = "20230817") -> pd.DataFrame:
|
|
|
54
54
|
"Pragma": "no-cache",
|
|
55
55
|
"Proxy-Connection": "keep-alive",
|
|
56
56
|
"Referer": "http://webapi.cninfo.com.cn/",
|
|
57
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
57
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
58
|
+
"Chrome/93.0.4577.63 Safari/537.36",
|
|
58
59
|
"X-Requested-With": "XMLHttpRequest",
|
|
59
60
|
}
|
|
60
61
|
r = requests.post(url, params=params, headers=headers)
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/8/28 15:00
|
|
5
5
|
Desc: 同花顺-盈利预测
|
|
6
6
|
https://basic.10jqka.com.cn/new/600519/worth.html
|
|
7
7
|
"""
|
|
8
|
+
|
|
9
|
+
from io import StringIO
|
|
10
|
+
|
|
8
11
|
import pandas as pd
|
|
9
12
|
import requests
|
|
10
13
|
|
|
14
|
+
from akshare.utils.cons import headers
|
|
15
|
+
|
|
11
16
|
|
|
12
17
|
def stock_profit_forecast_ths(
|
|
13
18
|
symbol: str = "600519", indicator: str = "预测年报每股收益"
|
|
@@ -23,21 +28,18 @@ def stock_profit_forecast_ths(
|
|
|
23
28
|
:rtype: pandas.DataFrame
|
|
24
29
|
"""
|
|
25
30
|
url = f"https://basic.10jqka.com.cn/new/{symbol}/worth.html"
|
|
26
|
-
headers = {
|
|
27
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
|
|
28
|
-
}
|
|
29
31
|
r = requests.get(url, headers=headers)
|
|
30
32
|
r.encoding = "gbk"
|
|
31
33
|
if indicator == "预测年报每股收益":
|
|
32
|
-
temp_df = pd.read_html(r.text)[0]
|
|
34
|
+
temp_df = pd.read_html(StringIO(r.text))[0]
|
|
33
35
|
temp_df["年度"] = temp_df["年度"].astype(str)
|
|
34
36
|
return temp_df
|
|
35
37
|
if indicator == "预测年报净利润":
|
|
36
|
-
temp_df = pd.read_html(r.text)[1]
|
|
38
|
+
temp_df = pd.read_html(StringIO(r.text))[1]
|
|
37
39
|
temp_df["年度"] = temp_df["年度"].astype(str)
|
|
38
40
|
return temp_df
|
|
39
41
|
if indicator == "业绩预测详表-机构":
|
|
40
|
-
temp_df = pd.read_html(r.text)[2]
|
|
42
|
+
temp_df = pd.read_html(StringIO(r.text))[2]
|
|
41
43
|
columns_list = []
|
|
42
44
|
for item in temp_df.columns:
|
|
43
45
|
columns_list.append(item[1])
|
|
@@ -51,7 +53,7 @@ def stock_profit_forecast_ths(
|
|
|
51
53
|
temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"]).dt.date
|
|
52
54
|
return temp_df
|
|
53
55
|
if indicator == "业绩预测详表-详细指标预测":
|
|
54
|
-
temp_df = pd.read_html(r.text)[3]
|
|
56
|
+
temp_df = pd.read_html(StringIO(r.text))[3]
|
|
55
57
|
temp_df.columns = [
|
|
56
58
|
item.replace("(", "-").replace(")", "") for item in temp_df.columns
|
|
57
59
|
]
|
|
@@ -59,6 +61,13 @@ def stock_profit_forecast_ths(
|
|
|
59
61
|
|
|
60
62
|
|
|
61
63
|
if __name__ == "__main__":
|
|
62
|
-
for
|
|
63
|
-
|
|
64
|
+
for _item in [
|
|
65
|
+
"预测年报每股收益",
|
|
66
|
+
"预测年报净利润",
|
|
67
|
+
"业绩预测详表-机构",
|
|
68
|
+
"业绩预测详表-详细指标预测",
|
|
69
|
+
]:
|
|
70
|
+
stock_profit_forecast_ths_df = stock_profit_forecast_ths(
|
|
71
|
+
symbol="600519", indicator=_item
|
|
72
|
+
)
|
|
64
73
|
print(stock_profit_forecast_ths_df)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
akshare/__init__.py,sha256
|
|
1
|
+
akshare/__init__.py,sha256=yW8MnZvK9KBycyLgQuK7W7sVrc3kdHHdQc7PMN8ml1Y,181213
|
|
2
2
|
akshare/datasets.py,sha256=oIu1zC7o_LMHY22lQmdM7vCnryHibKrJLBqJwQiitlI,1167
|
|
3
3
|
akshare/air/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
|
|
4
4
|
akshare/air/air_hebei.py,sha256=xIXNGLK7IGYqrkteM9fxnHAwWqk6PCQs6D9-ggZ7byY,4442
|
|
@@ -33,7 +33,7 @@ akshare/bond/bond_zh_cov.py,sha256=yL77itRK0rFCeQP_M524lW1740D5Q1IZW6eLvjXf2H4,2
|
|
|
33
33
|
akshare/bond/bond_zh_sina.py,sha256=msj7upgqaCTzC_MxzhUm7hVKtzHeWRUjlcjvZn2zlbw,4654
|
|
34
34
|
akshare/bond/cons.py,sha256=SGqjMqRYwJlEb8UczxdcrtcD7I2SAVULXARGEedEQfE,1792
|
|
35
35
|
akshare/cost/__init__.py,sha256=x1R9hH6E0M7C86XhHFzbPiipUWz9IknuhVZrk4gZus4,82
|
|
36
|
-
akshare/cost/cost_living.py,sha256=
|
|
36
|
+
akshare/cost/cost_living.py,sha256=_yoGEW4jBfpjhgMxCXvMtBbrCx2PEuOngV3laEoEOvk,2078
|
|
37
37
|
akshare/crypto/__init__.py,sha256=lbmNMPPLGkW9AgGL4ZnCwoQvPjOFPDNUz6P3arSkNI0,83
|
|
38
38
|
akshare/crypto/crypto_bitcoin_cme.py,sha256=IO4dxPj-kwtJXo9F_h5tH64__yeDQXs2cavCkgxxp1I,2436
|
|
39
39
|
akshare/crypto/crypto_hist_investing.py,sha256=tIeEkFur-u-E2_-R4I_Zy0s_VFnR03CCl4GpgJkLYJw,9748
|
|
@@ -110,7 +110,7 @@ akshare/futures/futures_contract_detail.py,sha256=auwzNdaoFi5hoJY6rNkO54v5FD2gmE
|
|
|
110
110
|
akshare/futures/futures_daily_bar.py,sha256=mD7n1K0FSIwA6CREkIjkcPvLaGb1Q7uGc-qrb1hI5j4,25227
|
|
111
111
|
akshare/futures/futures_foreign.py,sha256=oSIoAg5oy-CIlPWHkQffcvZGu02Y2GWOrt-6aPA53Xg,2059
|
|
112
112
|
akshare/futures/futures_hf_em.py,sha256=OEUltaq1LKabl9eTQoNxswnl1BLKpB27eiIHwbu_Rh4,3178
|
|
113
|
-
akshare/futures/futures_hq_sina.py,sha256=
|
|
113
|
+
akshare/futures/futures_hq_sina.py,sha256=eK1gEan4DPvpYmln8-tNnzh_J_733s95DBr--NqNYVA,9576
|
|
114
114
|
akshare/futures/futures_index_ccidx.py,sha256=9Rhk3ps-H69tU-NIV0W2NdLFUDTSUx0bwtePA6gLMZA,4566
|
|
115
115
|
akshare/futures/futures_international.py,sha256=EE_JTjQKekx8_FU8M12wHSd1DSlfMXYFiBJ6_wmThfc,6946
|
|
116
116
|
akshare/futures/futures_inventory_99.py,sha256=Nvw39obGGhgOkk_C4jOrV4gdq78dtHPOnits_B0Ljxk,8450
|
|
@@ -265,7 +265,7 @@ akshare/stock/stock_ipo_summary_cninfo.py,sha256=Ma-54GsOOhRWxilLH-Qmm0VVbpJQGf2
|
|
|
265
265
|
akshare/stock/stock_new_cninfo.py,sha256=EOuZowDLQSSHyPAwXcuPXbQkqhbz2nRBZsM7o2ZWILE,5725
|
|
266
266
|
akshare/stock/stock_news_cx.py,sha256=IuNo67ToW6SNT9aZVTDqQMnlLFw4QV-_FWSw-9vgfB4,1055
|
|
267
267
|
akshare/stock/stock_profile_cninfo.py,sha256=tiEPnoH7IGp9DV1kMQNGIXuVOWpQFl_BS_RX_ijM4BI,3163
|
|
268
|
-
akshare/stock/stock_rank_forecast.py,sha256=
|
|
268
|
+
akshare/stock/stock_rank_forecast.py,sha256=5U0fa4tzhqKrw5kDRahUCFSrbrEx_aRtlqZq2mpeJaU,3199
|
|
269
269
|
akshare/stock/stock_repurchase_em.py,sha256=XVAUD_yd48wqxbMbfU0Ne2SNFOSG9NBklUhf3pl6cKc,5000
|
|
270
270
|
akshare/stock/stock_share_changes_cninfo.py,sha256=zg-1KHPbxdMRMr4wYY8LA30D-u47YesbEDt_MgCMk_k,4846
|
|
271
271
|
akshare/stock/stock_share_hold.py,sha256=uToDxxnaD9nVtsidq0kVK-LzWU4XZdZBdzJnJvywAfI,10959
|
|
@@ -364,7 +364,7 @@ akshare/stock_fundamental/stock_mda_ym.py,sha256=OdWTiZc0HhTOgGtDiIN1A-u2K51eMZa
|
|
|
364
364
|
akshare/stock_fundamental/stock_notice.py,sha256=tGxGz1Usr3qQzgs1Y71imDPkqJz5ooismz3BiaBwQR0,3928
|
|
365
365
|
akshare/stock_fundamental/stock_profit_forecast_em.py,sha256=QP7jgMwto9o1zc1vDl9BBeta_lgxA13NMbijs9eqjRs,5377
|
|
366
366
|
akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py,sha256=dQaqxi0wXOidIuAxjUzZy_gdy16HEi20I3jEdpNM3qc,5179
|
|
367
|
-
akshare/stock_fundamental/stock_profit_forecast_ths.py,sha256=
|
|
367
|
+
akshare/stock_fundamental/stock_profit_forecast_ths.py,sha256=ZTShEB5w1y5j6TsHzWT8QR8oatbBTdE1H0IIxPLHn9s,2656
|
|
368
368
|
akshare/stock_fundamental/stock_recommend.py,sha256=44l1uLofwO-nsDB4oAYWpHQA7_qhXLOo1BurjUvmXzY,4501
|
|
369
369
|
akshare/stock_fundamental/stock_register_em.py,sha256=QxQh7kddjXLainVVugvOCYG8nDyOv31I8npQmXw3Ccs,15643
|
|
370
370
|
akshare/stock_fundamental/stock_restricted_em.py,sha256=e5G3oiZBf9d_a8quX5nLzn3RggeF4yX3j-h3nAZBRmA,13378
|
|
@@ -379,9 +379,9 @@ akshare/utils/func.py,sha256=PDkwpyCjZCbCLSAG9wBQt-sYNtb1XlpUBvhAfuSLf3s,586
|
|
|
379
379
|
akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOeQ,666
|
|
380
380
|
akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
|
|
381
381
|
tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
|
|
382
|
-
tests/test_func.py,sha256=
|
|
383
|
-
akshare-1.14.
|
|
384
|
-
akshare-1.14.
|
|
385
|
-
akshare-1.14.
|
|
386
|
-
akshare-1.14.
|
|
387
|
-
akshare-1.14.
|
|
382
|
+
tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
|
|
383
|
+
akshare-1.14.67.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
|
|
384
|
+
akshare-1.14.67.dist-info/METADATA,sha256=InuyRC-Gi3_ULtvB2OyYh6ughdk6SPaahsWdohd9bNc,13961
|
|
385
|
+
akshare-1.14.67.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
386
|
+
akshare-1.14.67.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
|
|
387
|
+
akshare-1.14.67.dist-info/RECORD,,
|
tests/test_func.py
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date: 2024/
|
|
4
|
+
Date: 2024/8/28 15:00
|
|
5
5
|
Desc: To test intention, just write test code here!
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import pathlib
|
|
9
9
|
|
|
10
|
-
from akshare.cost.cost_living import cost_living
|
|
11
10
|
from akshare.datasets import get_ths_js, get_crypto_info_csv
|
|
12
11
|
|
|
13
12
|
|
|
@@ -17,8 +16,7 @@ def test_cost_living():
|
|
|
17
16
|
:return: assert result
|
|
18
17
|
:rtype: assert
|
|
19
18
|
"""
|
|
20
|
-
|
|
21
|
-
assert cost_living_df.shape[0] > 0
|
|
19
|
+
pass
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
def test_path_func():
|
|
@@ -42,6 +40,6 @@ def test_zipfile_func():
|
|
|
42
40
|
|
|
43
41
|
|
|
44
42
|
if __name__ == "__main__":
|
|
45
|
-
test_cost_living()
|
|
43
|
+
# test_cost_living()
|
|
46
44
|
test_path_func()
|
|
47
45
|
test_zipfile_func()
|
|
File without changes
|
|
File without changes
|