akshare 1.16.63__py3-none-any.whl → 1.16.65__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.
Files changed (175) hide show
  1. akshare/__init__.py +4 -2
  2. akshare/air/cons.py +1 -0
  3. akshare/air/crypto.js +1 -1
  4. akshare/air/outcrypto.js +1 -1
  5. akshare/article/cons.py +1 -0
  6. akshare/article/epu_index.py +4 -3
  7. akshare/article/ff_factor.py +19 -8
  8. akshare/article/fred_md.py +4 -1
  9. akshare/article/risk_rv.py +3 -8
  10. akshare/bond/bond_cb_sina.py +1 -0
  11. akshare/bond/bond_cbond.py +19 -14
  12. akshare/bond/bond_em.py +34 -15
  13. akshare/bond/bond_summary.py +38 -37
  14. akshare/bond/bond_zh_cov.py +0 -6
  15. akshare/bond/cons.py +14 -11
  16. akshare/crypto/__init__.py +1 -1
  17. akshare/crypto/crypto_bitcoin_cme.py +7 -7
  18. akshare/crypto/crypto_hold.py +4 -1
  19. akshare/currency/currency.py +1 -0
  20. akshare/currency/currency_china_bank_sina.py +6 -3
  21. akshare/data/__init__.py +1 -1
  22. akshare/data/cninfo.js +1 -1
  23. akshare/economic/cons.py +10 -3
  24. akshare/economic/macro_australia.py +0 -7
  25. akshare/economic/macro_canada.py +92 -81
  26. akshare/economic/macro_china.py +0 -34
  27. akshare/economic/macro_china_hk.py +0 -1
  28. akshare/economic/macro_euro.py +103 -56
  29. akshare/economic/macro_germany.py +1 -1
  30. akshare/economic/macro_japan.py +0 -1
  31. akshare/economic/macro_other.py +1 -6
  32. akshare/economic/macro_swiss.py +2 -3
  33. akshare/economic/macro_uk.py +1 -1
  34. akshare/economic/macro_usa.py +0 -2
  35. akshare/energy/energy_carbon.py +0 -1
  36. akshare/energy/energy_oil_em.py +1 -2
  37. akshare/event/cons.py +1 -0
  38. akshare/forex/forex_em.py +0 -1
  39. akshare/fortune/fortune_bloomberg.py +6 -3
  40. akshare/fortune/fortune_forbes_500.py +3 -6
  41. akshare/fortune/fortune_hurun.py +2 -1
  42. akshare/fortune/fortune_xincaifu_500.py +17 -14
  43. akshare/fund/fund_announcement.py +1 -0
  44. akshare/fund/fund_aum_em.py +47 -35
  45. akshare/fund/fund_em.py +0 -7
  46. akshare/fund/fund_etf_em.py +0 -5
  47. akshare/fund/fund_fhsp_em.py +27 -20
  48. akshare/fund/fund_init_em.py +8 -5
  49. akshare/fund/fund_lof_em.py +0 -5
  50. akshare/fund/fund_manager.py +18 -7
  51. akshare/fund/fund_portfolio_em.py +0 -1
  52. akshare/fund/fund_position_lg.py +19 -8
  53. akshare/fund/fund_rank_em.py +0 -3
  54. akshare/fund/fund_rating.py +28 -9
  55. akshare/fund/fund_scale_em.py +24 -13
  56. akshare/futures/futures_comex_em.py +1 -0
  57. akshare/futures/futures_contract_detail.py +11 -8
  58. akshare/futures/futures_inventory_em.py +0 -2
  59. akshare/futures/futures_rule.py +5 -1
  60. akshare/futures/futures_settlement_price_sgx.py +21 -6
  61. akshare/futures/futures_stock_js.py +0 -1
  62. akshare/futures/receipt.py +279 -153
  63. akshare/futures/requests_fun.py +16 -3
  64. akshare/futures_derivative/cons.py +100 -103
  65. akshare/futures_derivative/futures_contract_info_cffex.py +53 -39
  66. akshare/futures_derivative/futures_contract_info_dce.py +16 -9
  67. akshare/futures_derivative/futures_contract_info_gfex.py +43 -31
  68. akshare/futures_derivative/futures_index_sina.py +25 -13
  69. akshare/fx/cons.py +12 -7
  70. akshare/fx/fx_quote.py +1 -0
  71. akshare/fx/fx_quote_baidu.py +2 -1
  72. akshare/hf/__init__.py +1 -1
  73. akshare/hf/hf_sp500.py +8 -7
  74. akshare/index/index_eri.py +1 -0
  75. akshare/index/index_global_em.py +0 -1
  76. akshare/index/index_kq_fz.py +17 -14
  77. akshare/index/index_kq_ss.py +1 -0
  78. akshare/index/index_stock_hk.py +0 -1
  79. akshare/index/index_stock_zh.py +0 -3
  80. akshare/index/index_sugar.py +18 -4
  81. akshare/index/index_zh_em.py +0 -15
  82. akshare/interest_rate/interbank_rate_em.py +0 -1
  83. akshare/movie/jm.js +0 -1
  84. akshare/news/__init__.py +1 -1
  85. akshare/news/news_stock.py +0 -1
  86. akshare/option/option_commodity_sina.py +22 -26
  87. akshare/option/option_daily_stats_sse_szse.py +0 -1
  88. akshare/option/option_em.py +0 -1
  89. akshare/option/option_lhb_em.py +0 -1
  90. akshare/option/option_risk_indicator_sse.py +0 -1
  91. akshare/other/__init__.py +1 -1
  92. akshare/pro/__init__.py +0 -1
  93. akshare/pro/client.py +6 -4
  94. akshare/pro/cons.py +3 -2
  95. akshare/pro/data_pro.py +6 -5
  96. akshare/qhkc/qhkc_api.py +63 -21
  97. akshare/qhkc_web/qhkc_fund.py +1 -0
  98. akshare/qhkc_web/qhkc_index.py +1 -0
  99. akshare/qhkc_web/qhkc_tool.py +55 -54
  100. akshare/rate/__init__.py +1 -1
  101. akshare/rate/repo_rate.py +36 -32
  102. akshare/reits/__init__.py +1 -1
  103. akshare/reits/reits_basic.py +139 -5
  104. akshare/sport/__init__.py +1 -1
  105. akshare/sport/sport_olympic.py +1 -0
  106. akshare/spot/__init__.py +1 -1
  107. akshare/stock/cons.py +19 -12
  108. akshare/stock/stock_board_concept_em.py +0 -6
  109. akshare/stock/stock_board_industry_em.py +0 -6
  110. akshare/stock/stock_dzjy_em.py +1 -1
  111. akshare/stock/stock_fund_em.py +0 -2
  112. akshare/stock/stock_fund_hold.py +1 -2
  113. akshare/stock/stock_gsrl_em.py +1 -0
  114. akshare/stock/stock_hk_famous.py +0 -1
  115. akshare/stock/stock_hk_fhpx_ths.py +2 -1
  116. akshare/stock/stock_hk_hot_rank_em.py +1 -0
  117. akshare/stock/stock_hold_control_em.py +0 -2
  118. akshare/stock/stock_hot_up_em.py +4 -1
  119. akshare/stock/stock_hsgt_em.py +0 -2
  120. akshare/stock/stock_industry.py +1 -0
  121. akshare/stock/stock_info.py +0 -2
  122. akshare/stock/stock_info_em.py +0 -1
  123. akshare/stock/stock_repurchase_em.py +7 -2
  124. akshare/stock/stock_share_hold.py +0 -1
  125. akshare/stock/stock_stop.py +0 -1
  126. akshare/stock/stock_summary.py +0 -2
  127. akshare/stock/stock_us_famous.py +0 -1
  128. akshare/stock/stock_us_js.py +3 -2
  129. akshare/stock/stock_us_pink.py +0 -1
  130. akshare/stock/stock_weibo_nlp.py +18 -20
  131. akshare/stock/stock_zh_a_special.py +0 -3
  132. akshare/stock/stock_zh_a_tick_tx.py +11 -3
  133. akshare/stock_a/stock_board_concept_name_em.py +0 -1
  134. akshare/stock_a/stock_zh_a_spot.py +0 -1
  135. akshare/stock_feature/cons.py +1 -0
  136. akshare/stock_feature/stock_account_em.py +0 -1
  137. akshare/stock_feature/stock_all_pb.py +2 -1
  138. akshare/stock_feature/stock_analyst_em.py +0 -3
  139. akshare/stock_feature/stock_buffett_index_lg.py +7 -6
  140. akshare/stock_feature/stock_classify_sina.py +3 -6
  141. akshare/stock_feature/stock_comment_em.py +0 -2
  142. akshare/stock_feature/stock_congestion_lg.py +2 -1
  143. akshare/stock_feature/stock_dxsyl_em.py +116 -71
  144. akshare/stock_feature/stock_gdzjc_em.py +16 -5
  145. akshare/stock_feature/stock_gxl_lg.py +3 -2
  146. akshare/stock_feature/stock_hist_em.py +0 -20
  147. akshare/stock_feature/stock_hist_tx.py +10 -8
  148. akshare/stock_feature/stock_hot_xq.py +4 -6
  149. akshare/stock_feature/stock_hsgt_em.py +0 -2
  150. akshare/stock_feature/stock_hsgt_exchange_rate.py +0 -2
  151. akshare/stock_feature/stock_hsgt_min_em.py +13 -16
  152. akshare/stock_feature/stock_inner_trade_xq.py +0 -1
  153. akshare/stock_feature/stock_lhb_em.py +0 -1
  154. akshare/stock_feature/stock_margin_em.py +0 -1
  155. akshare/stock_feature/stock_margin_sse.py +0 -2
  156. akshare/stock_feature/stock_pankou_em.py +0 -2
  157. akshare/stock_feature/stock_qsjy_em.py +13 -4
  158. akshare/stock_feature/stock_research_report_em.py +0 -1
  159. akshare/stock_feature/stock_yjyg_cninfo.py +4 -1
  160. akshare/stock_feature/stock_zh_vote_baidu.py +4 -1
  161. akshare/stock_feature/stock_ztb_em.py +0 -6
  162. akshare/stock_fundamental/__init__.py +1 -1
  163. akshare/stock_fundamental/stock_hold.py +26 -17
  164. akshare/stock_fundamental/stock_ipo_declare.py +1 -0
  165. akshare/stock_fundamental/stock_kcb_detail_sse.py +10 -10
  166. akshare/stock_fundamental/stock_kcb_sse.py +26 -25
  167. akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py +64 -41
  168. akshare/stock_fundamental/stock_recommend.py +20 -4
  169. akshare/utils/demjson.py +2005 -1334
  170. akshare/utils/token_process.py +6 -5
  171. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/METADATA +3 -8
  172. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/RECORD +175 -175
  173. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/WHEEL +0 -0
  174. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/licenses/LICENSE +0 -0
  175. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/top_level.txt +0 -0
