akshare 1.12.99__py3-none-any.whl → 1.15.72__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 +441 -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.72.dist-info}/METADATA +52 -69
- akshare-1.15.72.dist-info/RECORD +385 -0
- {akshare-1.12.99.dist-info → akshare-1.15.72.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.72.dist-info}/LICENSE +0 -0
- {akshare-1.12.99.dist-info → akshare-1.15.72.dist-info}/top_level.txt +0 -0
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/11/2 15:20
|
|
5
5
|
Desc: 同花顺-财务指标-主要指标
|
|
6
6
|
https://basic.10jqka.com.cn/new/000063/finance.html
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
import json
|
|
9
10
|
|
|
10
11
|
import pandas as pd
|
|
11
12
|
import requests
|
|
12
13
|
from bs4 import BeautifulSoup
|
|
13
14
|
|
|
15
|
+
from akshare.utils.cons import headers
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
def stock_financial_abstract_ths(
|
|
16
|
-
|
|
19
|
+
symbol: str = "000063", indicator: str = "按报告期"
|
|
17
20
|
) -> pd.DataFrame:
|
|
18
21
|
"""
|
|
19
22
|
同花顺-财务指标-主要指标
|
|
@@ -26,14 +29,9 @@ def stock_financial_abstract_ths(
|
|
|
26
29
|
:rtype: pandas.DataFrame
|
|
27
30
|
"""
|
|
28
31
|
url = f"https://basic.10jqka.com.cn/new/{symbol}/finance.html"
|
|
29
|
-
headers = {
|
|
30
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
31
|
-
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
32
|
-
"Chrome/89.0.4389.90 Safari/537.36",
|
|
33
|
-
}
|
|
34
32
|
r = requests.get(url, headers=headers)
|
|
35
|
-
soup = BeautifulSoup(r.text, "lxml")
|
|
36
|
-
data_text = soup.find("p", attrs={"id": "main"}).string
|
|
33
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
|
34
|
+
data_text = soup.find(name="p", attrs={"id": "main"}).string
|
|
37
35
|
data_json = json.loads(data_text)
|
|
38
36
|
df_index = [
|
|
39
37
|
item[0] if isinstance(item, list) else item for item in data_json["title"]
|
|
@@ -57,7 +55,7 @@ def stock_financial_abstract_ths(
|
|
|
57
55
|
|
|
58
56
|
|
|
59
57
|
def stock_financial_debt_ths(
|
|
60
|
-
|
|
58
|
+
symbol: str = "000063", indicator: str = "按报告期"
|
|
61
59
|
) -> pd.DataFrame:
|
|
62
60
|
"""
|
|
63
61
|
同花顺-财务指标-资产负债表
|
|
@@ -71,13 +69,8 @@ def stock_financial_debt_ths(
|
|
|
71
69
|
:rtype: pandas.DataFrame
|
|
72
70
|
"""
|
|
73
71
|
url = f"https://basic.10jqka.com.cn/api/stock/finance/{symbol}_debt.json"
|
|
74
|
-
headers = {
|
|
75
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
76
|
-
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
77
|
-
"Chrome/89.0.4389.90 Safari/537.36",
|
|
78
|
-
}
|
|
79
72
|
r = requests.get(url, headers=headers)
|
|
80
|
-
data_json = json.loads(json.loads(r.text)[
|
|
73
|
+
data_json = json.loads(json.loads(r.text)["flashData"])
|
|
81
74
|
df_index = [
|
|
82
75
|
item[0] if isinstance(item, list) else item for item in data_json["title"]
|
|
83
76
|
]
|
|
@@ -96,7 +89,7 @@ def stock_financial_debt_ths(
|
|
|
96
89
|
|
|
97
90
|
|
|
98
91
|
def stock_financial_benefit_ths(
|
|
99
|
-
|
|
92
|
+
symbol: str = "000063", indicator: str = "按报告期"
|
|
100
93
|
) -> pd.DataFrame:
|
|
101
94
|
"""
|
|
102
95
|
同花顺-财务指标-利润表
|
|
@@ -110,13 +103,8 @@ def stock_financial_benefit_ths(
|
|
|
110
103
|
:rtype: pandas.DataFrame
|
|
111
104
|
"""
|
|
112
105
|
url = f"https://basic.10jqka.com.cn/api/stock/finance/{symbol}_benefit.json"
|
|
113
|
-
headers = {
|
|
114
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
115
|
-
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
116
|
-
"Chrome/89.0.4389.90 Safari/537.36",
|
|
117
|
-
}
|
|
118
106
|
r = requests.get(url, headers=headers)
|
|
119
|
-
data_json = json.loads(json.loads(r.text)[
|
|
107
|
+
data_json = json.loads(json.loads(r.text)["flashData"])
|
|
120
108
|
df_index = [
|
|
121
109
|
item[0] if isinstance(item, list) else item for item in data_json["title"]
|
|
122
110
|
]
|
|
@@ -139,7 +127,7 @@ def stock_financial_benefit_ths(
|
|
|
139
127
|
|
|
140
128
|
|
|
141
129
|
def stock_financial_cash_ths(
|
|
142
|
-
|
|
130
|
+
symbol: str = "000063", indicator: str = "按报告期"
|
|
143
131
|
) -> pd.DataFrame:
|
|
144
132
|
"""
|
|
145
133
|
同花顺-财务指标-现金流量表
|
|
@@ -153,13 +141,8 @@ def stock_financial_cash_ths(
|
|
|
153
141
|
:rtype: pandas.DataFrame
|
|
154
142
|
"""
|
|
155
143
|
url = f"https://basic.10jqka.com.cn/api/stock/finance/{symbol}_cash.json"
|
|
156
|
-
headers = {
|
|
157
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
|
158
|
-
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
159
|
-
"Chrome/89.0.4389.90 Safari/537.36",
|
|
160
|
-
}
|
|
161
144
|
r = requests.get(url, headers=headers)
|
|
162
|
-
data_json = json.loads(json.loads(r.text)[
|
|
145
|
+
data_json = json.loads(json.loads(r.text)["flashData"])
|
|
163
146
|
df_index = [
|
|
164
147
|
item[0] if isinstance(item, list) else item for item in data_json["title"]
|
|
165
148
|
]
|
|
@@ -181,6 +164,102 @@ def stock_financial_cash_ths(
|
|
|
181
164
|
return temp_df
|
|
182
165
|
|
|
183
166
|
|
|
167
|
+
def stock_management_change_ths(symbol: str = "688981") -> pd.DataFrame:
|
|
168
|
+
"""
|
|
169
|
+
同花顺-公司大事-高管持股变动
|
|
170
|
+
https://basic.10jqka.com.cn/new/688981/event.html
|
|
171
|
+
:param symbol: 股票代码
|
|
172
|
+
:type symbol: str
|
|
173
|
+
:return: 同花顺-公司大事-高管持股变动
|
|
174
|
+
:rtype: pandas.DataFrame
|
|
175
|
+
"""
|
|
176
|
+
url = f"https://basic.10jqka.com.cn/new/{symbol}/event.html"
|
|
177
|
+
r = requests.get(url, headers=headers)
|
|
178
|
+
r.encoding = "gb2312"
|
|
179
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
|
180
|
+
soup_find = soup.find(name="table", attrs={"class": "data_table_1 m_table m_hl"})
|
|
181
|
+
if soup_find is not None:
|
|
182
|
+
content_list = [item.text.strip() for item in soup_find]
|
|
183
|
+
column_names = content_list[1].split("\n")
|
|
184
|
+
row = (
|
|
185
|
+
content_list[3]
|
|
186
|
+
.replace(" ", "")
|
|
187
|
+
.replace("\t", "")
|
|
188
|
+
.replace("\n\n", "")
|
|
189
|
+
.replace(" ", "\n")
|
|
190
|
+
.replace("\n\n", "\n")
|
|
191
|
+
.split("\n")
|
|
192
|
+
)
|
|
193
|
+
row = [item for item in row if item != ""]
|
|
194
|
+
new_rows = []
|
|
195
|
+
step = len(column_names)
|
|
196
|
+
for i in range(0, len(row), step):
|
|
197
|
+
new_rows.append(row[i : i + step])
|
|
198
|
+
temp_df = pd.DataFrame(new_rows, columns=column_names)
|
|
199
|
+
temp_df.sort_values(by="变动日期", ignore_index=True, inplace=True)
|
|
200
|
+
temp_df["变动日期"] = pd.to_datetime(
|
|
201
|
+
temp_df["变动日期"], errors="coerce"
|
|
202
|
+
).dt.date
|
|
203
|
+
temp_df.rename(
|
|
204
|
+
columns={
|
|
205
|
+
"变动数量(股)": "变动数量",
|
|
206
|
+
"交易均价(元)": "交易均价",
|
|
207
|
+
"剩余股数(股)": "剩余股数",
|
|
208
|
+
},
|
|
209
|
+
inplace=True,
|
|
210
|
+
)
|
|
211
|
+
return temp_df
|
|
212
|
+
return pd.DataFrame()
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def stock_shareholder_change_ths(symbol: str = "688981") -> pd.DataFrame:
|
|
216
|
+
"""
|
|
217
|
+
同花顺-公司大事-股东持股变动
|
|
218
|
+
https://basic.10jqka.com.cn/new/688981/event.html
|
|
219
|
+
:param symbol: 股票代码
|
|
220
|
+
:type symbol: str
|
|
221
|
+
:return: 同花顺-公司大事-股东持股变动
|
|
222
|
+
:rtype: pandas.DataFrame
|
|
223
|
+
"""
|
|
224
|
+
url = f"https://basic.10jqka.com.cn/new/{symbol}/event.html"
|
|
225
|
+
r = requests.get(url, headers=headers)
|
|
226
|
+
r.encoding = "gb2312"
|
|
227
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
|
228
|
+
soup_find = soup.find(name="table", attrs={"class": "m_table data_table_1 m_hl"})
|
|
229
|
+
if soup_find is not None:
|
|
230
|
+
content_list = [item.text.strip() for item in soup_find]
|
|
231
|
+
column_names = content_list[1].split("\n")
|
|
232
|
+
row = (
|
|
233
|
+
content_list[3]
|
|
234
|
+
.replace("\t", "")
|
|
235
|
+
.replace("\n\n", "")
|
|
236
|
+
.replace(" ", "\n")
|
|
237
|
+
.replace(" ", "")
|
|
238
|
+
.replace("\n\n", "\n")
|
|
239
|
+
.split("\n")
|
|
240
|
+
)
|
|
241
|
+
row = [item for item in row if item != ""]
|
|
242
|
+
new_rows = []
|
|
243
|
+
step = len(column_names)
|
|
244
|
+
for i in range(0, len(row), step):
|
|
245
|
+
new_rows.append(row[i : i + step])
|
|
246
|
+
temp_df = pd.DataFrame(new_rows, columns=column_names)
|
|
247
|
+
temp_df.sort_values(by="公告日期", ignore_index=True, inplace=True)
|
|
248
|
+
temp_df["公告日期"] = pd.to_datetime(
|
|
249
|
+
temp_df["公告日期"], errors="coerce"
|
|
250
|
+
).dt.date
|
|
251
|
+
temp_df.rename(
|
|
252
|
+
columns={
|
|
253
|
+
"变动数量(股)": "变动数量",
|
|
254
|
+
"交易均价(元)": "交易均价",
|
|
255
|
+
"剩余股份总数(股)": "剩余股份总数",
|
|
256
|
+
},
|
|
257
|
+
inplace=True,
|
|
258
|
+
)
|
|
259
|
+
return temp_df
|
|
260
|
+
return pd.DataFrame()
|
|
261
|
+
|
|
262
|
+
|
|
184
263
|
if __name__ == "__main__":
|
|
185
264
|
stock_financial_abstract_ths_df = stock_financial_abstract_ths(
|
|
186
265
|
symbol="000063", indicator="按报告期"
|
|
@@ -198,7 +277,7 @@ if __name__ == "__main__":
|
|
|
198
277
|
print(stock_financial_abstract_ths_df)
|
|
199
278
|
|
|
200
279
|
stock_financial_debt_ths_df = stock_financial_debt_ths(
|
|
201
|
-
symbol="
|
|
280
|
+
symbol="002004", indicator="按报告期"
|
|
202
281
|
)
|
|
203
282
|
print(stock_financial_debt_ths_df)
|
|
204
283
|
|
|
@@ -236,3 +315,9 @@ if __name__ == "__main__":
|
|
|
236
315
|
symbol="000063", indicator="按单季度"
|
|
237
316
|
)
|
|
238
317
|
print(stock_financial_cash_ths_df)
|
|
318
|
+
|
|
319
|
+
stock_management_change_ths_df = stock_management_change_ths(symbol="688981")
|
|
320
|
+
print(stock_management_change_ths_df)
|
|
321
|
+
|
|
322
|
+
stock_shareholder_change_ths_df = stock_shareholder_change_ths(symbol="688981")
|
|
323
|
+
print(stock_shareholder_change_ths_df)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# -*- coding:utf-8 -*-
|
|
2
2
|
# !/usr/bin/env python
|
|
3
3
|
"""
|
|
4
|
-
Date: 2024/
|
|
4
|
+
Date: 2024/9/3 21:00
|
|
5
5
|
Desc: 益盟-F10-管理层讨论与分析
|
|
6
6
|
https://f10.emoney.cn/f10/zbyz/1000001
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
import pandas as pd
|
|
9
10
|
import requests
|
|
10
11
|
from bs4 import BeautifulSoup
|
|
@@ -21,7 +22,7 @@ def stock_mda_ym(symbol: str = "000001") -> pd.DataFrame:
|
|
|
21
22
|
"""
|
|
22
23
|
url = f"http://f10.emoney.cn/f10/zygc/{symbol}"
|
|
23
24
|
r = requests.get(url)
|
|
24
|
-
soup = BeautifulSoup(r.text, "lxml")
|
|
25
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
|
25
26
|
year_list = [
|
|
26
27
|
item.text.strip()
|
|
27
28
|
for item in soup.find(attrs={"class": "swlab_t"}).find_all("li")
|
|
@@ -32,9 +33,10 @@ def stock_mda_ym(symbol: str = "000001") -> pd.DataFrame:
|
|
|
32
33
|
]
|
|
33
34
|
big_df = pd.DataFrame([year_list, talk_list]).T
|
|
34
35
|
big_df.columns = ["报告期", "内容"]
|
|
36
|
+
big_df.sort_values(by=["报告期"], ignore_index=True, inplace=True)
|
|
35
37
|
return big_df
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
if __name__ == "__main__":
|
|
39
|
-
stock_mda_ym_df = stock_mda_ym(symbol="
|
|
41
|
+
stock_mda_ym_df = stock_mda_ym(symbol="000001")
|
|
40
42
|
print(stock_mda_ym_df)
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
# -*- coding:utf-8 -*-
|
|
2
2
|
# !/usr/bin/env python
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/6/13 13:00
|
|
5
5
|
Desc: 东方财富网-数据中心-公告大全-沪深 A 股公告
|
|
6
|
-
|
|
6
|
+
https://data.eastmoney.com/notices/hsa/5.html
|
|
7
7
|
"""
|
|
8
|
+
|
|
9
|
+
import math
|
|
10
|
+
|
|
8
11
|
import pandas as pd
|
|
9
12
|
import requests
|
|
10
|
-
|
|
13
|
+
|
|
14
|
+
from akshare.utils.tqdm import get_tqdm
|
|
11
15
|
|
|
12
16
|
|
|
13
17
|
def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.DataFrame:
|
|
14
18
|
"""
|
|
15
19
|
东方财富网-数据中心-公告大全-沪深京 A 股公告
|
|
16
|
-
|
|
20
|
+
https://data.eastmoney.com/notices/hsa/5.html
|
|
17
21
|
:param symbol: 报告类型; choice of {"全部", "重大事项", "财务报告", "融资公告", "风险提示", "资产重组", "信息变更", "持股变动"}
|
|
18
22
|
:type symbol: str
|
|
19
23
|
:param date: 制定日期
|
|
@@ -21,7 +25,7 @@ def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.Da
|
|
|
21
25
|
:return: 沪深京 A 股公告
|
|
22
26
|
:rtype: pandas.DataFrame
|
|
23
27
|
"""
|
|
24
|
-
url = "
|
|
28
|
+
url = "https://np-anotice-stock.eastmoney.com/api/security/ann"
|
|
25
29
|
report_map = {
|
|
26
30
|
"全部": "0",
|
|
27
31
|
"财务报告": "1",
|
|
@@ -45,11 +49,9 @@ def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.Da
|
|
|
45
49
|
}
|
|
46
50
|
r = requests.get(url, params=params)
|
|
47
51
|
data_json = r.json()
|
|
48
|
-
import math
|
|
49
|
-
|
|
50
52
|
total_page = math.ceil(data_json["data"]["total_hits"] / 100)
|
|
51
|
-
|
|
52
53
|
big_df = pd.DataFrame()
|
|
54
|
+
tqdm = get_tqdm()
|
|
53
55
|
for page in tqdm(range(1, int(total_page) + 1), leave=False):
|
|
54
56
|
params.update(
|
|
55
57
|
{
|
|
@@ -66,16 +68,16 @@ def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.Da
|
|
|
66
68
|
temp_columns_df = pd.DataFrame(
|
|
67
69
|
[item["columns"][0] for item in data_json["data"]["list"]]
|
|
68
70
|
)
|
|
69
|
-
except:
|
|
71
|
+
except: # noqa: E722
|
|
70
72
|
continue
|
|
71
73
|
del temp_df["codes"]
|
|
72
74
|
del temp_df["columns"]
|
|
73
|
-
temp_df = pd.concat([temp_df, temp_columns_df, temp_codes_df], axis=1)
|
|
74
|
-
big_df = pd.concat([big_df, temp_df], ignore_index=True)
|
|
75
|
+
temp_df = pd.concat(objs=[temp_df, temp_columns_df, temp_codes_df], axis=1)
|
|
76
|
+
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
|
75
77
|
|
|
76
78
|
big_df.rename(
|
|
77
79
|
columns={
|
|
78
|
-
"art_code": "
|
|
80
|
+
"art_code": "编码",
|
|
79
81
|
"display_time": "-",
|
|
80
82
|
"eiTime": "-",
|
|
81
83
|
"notice_date": "公告日期",
|
|
@@ -90,6 +92,8 @@ def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.Da
|
|
|
90
92
|
},
|
|
91
93
|
inplace=True,
|
|
92
94
|
)
|
|
95
|
+
url = "https://data.eastmoney.com/notices/detail/"
|
|
96
|
+
big_df["网址"] = url + big_df["代码"] + "/" + big_df["编码"] + ".html"
|
|
93
97
|
big_df = big_df[
|
|
94
98
|
[
|
|
95
99
|
"代码",
|
|
@@ -97,17 +101,27 @@ def stock_notice_report(symbol: str = "全部", date: str = "20220511") -> pd.Da
|
|
|
97
101
|
"公告标题",
|
|
98
102
|
"公告类型",
|
|
99
103
|
"公告日期",
|
|
104
|
+
"网址",
|
|
100
105
|
]
|
|
101
106
|
]
|
|
102
|
-
big_df["公告日期"] = pd.to_datetime(big_df["公告日期"]).dt.date
|
|
107
|
+
big_df["公告日期"] = pd.to_datetime(big_df["公告日期"], errors="coerce").dt.date
|
|
103
108
|
return big_df
|
|
104
109
|
|
|
105
110
|
|
|
106
111
|
if __name__ == "__main__":
|
|
107
|
-
stock_notice_report_df = stock_notice_report(symbol=
|
|
112
|
+
stock_notice_report_df = stock_notice_report(symbol="财务报告", date="20240612")
|
|
108
113
|
print(stock_notice_report_df)
|
|
109
114
|
|
|
110
|
-
item_list = [
|
|
115
|
+
item_list = [
|
|
116
|
+
"全部",
|
|
117
|
+
"财务报告",
|
|
118
|
+
"融资公告",
|
|
119
|
+
"风险提示",
|
|
120
|
+
"信息变更",
|
|
121
|
+
"重大事项",
|
|
122
|
+
"资产重组",
|
|
123
|
+
"持股变动",
|
|
124
|
+
]
|
|
111
125
|
for temp_item in item_list:
|
|
112
126
|
stock_notice_report_df = stock_notice_report(symbol=temp_item, date="20220511")
|
|
113
127
|
print(stock_notice_report_df)
|
|
@@ -5,6 +5,7 @@ Date: 2024/1/6 15:00
|
|
|
5
5
|
Desc: 东方财富网-数据中心-研究报告-盈利预测
|
|
6
6
|
https://data.eastmoney.com/report/profitforecast.jshtml
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
import pandas as pd
|
|
9
10
|
import requests
|
|
10
11
|
|
|
@@ -15,7 +16,8 @@ def stock_profit_forecast_em(symbol: str = "") -> pd.DataFrame:
|
|
|
15
16
|
"""
|
|
16
17
|
东方财富网-数据中心-研究报告-盈利预测
|
|
17
18
|
https://data.eastmoney.com/report/profitforecast.jshtml
|
|
18
|
-
:param symbol: "", 默认为获取全部数据; symbol="船舶制造", 则获取具体行业板块的数据;
|
|
19
|
+
:param symbol: "", 默认为获取全部数据; symbol="船舶制造", 则获取具体行业板块的数据;
|
|
20
|
+
行业板块可以通过 ak.stock_board_industry_name_em() 接口获取
|
|
19
21
|
:type symbol: str
|
|
20
22
|
:return: 盈利预测
|
|
21
23
|
:rtype: pandas.DataFrame
|
|
@@ -34,7 +36,6 @@ def stock_profit_forecast_em(symbol: str = "") -> pd.DataFrame:
|
|
|
34
36
|
}
|
|
35
37
|
if symbol:
|
|
36
38
|
params.update({"filter": f'(INDUSTRY_BOARD="{symbol}")'})
|
|
37
|
-
|
|
38
39
|
r = requests.get(url, params=params)
|
|
39
40
|
data_json = r.json()
|
|
40
41
|
page_num = int(data_json["result"]["pages"])
|
|
@@ -52,7 +53,7 @@ def stock_profit_forecast_em(symbol: str = "") -> pd.DataFrame:
|
|
|
52
53
|
r = requests.get(url, params=params)
|
|
53
54
|
data_json = r.json()
|
|
54
55
|
temp_df = pd.DataFrame(data_json["result"]["data"])
|
|
55
|
-
big_df = pd.concat([big_df, temp_df], ignore_index=True)
|
|
56
|
+
big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
|
|
56
57
|
|
|
57
58
|
big_df.reset_index(inplace=True)
|
|
58
59
|
big_df["index"] = big_df.index + 1
|
|
@@ -94,7 +95,6 @@ def stock_profit_forecast_em(symbol: str = "") -> pd.DataFrame:
|
|
|
94
95
|
"_",
|
|
95
96
|
"_",
|
|
96
97
|
]
|
|
97
|
-
|
|
98
98
|
big_df = big_df[
|
|
99
99
|
[
|
|
100
100
|
"序号",
|
|
@@ -112,11 +112,12 @@ def stock_profit_forecast_em(symbol: str = "") -> pd.DataFrame:
|
|
|
112
112
|
f"{year4}预测每股收益",
|
|
113
113
|
]
|
|
114
114
|
]
|
|
115
|
-
big_df["机构投资评级(近六个月)-买入"]
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
big_df["机构投资评级(近六个月)
|
|
119
|
-
|
|
115
|
+
big_df["机构投资评级(近六个月)-买入"] = big_df[
|
|
116
|
+
"机构投资评级(近六个月)-买入"
|
|
117
|
+
].fillna(0)
|
|
118
|
+
big_df["机构投资评级(近六个月)-增持"] = big_df[
|
|
119
|
+
"机构投资评级(近六个月)-增持"
|
|
120
|
+
].fillna(0)
|
|
120
121
|
big_df["研报数"] = pd.to_numeric(big_df["研报数"], errors="coerce")
|
|
121
122
|
big_df["机构投资评级(近六个月)-买入"] = pd.to_numeric(
|
|
122
123
|
big_df["机构投资评级(近六个月)-买入"], errors="coerce"
|
|
@@ -133,10 +134,27 @@ def stock_profit_forecast_em(symbol: str = "") -> pd.DataFrame:
|
|
|
133
134
|
big_df["机构投资评级(近六个月)-卖出"] = pd.to_numeric(
|
|
134
135
|
big_df["机构投资评级(近六个月)-卖出"], errors="coerce"
|
|
135
136
|
)
|
|
136
|
-
big_df[
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
big_df[
|
|
137
|
+
big_df["机构投资评级(近六个月)-中性"] = big_df[
|
|
138
|
+
"机构投资评级(近六个月)-中性"
|
|
139
|
+
].fillna(0)
|
|
140
|
+
big_df["机构投资评级(近六个月)-减持"] = big_df[
|
|
141
|
+
"机构投资评级(近六个月)-减持"
|
|
142
|
+
].fillna(0)
|
|
143
|
+
big_df["机构投资评级(近六个月)-卖出"] = big_df[
|
|
144
|
+
"机构投资评级(近六个月)-卖出"
|
|
145
|
+
].fillna(0)
|
|
146
|
+
big_df[f"{year1}预测每股收益"] = pd.to_numeric(
|
|
147
|
+
big_df[f"{year1}预测每股收益"], errors="coerce"
|
|
148
|
+
)
|
|
149
|
+
big_df[f"{year2}预测每股收益"] = pd.to_numeric(
|
|
150
|
+
big_df[f"{year2}预测每股收益"], errors="coerce"
|
|
151
|
+
)
|
|
152
|
+
big_df[f"{year3}预测每股收益"] = pd.to_numeric(
|
|
153
|
+
big_df[f"{year3}预测每股收益"], errors="coerce"
|
|
154
|
+
)
|
|
155
|
+
big_df[f"{year4}预测每股收益"] = pd.to_numeric(
|
|
156
|
+
big_df[f"{year4}预测每股收益"], errors="coerce"
|
|
157
|
+
)
|
|
140
158
|
big_df.sort_values(["研报数"], ascending=False, inplace=True, ignore_index=True)
|
|
141
159
|
big_df["序号"] = range(1, len(big_df) + 1)
|
|
142
160
|
return big_df
|
|
@@ -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)
|