akshare 1.12.99__py3-none-any.whl → 1.15.73__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 +442 -138
- akshare/air/air_hebei.py +79 -53
- akshare/air/air_zhenqi.py +29 -43
- akshare/air/sunrise_tad.py +32 -17
- akshare/bank/bank_cbirc_2020.py +12 -9
- akshare/bond/bond_cb_ths.py +17 -9
- akshare/bond/bond_china.py +38 -39
- akshare/bond/bond_china_money.py +75 -48
- akshare/bond/bond_info_cm.py +28 -8
- akshare/bond/bond_issue_cninfo.py +73 -30
- akshare/bond/bond_zh_cov.py +1 -1
- akshare/bond/bond_zh_sina.py +57 -51
- akshare/cal/__init__.py +0 -0
- akshare/cal/rv.py +170 -0
- akshare/cost/cost_living.py +7 -5
- akshare/currency/currency_safe.py +7 -6
- akshare/data/cninfo.js +15 -0
- akshare/datasets.py +10 -21
- akshare/economic/macro_bank.py +95 -653
- akshare/economic/macro_china.py +772 -1024
- akshare/economic/macro_china_hk.py +65 -243
- akshare/economic/macro_china_nbs.py +24 -7
- akshare/economic/macro_constitute.py +17 -12
- akshare/economic/macro_euro.py +13 -6
- akshare/economic/macro_finance_ths.py +133 -0
- akshare/economic/macro_info_ws.py +100 -0
- akshare/economic/macro_japan.py +5 -4
- akshare/economic/macro_other.py +12 -9
- akshare/economic/macro_usa.py +376 -1940
- akshare/economic/marco_cnbs.py +11 -6
- akshare/energy/energy_carbon.py +94 -125
- akshare/event/migration.py +3 -2
- akshare/exceptions.py +43 -0
- akshare/file_fold/calendar.json +245 -2
- akshare/fortune/fortune_500.py +15 -48
- akshare/fund/fund_amac.py +157 -75
- akshare/fund/fund_em.py +191 -184
- akshare/fund/fund_etf_em.py +16 -15
- akshare/fund/fund_etf_sina.py +71 -23
- akshare/fund/fund_etf_ths.py +93 -0
- akshare/fund/fund_fee_em.py +98 -0
- akshare/fund/fund_portfolio_em.py +60 -50
- akshare/fund/fund_rank_em.py +91 -82
- akshare/fund/fund_report_cninfo.py +63 -48
- akshare/fund/fund_scale_sina.py +20 -10
- akshare/fund/fund_xq.py +139 -109
- akshare/futures/cons.py +8 -31
- akshare/futures/cot.py +185 -137
- akshare/futures/futures_basis.py +97 -32
- akshare/futures/futures_comm_ctp.py +37 -0
- akshare/futures/futures_comm_qihuo.py +74 -45
- akshare/futures/futures_daily_bar.py +121 -184
- akshare/futures/futures_hf_em.py +66 -61
- akshare/futures/futures_hq_sina.py +79 -61
- akshare/futures/futures_index_ccidx.py +6 -3
- akshare/futures/futures_inventory_99.py +61 -272
- akshare/futures/futures_news_shmet.py +4 -2
- akshare/futures/futures_roll_yield.py +12 -25
- akshare/futures/futures_spot_stock_em.py +19 -13
- akshare/futures/futures_stock_js.py +14 -12
- akshare/futures/futures_to_spot.py +38 -33
- akshare/futures/futures_warehouse_receipt.py +75 -71
- akshare/futures/futures_zh_sina.py +5 -5
- akshare/futures/symbol_var.py +18 -13
- akshare/futures_derivative/futures_contract_info_czce.py +60 -52
- akshare/futures_derivative/futures_contract_info_ine.py +43 -34
- akshare/futures_derivative/futures_contract_info_shfe.py +46 -35
- akshare/futures_derivative/futures_cot_sina.py +26 -19
- akshare/futures_derivative/futures_spot_sys.py +21 -8
- akshare/fx/currency_investing.py +19 -285
- akshare/index/index_cflp.py +29 -26
- akshare/index/index_cni.py +86 -88
- akshare/index/index_cons.py +26 -10
- akshare/index/index_cx.py +248 -47
- akshare/index/index_drewry.py +17 -16
- akshare/index/index_option_qvix.py +329 -0
- akshare/index/index_research_fund_sw.py +134 -0
- akshare/index/{index_sw_research.py → index_research_sw.py} +122 -58
- akshare/index/index_spot.py +9 -5
- akshare/index/index_stock_hk.py +35 -16
- akshare/index/index_stock_us_sina.py +1 -1
- akshare/index/index_stock_zh.py +180 -89
- akshare/index/index_stock_zh_csindex.py +15 -369
- akshare/index/index_sw.py +62 -34
- akshare/index/index_yw.py +46 -23
- akshare/index/index_zh_a_scope.py +48 -0
- akshare/index/index_zh_em.py +6 -4
- akshare/interest_rate/interbank_rate_em.py +14 -9
- akshare/movie/artist_yien.py +32 -5
- akshare/movie/movie_yien.py +92 -18
- akshare/movie/video_yien.py +28 -5
- akshare/news/news_baidu.py +78 -44
- akshare/news/news_cctv.py +38 -38
- akshare/news/news_stock.py +6 -3
- akshare/nlp/nlp_interface.py +7 -8
- akshare/option/cons.py +11 -11
- akshare/option/option_comm_qihuo.py +86 -0
- akshare/option/option_commodity.py +178 -51
- akshare/option/option_daily_stats_sse_szse.py +146 -0
- akshare/option/option_em.py +147 -138
- akshare/option/option_finance_sina.py +160 -137
- akshare/option/option_lhb_em.py +62 -56
- akshare/option/option_risk_indicator_sse.py +17 -14
- akshare/other/other_car_cpca.py +934 -0
- akshare/other/{other_car.py → other_car_gasgoo.py} +15 -54
- akshare/qdii/__init__.py +0 -0
- akshare/qdii/qdii_jsl.py +233 -0
- akshare/request.py +117 -0
- akshare/spot/spot_hog_soozhu.py +232 -0
- akshare/spot/spot_price_qh.py +121 -0
- akshare/spot/spot_sge.py +63 -10
- akshare/stock/stock_allotment_cninfo.py +10 -9
- akshare/stock/stock_board_concept_em.py +23 -14
- akshare/stock/stock_board_industry_em.py +40 -34
- akshare/stock/stock_cg_equity_mortgage.py +15 -11
- akshare/stock/stock_cg_guarantee.py +41 -51
- akshare/stock/stock_cg_lawsuit.py +36 -35
- akshare/stock/stock_dividend_cninfo.py +12 -6
- akshare/stock/stock_dzjy_em.py +347 -260
- akshare/stock/stock_fund_em.py +332 -84
- akshare/stock/stock_hk_famous.py +108 -0
- akshare/stock/stock_hk_sina.py +8 -7
- akshare/stock/stock_hold_control_cninfo.py +100 -15
- akshare/stock/stock_hold_control_em.py +4 -3
- akshare/stock/stock_hold_num_cninfo.py +18 -12
- akshare/stock/stock_hot_rank_em.py +2 -1
- akshare/stock/stock_hot_search_baidu.py +5 -2
- akshare/stock/stock_industry_cninfo.py +24 -18
- akshare/stock/stock_industry_pe_cninfo.py +45 -31
- akshare/stock/stock_industry_sw.py +9 -10
- akshare/stock/stock_info.py +25 -15
- akshare/stock/stock_info_em.py +5 -2
- akshare/stock/stock_intraday_em.py +5 -2
- akshare/stock/stock_intraday_sina.py +22 -18
- akshare/stock/stock_ipo_summary_cninfo.py +25 -10
- akshare/stock/stock_new_cninfo.py +32 -19
- akshare/stock/stock_news_cx.py +39 -0
- akshare/stock/stock_profile_cninfo.py +9 -8
- akshare/stock/stock_rank_forecast.py +8 -6
- akshare/stock/stock_share_changes_cninfo.py +18 -14
- akshare/stock/stock_share_hold.py +24 -19
- akshare/stock/stock_summary.py +54 -26
- akshare/stock/stock_us_famous.py +15 -6
- akshare/stock/stock_us_pink.py +7 -5
- akshare/stock/stock_us_sina.py +15 -12
- akshare/stock/stock_xq.py +38 -12
- akshare/stock/stock_zh_a_sina.py +53 -78
- akshare/stock/stock_zh_b_sina.py +32 -55
- akshare/stock/stock_zh_kcb_report.py +11 -9
- akshare/stock/stock_zh_kcb_sina.py +67 -64
- akshare/stock_feature/stock_a_below_net_asset_statistics.py +5 -2
- akshare/stock_feature/stock_a_high_low.py +5 -2
- akshare/stock_feature/stock_a_indicator.py +12 -9
- akshare/stock_feature/stock_a_pe_and_pb.py +27 -6
- akshare/stock_feature/stock_account_em.py +58 -40
- akshare/stock_feature/stock_analyst_em.py +36 -27
- akshare/stock_feature/stock_board_industry_ths.py +136 -400
- akshare/stock_feature/stock_comment_em.py +118 -85
- akshare/stock_feature/stock_concept_futu.py +183 -0
- akshare/stock_feature/stock_cyq_em.py +58 -54
- akshare/stock_feature/stock_disclosure_cninfo.py +147 -102
- akshare/stock_feature/stock_esg_sina.py +216 -11
- akshare/stock_feature/stock_fhps_em.py +60 -25
- akshare/stock_feature/stock_fhps_ths.py +25 -6
- akshare/stock_feature/stock_fund_flow.py +38 -25
- akshare/stock_feature/stock_gdfx_em.py +180 -95
- akshare/stock_feature/stock_gdhs.py +73 -49
- akshare/stock_feature/stock_gpzy_em.py +78 -46
- akshare/stock_feature/stock_hist_em.py +55 -23
- akshare/stock_feature/stock_hk_valuation_baidu.py +20 -8
- akshare/stock_feature/stock_hsgt_em.py +184 -452
- akshare/stock_feature/stock_info.py +52 -29
- akshare/stock_feature/stock_inner_trade_xq.py +39 -31
- akshare/stock_feature/stock_irm_cninfo.py +32 -9
- akshare/stock_feature/stock_jgdy_em.py +41 -38
- akshare/stock_feature/stock_lh_yybpm.py +36 -37
- akshare/stock_feature/stock_lhb_em.py +135 -71
- akshare/stock_feature/stock_lhb_sina.py +93 -46
- akshare/stock_feature/stock_margin_em.py +102 -0
- akshare/stock_feature/{stock_sse_margin.py → stock_margin_sse.py} +21 -15
- akshare/stock_feature/{stock_szse_margin.py → stock_margin_szse.py} +23 -19
- akshare/stock_feature/stock_market_legu.py +13 -8
- akshare/stock_feature/stock_pankou_em.py +72 -34
- akshare/stock_feature/stock_report_em.py +244 -54
- akshare/stock_feature/stock_research_report_em.py +48 -19
- akshare/stock_feature/stock_sns_sseinfo.py +15 -12
- akshare/stock_feature/stock_sy_em.py +86 -33
- akshare/stock_feature/stock_technology_ths.py +152 -120
- akshare/stock_feature/stock_tfp_em.py +35 -13
- akshare/stock_feature/stock_three_report_em.py +119 -77
- akshare/stock_feature/stock_ttm_lyr.py +4 -7
- akshare/stock_feature/stock_value_em.py +83 -0
- akshare/stock_feature/stock_wencai.py +21 -9
- akshare/stock_feature/stock_yjyg_em.py +63 -28
- akshare/stock_feature/stock_zf_pg.py +61 -38
- akshare/stock_feature/stock_zh_valuation_baidu.py +3 -2
- akshare/stock_feature/stock_ztb_em.py +62 -40
- akshare/stock_fundamental/stock_finance.py +150 -58
- akshare/stock_fundamental/stock_finance_ths.py +116 -31
- akshare/stock_fundamental/stock_mda_ym.py +5 -3
- akshare/stock_fundamental/stock_notice.py +29 -15
- akshare/stock_fundamental/stock_profit_forecast_em.py +31 -13
- akshare/stock_fundamental/stock_profit_forecast_ths.py +19 -10
- akshare/stock_fundamental/stock_register_em.py +448 -0
- akshare/stock_fundamental/stock_restricted_em.py +79 -32
- akshare/stock_fundamental/stock_zygc.py +10 -8
- akshare/stock_fundamental/stock_zyjs_ths.py +5 -3
- akshare/tool/trade_date_hist.py +4 -3
- akshare/utils/cons.py +10 -0
- akshare/utils/context.py +43 -0
- akshare/utils/demjson.py +2 -2
- akshare/utils/func.py +26 -0
- akshare/utils/tqdm.py +13 -3
- {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/METADATA +52 -69
- akshare-1.15.73.dist-info/RECORD +385 -0
- {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/WHEEL +1 -1
- tests/test_func.py +3 -5
- akshare/bond/bond_futures.py +0 -50
- akshare/bond/bond_investing.py +0 -139
- akshare/crypto/crypto_hist_investing.py +0 -249
- akshare/fortune/fortune_it_juzi.py +0 -123
- akshare/futures/futures_international.py +0 -170
- akshare/futures/futures_news_baidu.py +0 -54
- akshare/futures/inventory_data.py +0 -100
- akshare/futures_derivative/futures_index_price_nh.py +0 -61
- akshare/futures_derivative/futures_index_return_nh.py +0 -47
- akshare/futures_derivative/futures_index_volatility_nh.py +0 -51
- akshare/futures_derivative/futures_other_index_nh.py +0 -145
- akshare/index/index_fear_greed_funddb.py +0 -71
- akshare/index/index_investing.py +0 -232
- akshare/sport/sport_olympic_winter.py +0 -39
- akshare/stock_feature/stock_board_concept_ths.py +0 -422
- akshare/stock_fundamental/stock_register.py +0 -292
- akshare-1.12.99.dist-info/RECORD +0 -374
- {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/LICENSE +0 -0
- {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/top_level.txt +0 -0
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2025/1/13 22:00
|
|
5
5
|
Desc: 东方财富网-数据中心-研究报告-个股研报
|
|
6
6
|
https://data.eastmoney.com/report/stock.jshtml
|
|
7
7
|
"""
|
|
8
|
+
|
|
9
|
+
import datetime
|
|
8
10
|
import pandas as pd
|
|
9
11
|
import requests
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
from akshare.utils.tqdm import get_tqdm
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
|
|
@@ -25,7 +28,7 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
|
|
|
25
28
|
"rating": "*",
|
|
26
29
|
"ratingChange": "*",
|
|
27
30
|
"beginTime": "2000-01-01",
|
|
28
|
-
"endTime": "
|
|
31
|
+
"endTime": f"{datetime.datetime.now().year + 1}-01-01",
|
|
29
32
|
"pageNo": "1",
|
|
30
33
|
"fields": "",
|
|
31
34
|
"qType": "0",
|
|
@@ -40,7 +43,9 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
|
|
|
40
43
|
r = requests.get(url, params=params)
|
|
41
44
|
data_json = r.json()
|
|
42
45
|
total_page = data_json["TotalPage"]
|
|
46
|
+
current_year = data_json["currentYear"]
|
|
43
47
|
big_df = pd.DataFrame()
|
|
48
|
+
tqdm = get_tqdm()
|
|
44
49
|
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
45
50
|
params.update(
|
|
46
51
|
{
|
|
@@ -53,9 +58,15 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
|
|
|
53
58
|
r = requests.get(url, params=params)
|
|
54
59
|
data_json = r.json()
|
|
55
60
|
temp_df = pd.DataFrame(data_json["data"])
|
|
56
|
-
big_df = pd.concat([big_df, temp_df], axis=0, ignore_index=True)
|
|
61
|
+
big_df = pd.concat(objs=[big_df, temp_df], axis=0, ignore_index=True)
|
|
57
62
|
big_df.reset_index(inplace=True)
|
|
58
63
|
big_df["index"] = big_df["index"] + 1
|
|
64
|
+
predict_this_year_eps_title = f"{current_year}-盈利预测-收益"
|
|
65
|
+
predict_this_year_pe_title = f"{current_year}-盈利预测-市盈率"
|
|
66
|
+
predict_next_year_eps_title = f"{current_year + 1}-盈利预测-收益"
|
|
67
|
+
predict_next_year_pe_title = f"{current_year + 1}-盈利预测-市盈率"
|
|
68
|
+
predict_next_two_year_eps_title = f"{current_year + 2}-盈利预测-收益"
|
|
69
|
+
predict_next_two_year_pe_title = f"{current_year + 2}-盈利预测-市盈率"
|
|
59
70
|
big_df.rename(
|
|
60
71
|
columns={
|
|
61
72
|
"index": "序号",
|
|
@@ -68,12 +79,12 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
|
|
|
68
79
|
"publishDate": "日期",
|
|
69
80
|
"infoCode": "-",
|
|
70
81
|
"column": "-",
|
|
71
|
-
"predictNextTwoYearEps":
|
|
72
|
-
"predictNextTwoYearPe":
|
|
73
|
-
"predictNextYearEps":
|
|
74
|
-
"predictNextYearPe":
|
|
75
|
-
"predictThisYearEps":
|
|
76
|
-
"predictThisYearPe":
|
|
82
|
+
"predictNextTwoYearEps": predict_next_two_year_eps_title,
|
|
83
|
+
"predictNextTwoYearPe": predict_next_two_year_pe_title,
|
|
84
|
+
"predictNextYearEps": predict_next_year_eps_title,
|
|
85
|
+
"predictNextYearPe": predict_next_year_pe_title,
|
|
86
|
+
"predictThisYearEps": predict_this_year_eps_title,
|
|
87
|
+
"predictThisYearPe": predict_this_year_pe_title,
|
|
77
88
|
"predictLastYearEps": "-",
|
|
78
89
|
"predictLastYearPe": "-",
|
|
79
90
|
"actualLastTwoYearEps": "-",
|
|
@@ -122,20 +133,38 @@ def stock_research_report_em(symbol: str = "000001") -> pd.DataFrame:
|
|
|
122
133
|
"东财评级",
|
|
123
134
|
"机构",
|
|
124
135
|
"近一月个股研报数",
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
predict_this_year_eps_title,
|
|
137
|
+
predict_this_year_pe_title,
|
|
138
|
+
predict_next_year_eps_title,
|
|
139
|
+
predict_next_year_pe_title,
|
|
140
|
+
predict_next_two_year_eps_title,
|
|
141
|
+
predict_next_two_year_pe_title,
|
|
129
142
|
"行业",
|
|
130
143
|
"日期",
|
|
131
144
|
]
|
|
132
145
|
]
|
|
133
146
|
big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date
|
|
134
|
-
big_df["近一月个股研报数"] = pd.to_numeric(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
big_df[
|
|
138
|
-
|
|
147
|
+
big_df["近一月个股研报数"] = pd.to_numeric(
|
|
148
|
+
big_df["近一月个股研报数"], errors="coerce"
|
|
149
|
+
)
|
|
150
|
+
big_df[predict_this_year_eps_title] = pd.to_numeric(
|
|
151
|
+
big_df[predict_this_year_eps_title], errors="coerce"
|
|
152
|
+
)
|
|
153
|
+
big_df[predict_this_year_pe_title] = pd.to_numeric(
|
|
154
|
+
big_df[predict_this_year_pe_title], errors="coerce"
|
|
155
|
+
)
|
|
156
|
+
big_df[predict_next_year_eps_title] = pd.to_numeric(
|
|
157
|
+
big_df[predict_next_year_eps_title], errors="coerce"
|
|
158
|
+
)
|
|
159
|
+
big_df[predict_next_year_pe_title] = pd.to_numeric(
|
|
160
|
+
big_df[predict_next_year_pe_title], errors="coerce"
|
|
161
|
+
)
|
|
162
|
+
big_df[predict_next_two_year_eps_title] = pd.to_numeric(
|
|
163
|
+
big_df[predict_next_two_year_eps_title], errors="coerce"
|
|
164
|
+
)
|
|
165
|
+
big_df[predict_next_two_year_pe_title] = pd.to_numeric(
|
|
166
|
+
big_df[predict_next_two_year_pe_title], errors="coerce"
|
|
167
|
+
)
|
|
139
168
|
return big_df
|
|
140
169
|
|
|
141
170
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/5/21 19:20
|
|
5
5
|
Desc: 上证e互动-提问与回答
|
|
6
6
|
https://sns.sseinfo.com/
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
import warnings
|
|
9
10
|
from functools import lru_cache
|
|
10
11
|
|
|
11
12
|
import pandas as pd
|
|
12
13
|
import requests
|
|
13
14
|
from bs4 import BeautifulSoup
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
from akshare.utils.tqdm import get_tqdm
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
@lru_cache()
|
|
@@ -31,19 +33,20 @@ def _fetch_stock_uid() -> dict:
|
|
|
31
33
|
}
|
|
32
34
|
uid_list = list()
|
|
33
35
|
code_list = list()
|
|
36
|
+
tqdm = get_tqdm()
|
|
34
37
|
for page in tqdm(range(1, 73), leave=False):
|
|
35
38
|
data.update({"page": page})
|
|
36
39
|
r = requests.post(url, data=data)
|
|
37
40
|
data_json = r.json()
|
|
38
|
-
soup = BeautifulSoup(data_json["content"], "lxml")
|
|
39
|
-
soup.find_all("a", attrs={"rel": "tag"})
|
|
41
|
+
soup = BeautifulSoup(data_json["content"], features="lxml")
|
|
42
|
+
soup.find_all(name="a", attrs={"rel": "tag"})
|
|
40
43
|
uid_list.extend(
|
|
41
|
-
[item["uid"] for item in soup.find_all("a", attrs={"rel": "tag"})]
|
|
44
|
+
[item["uid"] for item in soup.find_all(name="a", attrs={"rel": "tag"})]
|
|
42
45
|
)
|
|
43
46
|
code_list.extend(
|
|
44
47
|
[
|
|
45
48
|
item.find("img")["src"].split("?")[0].split("/")[-1].split(".")[0]
|
|
46
|
-
for item in soup.find_all("a", attrs={"rel": "tag"})
|
|
49
|
+
for item in soup.find_all(name="a", attrs={"rel": "tag"})
|
|
47
50
|
]
|
|
48
51
|
)
|
|
49
52
|
code_uid_map = dict(zip(code_list, uid_list))
|
|
@@ -79,18 +82,18 @@ def stock_sns_sseinfo(symbol: str = "603119") -> pd.DataFrame:
|
|
|
79
82
|
else:
|
|
80
83
|
page += 1
|
|
81
84
|
r = requests.post(url, params=params)
|
|
82
|
-
soup = BeautifulSoup(r.text, "lxml")
|
|
85
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
|
83
86
|
content_list = [
|
|
84
87
|
item.get_text().strip()
|
|
85
|
-
for item in soup.find_all("div", attrs={"class": "m_feed_txt"})
|
|
88
|
+
for item in soup.find_all(name="div", attrs={"class": "m_feed_txt"})
|
|
86
89
|
]
|
|
87
90
|
date_list = [
|
|
88
91
|
item.get_text().strip().split("\n")[0]
|
|
89
|
-
for item in soup.find_all("div", attrs={"class": "m_feed_from"})
|
|
92
|
+
for item in soup.find_all(name="div", attrs={"class": "m_feed_from"})
|
|
90
93
|
]
|
|
91
94
|
source_list = [
|
|
92
95
|
item.get_text().strip().split("\n")[2]
|
|
93
|
-
for item in soup.find_all("div", attrs={"class": "m_feed_from"})
|
|
96
|
+
for item in soup.find_all(name="div", attrs={"class": "m_feed_from"})
|
|
94
97
|
]
|
|
95
98
|
q_list = [
|
|
96
99
|
item.split(")")[1]
|
|
@@ -113,7 +116,7 @@ def stock_sns_sseinfo(symbol: str = "603119") -> pd.DataFrame:
|
|
|
113
116
|
s_q_list = [item for index, item in enumerate(source_list) if index % 2 == 0]
|
|
114
117
|
s_a_list = [item for index, item in enumerate(source_list) if index % 2 != 0]
|
|
115
118
|
author_name = [
|
|
116
|
-
item["title"] for item in soup.find_all("a", attrs={"rel": "face"})
|
|
119
|
+
item["title"] for item in soup.find_all(name="a", attrs={"rel": "face"})
|
|
117
120
|
]
|
|
118
121
|
temp_df = pd.DataFrame(
|
|
119
122
|
[
|
|
@@ -139,7 +142,7 @@ def stock_sns_sseinfo(symbol: str = "603119") -> pd.DataFrame:
|
|
|
139
142
|
"回答来源",
|
|
140
143
|
"用户名",
|
|
141
144
|
]
|
|
142
|
-
big_df = pd.concat([big_df, temp_df], ignore_index=True)
|
|
145
|
+
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
|
143
146
|
return big_df
|
|
144
147
|
|
|
145
148
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/9/15 15:30
|
|
5
5
|
Desc: 东方财富网-数据中心-特色数据-商誉
|
|
6
6
|
东方财富网-数据中心-特色数据-商誉-A股商誉市场概况: https://data.eastmoney.com/sy/scgk.html
|
|
7
7
|
东方财富网-数据中心-特色数据-商誉-商誉减值预期明细: https://data.eastmoney.com/sy/yqlist.html
|
|
@@ -9,9 +9,11 @@ Desc: 东方财富网-数据中心-特色数据-商誉
|
|
|
9
9
|
东方财富网-数据中心-特色数据-商誉-个股商誉明细: https://data.eastmoney.com/sy/list.html
|
|
10
10
|
东方财富网-数据中心-特色数据-商誉-行业商誉: https://data.eastmoney.com/sy/hylist.html
|
|
11
11
|
"""
|
|
12
|
+
|
|
12
13
|
import pandas as pd
|
|
13
14
|
import requests
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
from akshare.utils.tqdm import get_tqdm
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
def stock_sy_profile_em() -> pd.DataFrame:
|
|
@@ -65,15 +67,21 @@ def stock_sy_profile_em() -> pd.DataFrame:
|
|
|
65
67
|
data_df["商誉"] = pd.to_numeric(data_df["商誉"], errors="coerce")
|
|
66
68
|
data_df["商誉减值"] = pd.to_numeric(data_df["商誉减值"], errors="coerce")
|
|
67
69
|
data_df["净资产"] = pd.to_numeric(data_df["净资产"], errors="coerce")
|
|
68
|
-
data_df["商誉占净资产比例"] = pd.to_numeric(
|
|
69
|
-
|
|
70
|
+
data_df["商誉占净资产比例"] = pd.to_numeric(
|
|
71
|
+
data_df["商誉占净资产比例"], errors="coerce"
|
|
72
|
+
)
|
|
73
|
+
data_df["商誉减值占净资产比例"] = pd.to_numeric(
|
|
74
|
+
data_df["商誉减值占净资产比例"], errors="coerce"
|
|
75
|
+
)
|
|
70
76
|
data_df["净利润规模"] = pd.to_numeric(data_df["净利润规模"], errors="coerce")
|
|
71
|
-
data_df["商誉减值占净利润比例"] = pd.to_numeric(
|
|
77
|
+
data_df["商誉减值占净利润比例"] = pd.to_numeric(
|
|
78
|
+
data_df["商誉减值占净利润比例"], errors="coerce"
|
|
79
|
+
)
|
|
72
80
|
data_df.sort_values(["报告期"], inplace=True, ignore_index=True)
|
|
73
81
|
return data_df
|
|
74
82
|
|
|
75
83
|
|
|
76
|
-
def stock_sy_yq_em(date: str = "
|
|
84
|
+
def stock_sy_yq_em(date: str = "20240630") -> pd.DataFrame:
|
|
77
85
|
"""
|
|
78
86
|
东方财富网-数据中心-特色数据-商誉-商誉减值预期明细
|
|
79
87
|
https://data.eastmoney.com/sy/yqlist.html
|
|
@@ -97,12 +105,13 @@ def stock_sy_yq_em(date: str = "20221231") -> pd.DataFrame:
|
|
|
97
105
|
data_json = r.json()
|
|
98
106
|
big_df = pd.DataFrame()
|
|
99
107
|
total_page = int(data_json["result"]["pages"])
|
|
108
|
+
tqdm = get_tqdm()
|
|
100
109
|
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
101
110
|
params.update({"pageNumber": page})
|
|
102
111
|
r = requests.get(url, params=params)
|
|
103
112
|
data_json = r.json()
|
|
104
113
|
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
105
|
-
big_df = pd.concat([big_df, temp_df], ignore_index=True)
|
|
114
|
+
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
|
106
115
|
big_df.reset_index(inplace=True)
|
|
107
116
|
big_df["index"] = big_df["index"] + 1
|
|
108
117
|
big_df.rename(
|
|
@@ -157,19 +166,31 @@ def stock_sy_yq_em(date: str = "20221231") -> pd.DataFrame:
|
|
|
157
166
|
big_df["交易市场"] = big_df["交易市场"].map(
|
|
158
167
|
{"shzb": "沪市主板", "kcb": "科创板", "szzb": "深市主板", "cyb": "创业板"}
|
|
159
168
|
)
|
|
160
|
-
big_df["最新商誉报告期"] = pd.to_datetime(
|
|
169
|
+
big_df["最新商誉报告期"] = pd.to_datetime(
|
|
170
|
+
big_df["最新商誉报告期"], errors="coerce"
|
|
171
|
+
).dt.date
|
|
161
172
|
big_df["公告日期"] = pd.to_datetime(big_df["公告日期"], errors="coerce").dt.date
|
|
162
173
|
big_df["最新一期商誉"] = pd.to_numeric(big_df["最新一期商誉"], errors="coerce")
|
|
163
174
|
big_df["上年商誉"] = pd.to_numeric(big_df["上年商誉"], errors="coerce")
|
|
164
|
-
big_df["预计净利润-下限"] = pd.to_numeric(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
big_df["
|
|
168
|
-
|
|
175
|
+
big_df["预计净利润-下限"] = pd.to_numeric(
|
|
176
|
+
big_df["预计净利润-下限"], errors="coerce"
|
|
177
|
+
)
|
|
178
|
+
big_df["预计净利润-上限"] = pd.to_numeric(
|
|
179
|
+
big_df["预计净利润-上限"], errors="coerce"
|
|
180
|
+
)
|
|
181
|
+
big_df["业绩变动幅度-下限"] = pd.to_numeric(
|
|
182
|
+
big_df["业绩变动幅度-下限"], errors="coerce"
|
|
183
|
+
)
|
|
184
|
+
big_df["业绩变动幅度-上限"] = pd.to_numeric(
|
|
185
|
+
big_df["业绩变动幅度-上限"], errors="coerce"
|
|
186
|
+
)
|
|
187
|
+
big_df["上年度同期净利润"] = pd.to_numeric(
|
|
188
|
+
big_df["上年度同期净利润"], errors="coerce"
|
|
189
|
+
)
|
|
169
190
|
return big_df
|
|
170
191
|
|
|
171
192
|
|
|
172
|
-
def stock_sy_jz_em(date: str = "
|
|
193
|
+
def stock_sy_jz_em(date: str = "20240630") -> pd.DataFrame:
|
|
173
194
|
"""
|
|
174
195
|
东方财富网-数据中心-特色数据-商誉-个股商誉减值明细
|
|
175
196
|
https://data.eastmoney.com/sy/jzlist.html
|
|
@@ -193,12 +214,13 @@ def stock_sy_jz_em(date: str = "20230331") -> pd.DataFrame:
|
|
|
193
214
|
data_json = r.json()
|
|
194
215
|
big_df = pd.DataFrame()
|
|
195
216
|
total_page = int(data_json["result"]["pages"])
|
|
217
|
+
tqdm = get_tqdm()
|
|
196
218
|
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
197
219
|
params.update({"pageNumber": page})
|
|
198
220
|
r = requests.get(url, params=params)
|
|
199
221
|
data_json = r.json()
|
|
200
222
|
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
201
|
-
big_df = pd.concat([big_df, temp_df], ignore_index=True)
|
|
223
|
+
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
|
202
224
|
big_df.reset_index(inplace=True)
|
|
203
225
|
big_df["index"] = big_df["index"] + 1
|
|
204
226
|
big_df.rename(
|
|
@@ -253,11 +275,19 @@ def stock_sy_jz_em(date: str = "20230331") -> pd.DataFrame:
|
|
|
253
275
|
big_df["公告日期"] = pd.to_datetime(big_df["公告日期"], errors="coerce").dt.date
|
|
254
276
|
big_df["商誉"] = pd.to_numeric(big_df["商誉"], errors="coerce")
|
|
255
277
|
big_df["商誉减值"] = pd.to_numeric(big_df["商誉减值"], errors="coerce")
|
|
256
|
-
big_df["商誉占净资产比例"] = pd.to_numeric(
|
|
257
|
-
|
|
278
|
+
big_df["商誉占净资产比例"] = pd.to_numeric(
|
|
279
|
+
big_df["商誉占净资产比例"], errors="coerce"
|
|
280
|
+
)
|
|
281
|
+
big_df["商誉减值占净资产比例"] = pd.to_numeric(
|
|
282
|
+
big_df["商誉减值占净资产比例"], errors="coerce"
|
|
283
|
+
)
|
|
258
284
|
big_df["净利润"] = pd.to_numeric(big_df["净利润"], errors="coerce")
|
|
259
|
-
big_df["商誉减值占净利润比例"] = pd.to_numeric(
|
|
260
|
-
|
|
285
|
+
big_df["商誉减值占净利润比例"] = pd.to_numeric(
|
|
286
|
+
big_df["商誉减值占净利润比例"], errors="coerce"
|
|
287
|
+
)
|
|
288
|
+
big_df["商誉减值占净利润比例"] = pd.to_numeric(
|
|
289
|
+
big_df["商誉减值占净利润比例"], errors="coerce"
|
|
290
|
+
)
|
|
261
291
|
return big_df
|
|
262
292
|
|
|
263
293
|
|
|
@@ -285,12 +315,13 @@ def stock_sy_em(date: str = "20231231") -> pd.DataFrame:
|
|
|
285
315
|
data_json = r.json()
|
|
286
316
|
big_df = pd.DataFrame()
|
|
287
317
|
total_page = int(data_json["result"]["pages"])
|
|
318
|
+
tqdm = get_tqdm()
|
|
288
319
|
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
289
320
|
params.update({"pageNumber": page})
|
|
290
321
|
r = requests.get(url, params=params)
|
|
291
322
|
data_json = r.json()
|
|
292
323
|
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
293
|
-
big_df = pd.concat([big_df, temp_df], ignore_index=True)
|
|
324
|
+
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
|
294
325
|
big_df.reset_index(inplace=True)
|
|
295
326
|
big_df["index"] = big_df["index"] + 1
|
|
296
327
|
big_df.rename(
|
|
@@ -325,21 +356,34 @@ def stock_sy_em(date: str = "20231231") -> pd.DataFrame:
|
|
|
325
356
|
inplace=True,
|
|
326
357
|
)
|
|
327
358
|
big_df = big_df[
|
|
328
|
-
[
|
|
359
|
+
[
|
|
360
|
+
"序号",
|
|
361
|
+
"股票代码",
|
|
362
|
+
"股票简称",
|
|
363
|
+
"商誉",
|
|
364
|
+
"商誉占净资产比例",
|
|
365
|
+
"净利润",
|
|
366
|
+
"净利润同比",
|
|
367
|
+
"上年商誉",
|
|
368
|
+
"公告日期",
|
|
369
|
+
"交易市场",
|
|
370
|
+
]
|
|
329
371
|
]
|
|
330
372
|
big_df["交易市场"] = big_df["交易市场"].map(
|
|
331
373
|
{"shzb": "沪市主板", "kcb": "科创板", "szzb": "深市主板", "cyb": "创业板"}
|
|
332
374
|
)
|
|
333
375
|
big_df["公告日期"] = pd.to_datetime(big_df["公告日期"], errors="coerce").dt.date
|
|
334
376
|
big_df["商誉"] = pd.to_numeric(big_df["商誉"], errors="coerce")
|
|
335
|
-
big_df["商誉占净资产比例"] = pd.to_numeric(
|
|
377
|
+
big_df["商誉占净资产比例"] = pd.to_numeric(
|
|
378
|
+
big_df["商誉占净资产比例"], errors="coerce"
|
|
379
|
+
)
|
|
336
380
|
big_df["净利润"] = pd.to_numeric(big_df["净利润"], errors="coerce")
|
|
337
381
|
big_df["净利润同比"] = pd.to_numeric(big_df["净利润同比"], errors="coerce")
|
|
338
382
|
big_df["上年商誉"] = pd.to_numeric(big_df["上年商誉"], errors="coerce")
|
|
339
383
|
return big_df
|
|
340
384
|
|
|
341
385
|
|
|
342
|
-
def stock_sy_hy_em(date: str = "
|
|
386
|
+
def stock_sy_hy_em(date: str = "20240930") -> pd.DataFrame:
|
|
343
387
|
"""
|
|
344
388
|
东方财富网-数据中心-特色数据-商誉-行业商誉
|
|
345
389
|
https://data.eastmoney.com/sy/hylist.html
|
|
@@ -363,14 +407,14 @@ def stock_sy_hy_em(date: str = "20231231") -> pd.DataFrame:
|
|
|
363
407
|
data_json = r.json()
|
|
364
408
|
big_df = pd.DataFrame()
|
|
365
409
|
total_page = int(data_json["result"]["pages"])
|
|
410
|
+
tqdm = get_tqdm()
|
|
366
411
|
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
367
412
|
params.update({"pageNumber": page})
|
|
368
413
|
r = requests.get(url, params=params)
|
|
369
414
|
data_json = r.json()
|
|
370
415
|
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
371
|
-
big_df = pd.concat([big_df, temp_df], ignore_index=True)
|
|
416
|
+
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
|
372
417
|
big_df.reset_index(inplace=True, drop=True)
|
|
373
|
-
big_df.columns
|
|
374
418
|
big_df.rename(
|
|
375
419
|
columns={
|
|
376
420
|
"REPORT_DATE": "数据日期",
|
|
@@ -388,28 +432,37 @@ def stock_sy_hy_em(date: str = "20231231") -> pd.DataFrame:
|
|
|
388
432
|
inplace=True,
|
|
389
433
|
)
|
|
390
434
|
big_df = big_df[
|
|
391
|
-
[
|
|
435
|
+
[
|
|
436
|
+
"行业名称",
|
|
437
|
+
"公司家数",
|
|
438
|
+
"商誉规模",
|
|
439
|
+
"净资产",
|
|
440
|
+
"商誉规模占净资产规模比例",
|
|
441
|
+
"净利润规模",
|
|
442
|
+
]
|
|
392
443
|
]
|
|
393
444
|
big_df["公司家数"] = pd.to_numeric(big_df["公司家数"], errors="coerce")
|
|
394
445
|
big_df["商誉规模"] = pd.to_numeric(big_df["商誉规模"], errors="coerce")
|
|
395
446
|
big_df["净资产"] = pd.to_numeric(big_df["净资产"], errors="coerce")
|
|
396
|
-
big_df["商誉规模占净资产规模比例"] = pd.to_numeric(
|
|
447
|
+
big_df["商誉规模占净资产规模比例"] = pd.to_numeric(
|
|
448
|
+
big_df["商誉规模占净资产规模比例"], errors="coerce"
|
|
449
|
+
)
|
|
397
450
|
big_df["净利润规模"] = pd.to_numeric(big_df["净利润规模"], errors="coerce")
|
|
398
451
|
return big_df
|
|
399
452
|
|
|
400
453
|
|
|
401
454
|
if __name__ == "__main__":
|
|
402
|
-
|
|
403
|
-
print(
|
|
455
|
+
stock_sy_profile_em_df = stock_sy_profile_em()
|
|
456
|
+
print(stock_sy_profile_em_df)
|
|
404
457
|
|
|
405
|
-
stock_sy_yq_em_df = stock_sy_yq_em(date="
|
|
458
|
+
stock_sy_yq_em_df = stock_sy_yq_em(date="20240630")
|
|
406
459
|
print(stock_sy_yq_em_df)
|
|
407
460
|
|
|
408
|
-
stock_sy_jz_em_df = stock_sy_jz_em(date="
|
|
461
|
+
stock_sy_jz_em_df = stock_sy_jz_em(date="20240630")
|
|
409
462
|
print(stock_sy_jz_em_df)
|
|
410
463
|
|
|
411
|
-
stock_sy_em_df = stock_sy_em(date="
|
|
464
|
+
stock_sy_em_df = stock_sy_em(date="20240630")
|
|
412
465
|
print(stock_sy_em_df)
|
|
413
466
|
|
|
414
|
-
stock_sy_hy_em_df = stock_sy_hy_em(date="
|
|
467
|
+
stock_sy_hy_em_df = stock_sy_hy_em(date="20240930")
|
|
415
468
|
print(stock_sy_hy_em_df)
|