@@ -5,6 +5,7 @@ Date: 2022/1/7 17:02
5
5
  Desc: 东方财富网-数据中心-新股申购-首发申报信息-首发申报企业信息
6
6
  https://data.eastmoney.com/xg/xg/sbqy.html
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
 
@@ -4,6 +4,7 @@
4
4
  Date: 2022/4/7 17:36
5
5
  Desc: http://kcb.sse.com.cn/renewal/xmxq/index.shtml?auditId=926&anchor_type=0
6
6
  """
7
+
7
8
  import requests
8
9
  import pandas as pd
9
10
 
@@ -13,20 +14,19 @@ import pandas as pd
13
14
  def stock_kcb_detail_renewal():
14
15
  url = "http://query.sse.com.cn/commonSoaQuery.do"
15
16
  params = {
16
- 'isPagination': 'true',
17
- 'sqlId': 'SH_XM_LB',
18
- 'stockAuditNum': '926', # 每次更新该字段就可以
19
- '_': '1649324745607',
17
+ "isPagination": "true",
18
+ "sqlId": "SH_XM_LB",
19
+ "stockAuditNum": "926", # 每次更新该字段就可以
20
+ "_": "1649324745607",
20
21
  }
21
22
  headers = {
22
- 'Host': 'query.sse.com.cn',
23
- 'Pragma': 'no-cache',
24
- 'Referer': 'http://kcb.sse.com.cn/',
25
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36'
23
+ "Host": "query.sse.com.cn",
24
+ "Pragma": "no-cache",
25
+ "Referer": "http://kcb.sse.com.cn/",
26
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36",
26
27
  }
27
28
  r = requests.get(url, params=params, headers=headers)
28
29
  data_json = r.json()
29
- temp_df = pd.DataFrame(data_json['result'])
30
+ temp_df = pd.DataFrame(data_json["result"])
30
31
  # 处理下 temp_df 里面的字段就可以了
31
32
  print(temp_df)
32
-
@@ -4,6 +4,7 @@
4
4
  Date: 2022/4/7 17:36
5
5
  Desc: http://kcb.sse.com.cn/renewal/#
6
6
  """
7
+
7
8
  import requests
8
9
  import pandas as pd
9
10
 
@@ -13,43 +14,43 @@ import pandas as pd
13
14
  def stock_kcb_renewal():
14
15
  url = "http://query.sse.com.cn/statusAction.do"
15
16
  params = {
16
- 'isPagination': 'true',
17
- 'sqlId': 'SH_XM_LB',
18
- 'pageHelp.pageSize': '20',
19
- 'offerType': '',
20
- 'commitiResult': '',
21
- 'registeResult': '',
22
- 'province': '',
23
- 'csrcCode': '',
24
- 'currStatus': '',
25
- 'order': 'updateDate|desc,stockAuditNum|desc',
26
- 'keyword': '',
27
- 'auditApplyDateBegin': '',
28
- 'auditApplyDateEnd': '',
29
- 'pageHelp.pageNo': '1',
30
- 'pageHelp.beginPage': '1',
31
- 'pageHelp.endPage': '1',
32
- '_': '1649322742207',
17
+ "isPagination": "true",
18
+ "sqlId": "SH_XM_LB",
19
+ "pageHelp.pageSize": "20",
20
+ "offerType": "",
21
+ "commitiResult": "",
22
+ "registeResult": "",
23
+ "province": "",
24
+ "csrcCode": "",
25
+ "currStatus": "",
26
+ "order": "updateDate|desc,stockAuditNum|desc",
27
+ "keyword": "",
28
+ "auditApplyDateBegin": "",
29
+ "auditApplyDateEnd": "",
30
+ "pageHelp.pageNo": "1",
31
+ "pageHelp.beginPage": "1",
32
+ "pageHelp.endPage": "1",
33
+ "_": "1649322742207",
33
34
  }
34
35
  headers = {
35
- 'Host': 'query.sse.com.cn',
36
- 'Pragma': 'no-cache',
37
- 'Referer': 'http://kcb.sse.com.cn/',
38
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36'
36
+ "Host": "query.sse.com.cn",
37
+ "Pragma": "no-cache",
38
+ "Referer": "http://kcb.sse.com.cn/",
39
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36",
39
40
  }
40
41
 
41
42
  for page in range(1, 37):
42
43
  print(page)
43
44
  params.update(
44
45
  {
45
- 'pageHelp.pageNo': page,
46
- 'pageHelp.beginPage': page,
47
- 'pageHelp.endPage': page,
46
+ "pageHelp.pageNo": page,
47
+ "pageHelp.beginPage": page,
48
+ "pageHelp.endPage": page,
48
49
  }
49
50
  )
50
51
  r = requests.get(url, params=params, headers=headers)
51
52
  data_json = r.json()
52
- temp_df = pd.DataFrame(data_json['result'])
53
+ temp_df = pd.DataFrame(data_json["result"])
53
54
  # 处理下 temp_df 里面的字段就可以了
54
55
  print(temp_df)
55
56
  break
@@ -5,13 +5,16 @@ Date: 2024/1/7 15:00
5
5
  Desc: 东方财富网-数据中心-研究报告-盈利预测
6
6
  https://data.eastmoney.com/report/profitforecast.jshtml
7
7
  """
8
+
8
9
  from io import StringIO
9
10
 
10
11
  import pandas as pd
11
12
  import requests
12
13
 
13
14
 
14
- def stock_hk_profit_forecast_et(symbol: str = "09999", indicator: str = "盈利预测概览") -> pd.DataFrame:
15
+ def stock_hk_profit_forecast_et(
16
+ symbol: str = "09999", indicator: str = "盈利预测概览"
17
+ ) -> pd.DataFrame:
15
18
  """
16
19
  经济通-公司资料-盈利预测
17
20
  https://www.etnet.com.hk/www/sc/stocks/realtime/quote_profit.php?code=9999
@@ -46,58 +49,78 @@ def stock_hk_profit_forecast_et(symbol: str = "09999", indicator: str = "盈利
46
49
  return temp_df
47
50
  elif indicator == "综合盈利预测":
48
51
  temp_df = pd.read_html(StringIO(r.text), header=0)[3]
49
- temp_df.rename(columns={
50
- "纯利/(亏损) (百万元人民币)": "纯利/亏损",
51
- "纯利/(亏损) (百万港元)": "纯利/亏损",
52
- "每股盈利/ (亏损)()": "每股盈利/每股亏损",
53
- "每股盈利/ (亏损)(港仙)": "每股盈利/每股亏损",
54
- "每股派息 ()": "每股派息",
55
- "每股派息 (港仙)": "每股派息",
56
- "每股资产净值 (人民币元)": "每股资产净值",
57
- "每股资产净值 (港元)": "每股资产净值",
58
- "最高 (百万元人民币)": "最高",
59
- "最高 (百万港元)": "最高",
60
- "最低 (百万元人民币)": "最低",
61
- "最低 (百万港元)": "最低",
62
- }, inplace=True)
63
- temp_df['纯利/亏损'] = pd.to_numeric(temp_df['纯利/亏损'], errors='coerce')
64
- temp_df['每股盈利/每股亏损'] = pd.to_numeric(temp_df['每股盈利/每股亏损'], errors='coerce')
65
- temp_df['每股派息'] = pd.to_numeric(temp_df['每股派息'], errors='coerce')
66
- temp_df['每股资产净值'] = pd.to_numeric(temp_df['每股资产净值'], errors='coerce')
67
- temp_df['最高'] = pd.to_numeric(temp_df['最高'], errors='coerce')
68
- temp_df['最低'] = pd.to_numeric(temp_df['最低'], errors='coerce')
52
+ temp_df.rename(
53
+ columns={
54
+ "纯利/(亏损) (百万元人民币)": "纯利/亏损",
55
+ "纯利/(亏损) (百万港元)": "纯利/亏损",
56
+ "每股盈利/ (亏损)()": "每股盈利/每股亏损",
57
+ "每股盈利/ (亏损)(港仙)": "每股盈利/每股亏损",
58
+ "每股派息 ()": "每股派息",
59
+ "每股派息 (港仙)": "每股派息",
60
+ "每股资产净值 (人民币元)": "每股资产净值",
61
+ "每股资产净值 (港元)": "每股资产净值",
62
+ "最高 (百万元人民币)": "最高",
63
+ "最高 (百万港元)": "最高",
64
+ "最低 (百万元人民币)": "最低",
65
+ "最低 (百万港元)": "最低",
66
+ },
67
+ inplace=True,
68
+ )
69
+ temp_df["纯利/亏损"] = pd.to_numeric(temp_df["纯利/亏损"], errors="coerce")
70
+ temp_df["每股盈利/每股亏损"] = pd.to_numeric(
71
+ temp_df["每股盈利/每股亏损"], errors="coerce"
72
+ )
73
+ temp_df["每股派息"] = pd.to_numeric(temp_df["每股派息"], errors="coerce")
74
+ temp_df["每股资产净值"] = pd.to_numeric(
75
+ temp_df["每股资产净值"], errors="coerce"
76
+ )
77
+ temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce")
78
+ temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
69
79
  return temp_df
70
80
  elif indicator == "盈利预测概览":
71
81
  temp_df = pd.read_html(StringIO(r.text), header=0)[4]
72
- del temp_df['目标价* (港元).1']
73
- temp_df.rename(columns={
74
- "纯利/(亏损) (百万元人民币)": "纯利/亏损",
75
- "纯利/(亏损) (百万港元)": "纯利/亏损",
76
- "每股盈利*/ (亏损) (港仙)": "每股盈利",
77
- "每股盈利*/ (亏损) ()": "每股盈利",
78
- "每股派息* (分)": "每股派息",
79
- "每股派息* (港仙)": "每股派息",
80
- "目标价* (港元)": "目标价",
81
- }, inplace=True)
82
+ del temp_df["目标价* (港元).1"]
83
+ temp_df.rename(
84
+ columns={
85
+ "纯利/(亏损) (百万元人民币)": "纯利/亏损",
86
+ "纯利/(亏损) (百万港元)": "纯利/亏损",
87
+ "每股盈利*/ (亏损) (港仙)": "每股盈利",
88
+ "每股盈利*/ (亏损) (分)": "每股盈利",
89
+ "每股派息* ()": "每股派息",
90
+ "每股派息* (港仙)": "每股派息",
91
+ "目标价* (港元)": "目标价",
92
+ },
93
+ inplace=True,
94
+ )
82
95
  temp_df.dropna(inplace=True)
83
- temp_df['纯利/亏损'] = pd.to_numeric(temp_df['纯利/亏损'], errors='coerce')
84
- temp_df['每股盈利'] = pd.to_numeric(temp_df['每股盈利'], errors='coerce')
85
- temp_df['每股派息'] = pd.to_numeric(temp_df['每股派息'], errors='coerce')
86
- temp_df['目标价'] = pd.to_numeric(temp_df['目标价'], errors='coerce')
87
- temp_df['更新日期'] = pd.to_datetime(temp_df['更新日期'], errors='coerce', dayfirst=True).dt.date
88
- temp_df['财政年度'] = temp_df['财政年度'].astype(int).astype(str)
96
+ temp_df["纯利/亏损"] = pd.to_numeric(temp_df["纯利/亏损"], errors="coerce")
97
+ temp_df["每股盈利"] = pd.to_numeric(temp_df["每股盈利"], errors="coerce")
98
+ temp_df["每股派息"] = pd.to_numeric(temp_df["每股派息"], errors="coerce")
99
+ temp_df["目标价"] = pd.to_numeric(temp_df["目标价"], errors="coerce")
100
+ temp_df["更新日期"] = pd.to_datetime(
101
+ temp_df["更新日期"], errors="coerce", dayfirst=True
102
+ ).dt.date
103
+ temp_df["财政年度"] = temp_df["财政年度"].astype(int).astype(str)
89
104
  return temp_df
90
105
 
91
106
 
92
107
  if __name__ == "__main__":
93
- stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(symbol="09999", indicator="评级总览")
108
+ stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(
109
+ symbol="09999", indicator="评级总览"
110
+ )
94
111
  print(stock_hk_profit_forecast_et_df)
95
112
 
96
- stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(symbol="09999", indicator="去年度业绩表现")
113
+ stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(
114
+ symbol="09999", indicator="去年度业绩表现"
115
+ )
97
116
  print(stock_hk_profit_forecast_et_df)
98
117
 
99
- stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(symbol="09999", indicator="综合盈利预测")
118
+ stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(
119
+ symbol="09999", indicator="综合盈利预测"
120
+ )
100
121
  print(stock_hk_profit_forecast_et_df)
101
122
 
102
- stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(symbol="09999", indicator="盈利预测概览")
123
+ stock_hk_profit_forecast_et_df = stock_hk_profit_forecast_et(
124
+ symbol="09999", indicator="盈利预测概览"
125
+ )
103
126
  print(stock_hk_profit_forecast_et_df)
@@ -5,6 +5,7 @@ Date: 2022/1/7 13:40
5
5
  Desc: 新浪财经-机构推荐池
6
6
  http://stock.finance.sina.com.cn/stock/go.php/vIR_RatingNewest/index.phtml
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
  from bs4 import BeautifulSoup
@@ -26,7 +27,10 @@ def stock_institute_recommend(symbol: str = "投资评级选股") -> pd.DataFram
26
27
  }
27
28
  r = requests.get(url, params=params)
28
29
  soup = BeautifulSoup(r.text, "lxml")
29
- indicator_map = {item.find("a").text: item.find("a")["href"] for item in soup.find(attrs={"id": "leftMenu"}).find_all("dd")[1].find_all("li")}
30
+ indicator_map = {
31
+ item.find("a").text: item.find("a")["href"]
32
+ for item in soup.find(attrs={"id": "leftMenu"}).find_all("dd")[1].find_all("li")
33
+ }
30
34
  url = indicator_map[symbol]
31
35
  params = {
32
36
  "num": "10000",
@@ -90,10 +94,22 @@ def stock_institute_recommend_detail(symbol: str = "000001") -> pd.DataFrame:
90
94
  return temp_df
91
95
 
92
96
 
93
- if __name__ == '__main__':
94
- for item in ['最新投资评级', '上调评级股票', '下调评级股票', '股票综合评级', '首次评级股票', '目标涨幅排名', '机构关注度', '行业关注度', '投资评级选股']:
97
+ if __name__ == "__main__":
98
+ for item in [
99
+ "最新投资评级",
100
+ "上调评级股票",
101
+ "下调评级股票",
102
+ "股票综合评级",
103
+ "首次评级股票",
104
+ "目标涨幅排名",
105
+ "机构关注度",
106
+ "行业关注度",
107
+ "投资评级选股",
108
+ ]:
95
109
  stock_institute_recommend_df = stock_institute_recommend(symbol=item)
96
110
  print(stock_institute_recommend_df)
97
111
 
98
- stock_institute_recommend_detail_df = stock_institute_recommend_detail(symbol="002709")
112
+ stock_institute_recommend_detail_df = stock_institute_recommend_detail(
113
+ symbol="002709"
114
+ )
99
115
  print(stock_institute_recommend_detail_df)