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/11/27 13:30
5
5
  Desc: 美股目标价 or 港股目标价
6
6
  https://www.ushknews.com/report.html
7
7
  """
8
+
8
9
  import requests
9
10
  import pandas as pd
10
11
 
@@ -20,8 +21,8 @@ def stock_price_js(symbol: str = "us") -> pd.DataFrame:
20
21
  """
21
22
  url = "https://calendar-api.ushknews.com/getWebTargetPriceList"
22
23
  params = {
23
- 'limit': '20',
24
- 'category': symbol,
24
+ "limit": "20",
25
+ "category": symbol,
25
26
  }
26
27
  headers = {
27
28
  "accept": "application/json, text/plain, */*",
@@ -30,7 +30,6 @@ def stock_us_pink_spot_em() -> pd.DataFrame:
30
30
  "fs": "m:153",
31
31
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,"
32
32
  "f26,f22,f33,f11,f62,f128,f136,f115,f152",
33
- "_": "1631271634231",
34
33
  }
35
34
  r = requests.get(url, params=params)
36
35
  data_json = r.json()
@@ -9,6 +9,7 @@ https://datacenter.jin10.com/market
9
9
  红色颜色越深,表明该股票讨论热度越高,其当前的涨幅更大。
10
10
  绿色颜色越深,表明该股票讨论的热度越低,其当前的跌幅更大。
11
11
  """
12
+
12
13
  import time
13
14
  from typing import Dict
14
15
 
@@ -55,34 +56,31 @@ def stock_js_weibo_report(time_period: str = "CNHOUR12") -> pd.DataFrame:
55
56
  :rtype: pandas.DataFrame
56
57
  """
57
58
  url = "https://datacenter-api.jin10.com/weibo/list"
58
- payload = {
59
- "timescale": time_period,
60
- "_": int(time.time() * 1000)
61
- }
59
+ payload = {"timescale": time_period, "_": int(time.time() * 1000)}
62
60
  headers = {
63
- 'authority': 'datacenter-api.jin10.com',
64
- 'pragma': 'no-cache',
65
- 'cache-control': 'no-cache',
66
- 'accept': '*/*',
67
- 'x-app-id': 'rU6QIu7JHe2gOUeR',
68
- 'sec-fetch-dest': 'empty',
69
- 'x-csrf-token': '',
70
- 'x-version': '1.0.0',
71
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36',
72
- 'origin': 'https://datacenter.jin10.com',
73
- 'sec-fetch-site': 'same-site',
74
- 'sec-fetch-mode': 'cors',
75
- 'referer': 'https://datacenter.jin10.com/market',
76
- 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8'
61
+ "authority": "datacenter-api.jin10.com",
62
+ "pragma": "no-cache",
63
+ "cache-control": "no-cache",
64
+ "accept": "*/*",
65
+ "x-app-id": "rU6QIu7JHe2gOUeR",
66
+ "sec-fetch-dest": "empty",
67
+ "x-csrf-token": "",
68
+ "x-version": "1.0.0",
69
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36",
70
+ "origin": "https://datacenter.jin10.com",
71
+ "sec-fetch-site": "same-site",
72
+ "sec-fetch-mode": "cors",
73
+ "referer": "https://datacenter.jin10.com/market",
74
+ "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
77
75
  }
78
76
 
79
77
  r = requests.get(url, params=payload, headers=headers)
80
78
  temp_df = pd.DataFrame(r.json()["data"])
81
- temp_df['rate'] = pd.to_numeric(temp_df['rate'])
79
+ temp_df["rate"] = pd.to_numeric(temp_df["rate"])
82
80
  return temp_df
83
81
 
84
82
 
85
- if __name__ == '__main__':
83
+ if __name__ == "__main__":
86
84
  stock_js_weibo_nlp_time_map = stock_js_weibo_nlp_time()
87
85
  print(stock_js_weibo_nlp_time_map)
88
86
 
@@ -37,7 +37,6 @@ def stock_zh_a_st_em() -> pd.DataFrame:
37
37
  "fs": "m:0 f:4,m:1 f:4",
38
38
  "fields": "f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
39
39
  "f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
40
- "_": "1631107510188",
41
40
  }
42
41
  temp_df = fetch_paginated_data(url, params)
43
42
  temp_df.columns = [
@@ -128,7 +127,6 @@ def stock_zh_a_new_em() -> pd.DataFrame:
128
127
  "fs": "m:0 f:8,m:1 f:8",
129
128
  "fields": "f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,"
130
129
  "f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
131
- "_": "1631107510188",
132
130
  }
133
131
  temp_df = fetch_paginated_data(url, params)
134
132
  temp_df.columns = [
@@ -219,7 +217,6 @@ def stock_zh_a_stop_em() -> pd.DataFrame:
219
217
  "fs": "m:0 s:3",
220
218
  "fields": "f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,"
221
219
  "f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
222
- "_": "1631107510188",
223
220
  }
224
221
  temp_df = fetch_paginated_data(url, params)
225
222
  temp_df.columns = [
@@ -6,6 +6,7 @@ Desc: 腾讯-股票-实时行情-成交明细
6
6
  成交明细-每个交易日 16:00 提供当日数据
7
7
  港股报价延时 15 分钟
8
8
  """
9
+
9
10
  import warnings
10
11
 
11
12
  import pandas as pd
@@ -36,17 +37,24 @@ def stock_zh_a_tick_tx_js(symbol: str = "sz000001") -> pd.DataFrame:
36
37
  r = requests.get(url, params=params)
37
38
  text_data = r.text
38
39
  temp_df = (
39
- pd.DataFrame(eval(text_data[text_data.find("["):])[1].split("|"))
40
+ pd.DataFrame(eval(text_data[text_data.find("[") :])[1].split("|"))
40
41
  .iloc[:, 0]
41
42
  .str.split("/", expand=True)
42
43
  )
43
44
  page += 1
44
45
  big_df = pd.concat([big_df, temp_df], ignore_index=True)
45
- except:
46
+ except: # noqa: E722
46
47
  break
47
48
  if not big_df.empty:
48
49
  big_df = big_df.iloc[:, 1:].copy()
49
- big_df.columns = ["成交时间", "成交价格", "价格变动", "成交量", "成交金额", "性质"]
50
+ big_df.columns = [
51
+ "成交时间",
52
+ "成交价格",
53
+ "价格变动",
54
+ "成交量",
55
+ "成交金额",
56
+ "性质",
57
+ ]
50
58
  big_df.reset_index(drop=True, inplace=True)
51
59
  property_map = {
52
60
  "S": "卖盘",
@@ -145,7 +145,6 @@ async def stock_board_concept_name_em_async() -> pd.DataFrame:
145
145
  "fid": "f3", # 按涨跌幅排序
146
146
  "fs": "m:90 t:3 f:!50",
147
147
  "fields": "f2,f3,f4,f8,f12,f14,f15,f16,f17,f18,f20,f21,f24,f25,f22,f33,f11,f62,f128,f124,f107,f104,f105,f136",
148
- "_": "1626075887768",
149
148
  }
150
149
 
151
150
  results = await fetch_all_pages_async(url, params)
@@ -212,7 +212,6 @@ async def stock_zh_a_spot_em_async() -> pd.DataFrame:
212
212
  "fs": "m:0 t:6,m:0 t:80,m:1 t:2,m:1 t:23,m:0 t:81 s:2048",
213
213
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,"
214
214
  "f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
215
- "_": "1623833739532",
216
215
  }
217
216
 
218
217
  results = await fetch_all_pages_async(url, params)
@@ -4,6 +4,7 @@
4
4
  Date: 2019/12/30 21:02
5
5
  Desc:
6
6
  """
7
+
7
8
  stock_em_sy_js = """
8
9
  function getCode(num) {
9
10
  var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -31,7 +31,6 @@ def stock_account_statistics_em() -> pd.DataFrame:
31
31
  "pageNo": "1",
32
32
  "pageNum": "1",
33
33
  "pageNumber": "1",
34
- "_": "1640749656405",
35
34
  }
36
35
  r = requests.get(url, params=params)
37
36
  data_json = r.json()
@@ -5,6 +5,7 @@ Date: 2023/4/11 20:40
5
5
  Desc: 全部A股-等权重市净率、中位数市净率
6
6
  https://www.legulegu.com/stockdata/all-pb
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
 
@@ -26,7 +27,7 @@ def stock_a_all_pb() -> pd.DataFrame:
26
27
  r = requests.get(
27
28
  url,
28
29
  params=params,
29
- **get_cookie_csrf(url="https://legulegu.com/stockdata/all-pb")
30
+ **get_cookie_csrf(url="https://legulegu.com/stockdata/all-pb"),
30
31
  )
31
32
  data_json = r.json()
32
33
  temp_df = pd.DataFrame(data_json["data"])
@@ -127,7 +127,6 @@ def stock_analyst_detail_em(
127
127
  "pageNumber": "1",
128
128
  "pageSize": "1000",
129
129
  "filter": f'(ANALYST_CODE="{analyst_id}")',
130
- "_": "1675744438197",
131
130
  }
132
131
  r = requests.get(url, params=params, headers=headers)
133
132
  data_json = r.json()
@@ -186,7 +185,6 @@ def stock_analyst_detail_em(
186
185
  "pageNumber": "1",
187
186
  "pageSize": "1000",
188
187
  "filter": f'(ANALYST_CODE="{analyst_id}")',
189
- "_": "1675744438197",
190
188
  }
191
189
  r = requests.get(url, params=params, headers=headers)
192
190
  data_json = r.json()
@@ -236,7 +234,6 @@ def stock_analyst_detail_em(
236
234
  "filter": f'(ANALYST_CODE="{analyst_id}")',
237
235
  "source": "WEB",
238
236
  "client": "WEB",
239
- "_": "1675744438200",
240
237
  }
241
238
  r = requests.get(url, params=params, headers=headers)
242
239
  data_json = r.json()
@@ -5,6 +5,7 @@ Date: 2023/4/5 22:05
5
5
  Desc: 乐估乐股-底部研究-巴菲特指标
6
6
  https://legulegu.com/stockdata/marketcap-gdp
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
 
@@ -24,7 +25,7 @@ def stock_buffett_index_lg() -> pd.DataFrame:
24
25
  r = requests.get(
25
26
  url,
26
27
  params=params,
27
- **get_cookie_csrf(url="https://legulegu.com/stockdata/marketcap-gdp")
28
+ **get_cookie_csrf(url="https://legulegu.com/stockdata/marketcap-gdp"),
28
29
  )
29
30
  data_json = r.json()
30
31
  temp_df = pd.DataFrame(data_json["data"])
@@ -50,11 +51,11 @@ def stock_buffett_index_lg() -> pd.DataFrame:
50
51
  ]
51
52
  ]
52
53
  temp_df["日期"] = pd.to_datetime(temp_df["日期"], unit="ms").dt.date
53
- temp_df['收盘价'] = pd.to_numeric(temp_df['收盘价'], errors="coerce")
54
- temp_df['总市值'] = pd.to_numeric(temp_df['总市值'], errors="coerce")
55
- temp_df['GDP'] = pd.to_numeric(temp_df['GDP'], errors="coerce")
56
- temp_df['近十年分位数'] = pd.to_numeric(temp_df['近十年分位数'], errors="coerce")
57
- temp_df['总历史分位数'] = pd.to_numeric(temp_df['总历史分位数'], errors="coerce")
54
+ temp_df["收盘价"] = pd.to_numeric(temp_df["收盘价"], errors="coerce")
55
+ temp_df["总市值"] = pd.to_numeric(temp_df["总市值"], errors="coerce")
56
+ temp_df["GDP"] = pd.to_numeric(temp_df["GDP"], errors="coerce")
57
+ temp_df["近十年分位数"] = pd.to_numeric(temp_df["近十年分位数"], errors="coerce")
58
+ temp_df["总历史分位数"] = pd.to_numeric(temp_df["总历史分位数"], errors="coerce")
58
59
  return temp_df
59
60
 
60
61
 
@@ -5,6 +5,7 @@ Date: 2022/7/13 16:16
5
5
  Desc: 新浪财经-股票-行业分类
6
6
  http://vip.stock.finance.sina.com.cn/mkt/
7
7
  """
8
+
8
9
  import math
9
10
 
10
11
  import pandas as pd
@@ -30,9 +31,7 @@ def stock_classify_board() -> dict:
30
31
  for item in data_json[1][0][1]
31
32
  ] # 沪深股市
32
33
  for num, class_name in enumerate(class_name_list):
33
- temp_df = pd.DataFrame(
34
- [item for item in data_json[1][0][1][num][1:][0]]
35
- )
34
+ temp_df = pd.DataFrame([item for item in data_json[1][0][1][num][1:][0]])
36
35
  if temp_df.shape[1] == 5:
37
36
  temp_df.columns = ["name", "_", "code", "_", "_"]
38
37
  temp_df = temp_df[["name", "code"]]
@@ -57,9 +56,7 @@ def stock_classify_sina(symbol: str = "热门概念") -> pd.DataFrame:
57
56
  """
58
57
  stock_classify_board_dict = stock_classify_board()
59
58
  data_df = pd.DataFrame()
60
- for num in tqdm(
61
- range(len(stock_classify_board_dict[symbol]["code"])), leave=False
62
- ):
59
+ for num in tqdm(range(len(stock_classify_board_dict[symbol]["code"])), leave=False):
63
60
  url = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeStockCount"
64
61
  params = {"node": stock_classify_board_dict[symbol]["code"][num]}
65
62
  r = requests.get(url, params=params)
@@ -132,7 +132,6 @@ def stock_comment_detail_zlkp_jgcyd_em(symbol: str = "600000") -> pd.DataFrame:
132
132
  "client": "WEB",
133
133
  "sortColumns": "TRADE_DATE",
134
134
  "sortTypes": "-1",
135
- "_": "1655387358195",
136
135
  }
137
136
  r = requests.get(url, params=params)
138
137
  data_json = r.json()
@@ -291,7 +290,6 @@ def stock_comment_detail_scrd_desire_daily_em(
291
290
  "sortColumns": "TRADE_DATE",
292
291
  "sortTypes": "-1",
293
292
  "pageSize": "30",
294
- "_": "1727189719991",
295
293
  }
296
294
  r = requests.get(url=url, params=params)
297
295
  data_json = r.json()
@@ -5,6 +5,7 @@ Date: 2023/4/7 15:05
5
5
  Desc: 乐咕乐股-大盘拥挤度
6
6
  https://legulegu.com/stockdata/ashares-congestion
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
 
@@ -24,7 +25,7 @@ def stock_a_congestion_lg() -> pd.DataFrame:
24
25
  r = requests.get(
25
26
  url,
26
27
  params=params,
27
- **get_cookie_csrf(url="https://legulegu.com/stockdata/ashares-congestion")
28
+ **get_cookie_csrf(url="https://legulegu.com/stockdata/ashares-congestion"),
28
29
  )
29
30
  data_json = r.json()
30
31
  temp_df = pd.DataFrame(data_json["items"])
@@ -8,6 +8,7 @@ https://data.eastmoney.com/xg/xg/dxsyl.html
8
8
  东方财富网-数据中心-新股数据-新股申购与中签查询
9
9
  https://data.eastmoney.com/xg/xg/default_2.html
10
10
  """
11
+
11
12
  import pandas as pd
12
13
  import requests
13
14
 
@@ -93,14 +94,30 @@ def stock_dxsyl_em() -> pd.DataFrame:
93
94
  ]
94
95
  big_df["发行价"] = pd.to_numeric(big_df["发行价"], errors="coerce")
95
96
  big_df["最新价"] = pd.to_numeric(big_df["最新价"], errors="coerce")
96
- big_df["网上-发行中签率"] = pd.to_numeric(big_df["网上-发行中签率"], errors="coerce")
97
- big_df["网上-有效申购股数"] = pd.to_numeric(big_df["网上-有效申购股数"], errors="coerce")
98
- big_df["网上-有效申购户数"] = pd.to_numeric(big_df["网上-有效申购户数"], errors="coerce")
99
- big_df["网上-超额认购倍数"] = pd.to_numeric(big_df["网上-超额认购倍数"], errors="coerce")
100
- big_df["网下-配售中签率"] = pd.to_numeric(big_df["网下-配售中签率"], errors="coerce")
101
- big_df["网下-有效申购股数"] = pd.to_numeric(big_df["网下-有效申购股数"], errors="coerce")
102
- big_df["网下-有效申购户数"] = pd.to_numeric(big_df["网下-有效申购户数"], errors="coerce")
103
- big_df["网下-配售认购倍数"] = pd.to_numeric(big_df["网下-配售认购倍数"], errors="coerce")
97
+ big_df["网上-发行中签率"] = pd.to_numeric(
98
+ big_df["网上-发行中签率"], errors="coerce"
99
+ )
100
+ big_df["网上-有效申购股数"] = pd.to_numeric(
101
+ big_df["网上-有效申购股数"], errors="coerce"
102
+ )
103
+ big_df["网上-有效申购户数"] = pd.to_numeric(
104
+ big_df["网上-有效申购户数"], errors="coerce"
105
+ )
106
+ big_df["网上-超额认购倍数"] = pd.to_numeric(
107
+ big_df["网上-超额认购倍数"], errors="coerce"
108
+ )
109
+ big_df["网下-配售中签率"] = pd.to_numeric(
110
+ big_df["网下-配售中签率"], errors="coerce"
111
+ )
112
+ big_df["网下-有效申购股数"] = pd.to_numeric(
113
+ big_df["网下-有效申购股数"], errors="coerce"
114
+ )
115
+ big_df["网下-有效申购户数"] = pd.to_numeric(
116
+ big_df["网下-有效申购户数"], errors="coerce"
117
+ )
118
+ big_df["网下-配售认购倍数"] = pd.to_numeric(
119
+ big_df["网下-配售认购倍数"], errors="coerce"
120
+ )
104
121
  big_df["总发行数量"] = pd.to_numeric(big_df["总发行数量"], errors="coerce")
105
122
  big_df["开盘溢价"] = pd.to_numeric(big_df["开盘溢价"], errors="coerce")
106
123
  big_df["首日涨幅"] = pd.to_numeric(big_df["首日涨幅"], errors="coerce")
@@ -151,47 +168,47 @@ def stock_xgsglb_em(symbol: str = "全部股票") -> pd.DataFrame:
151
168
 
152
169
  big_df.rename(
153
170
  columns={
154
- 'ORG_CODE': '-',
155
- 'SECURITY_CODE': '代码',
156
- 'SECUCODE': '带市场标识股票代码',
157
- 'SECURITY_NAME_ABBR': '简称',
158
- 'APPLY_CODE': '申购代码',
159
- 'EXPECT_ISSUE_NUM': '发行总数',
160
- 'PRICE_WAY': '定价方式',
161
- 'ISSUE_PRICE': '发行价格',
162
- 'ISSUE_PE_RATIO': '发行市盈率',
163
- 'APPLY_DATE': '申购日',
164
- 'RESULT_NOTICE_DATE': '发行结果公告日期',
165
- 'SELECT_LISTING_DATE': '上市首日-上市日',
166
- 'ONLINE_ISSUE_NUM': '网上-发行数量',
167
- 'APPLY_AMT_UPPER': '网上-顶格所需资金',
168
- 'APPLY_NUM_UPPER': '网上-申购上限',
169
- 'ONLINE_PAY_DATE': '网上申购缴款日期',
170
- 'ONLINE_REFUND_DATE': '网上申购资金退款日',
171
- 'INFO_CODE': '-',
172
- 'ONLINE_ISSUE_LWR': '中签率',
173
- 'NEWEST_PRICE': '最新价格-价格',
174
- 'CLOSE_PRICE': '首日收盘价',
175
- 'INITIAL_MULTIPLE': '-',
176
- 'PER_SHARES_INCOME': '上市首日-每百股获利',
177
- 'LD_CLOSE_CHANGE': '上市首日-涨幅',
178
- 'TURNOVERRATE': '首日换手率',
179
- 'AMPLITUDE': '首日振幅',
180
- 'ONLINE_APPLY_LOWER': '-',
181
- 'MAIN_BUSINESS': '主营业务',
182
- 'INDUSTRY_PE_RATIO': '行业市盈率',
183
- 'APPLY_AMT_100': '稳获百股需配资金',
184
- 'TAKE_UP_TIME': '资金占用时间',
185
- 'CAPTURE_PROFIT': '上市首日-约合年化收益',
186
- 'APPLY_SHARE_100': '每获配百股需配股数',
187
- 'AVERAGE_PRICE': '上市首日-均价',
188
- 'ORG_VAN': '参与申购人数',
189
- 'VA_AMT': '参与申购资金',
190
- 'ISSUE_PRICE_ADJFACTOR': '-'
171
+ "ORG_CODE": "-",
172
+ "SECURITY_CODE": "代码",
173
+ "SECUCODE": "带市场标识股票代码",
174
+ "SECURITY_NAME_ABBR": "简称",
175
+ "APPLY_CODE": "申购代码",
176
+ "EXPECT_ISSUE_NUM": "发行总数",
177
+ "PRICE_WAY": "定价方式",
178
+ "ISSUE_PRICE": "发行价格",
179
+ "ISSUE_PE_RATIO": "发行市盈率",
180
+ "APPLY_DATE": "申购日",
181
+ "RESULT_NOTICE_DATE": "发行结果公告日期",
182
+ "SELECT_LISTING_DATE": "上市首日-上市日",
183
+ "ONLINE_ISSUE_NUM": "网上-发行数量",
184
+ "APPLY_AMT_UPPER": "网上-顶格所需资金",
185
+ "APPLY_NUM_UPPER": "网上-申购上限",
186
+ "ONLINE_PAY_DATE": "网上申购缴款日期",
187
+ "ONLINE_REFUND_DATE": "网上申购资金退款日",
188
+ "INFO_CODE": "-",
189
+ "ONLINE_ISSUE_LWR": "中签率",
190
+ "NEWEST_PRICE": "最新价格-价格",
191
+ "CLOSE_PRICE": "首日收盘价",
192
+ "INITIAL_MULTIPLE": "-",
193
+ "PER_SHARES_INCOME": "上市首日-每百股获利",
194
+ "LD_CLOSE_CHANGE": "上市首日-涨幅",
195
+ "TURNOVERRATE": "首日换手率",
196
+ "AMPLITUDE": "首日振幅",
197
+ "ONLINE_APPLY_LOWER": "-",
198
+ "MAIN_BUSINESS": "主营业务",
199
+ "INDUSTRY_PE_RATIO": "行业市盈率",
200
+ "APPLY_AMT_100": "稳获百股需配资金",
201
+ "TAKE_UP_TIME": "资金占用时间",
202
+ "CAPTURE_PROFIT": "上市首日-约合年化收益",
203
+ "APPLY_SHARE_100": "每获配百股需配股数",
204
+ "AVERAGE_PRICE": "上市首日-均价",
205
+ "ORG_VAN": "参与申购人数",
206
+ "VA_AMT": "参与申购资金",
207
+ "ISSUE_PRICE_ADJFACTOR": "-",
191
208
  },
192
- inplace=True
209
+ inplace=True,
193
210
  )
194
- big_df['最新价格-累计涨幅'] = big_df['首日收盘价'] / big_df['最新价格-价格']
211
+ big_df["最新价格-累计涨幅"] = big_df["首日收盘价"] / big_df["最新价格-价格"]
195
212
 
196
213
  big_df = big_df[
197
214
  [
@@ -205,39 +222,61 @@ def stock_xgsglb_em(symbol: str = "全部股票") -> pd.DataFrame:
205
222
  "发行价格",
206
223
  "申购日",
207
224
  "中签率",
208
- '稳获百股需配资金',
209
- '最新价格-价格',
210
- '最新价格-累计涨幅',
211
- '上市首日-上市日',
212
- '上市首日-均价',
213
- '上市首日-涨幅',
214
- '上市首日-每百股获利',
215
- '上市首日-约合年化收益',
216
- '发行市盈率',
217
- '行业市盈率',
225
+ "稳获百股需配资金",
226
+ "最新价格-价格",
227
+ "最新价格-累计涨幅",
228
+ "上市首日-上市日",
229
+ "上市首日-均价",
230
+ "上市首日-涨幅",
231
+ "上市首日-每百股获利",
232
+ "上市首日-约合年化收益",
233
+ "发行市盈率",
234
+ "行业市盈率",
218
235
  "参与申购资金",
219
236
  "参与申购人数",
220
237
  ]
221
238
  ]
222
239
  big_df["发行总数"] = pd.to_numeric(big_df["发行总数"], errors="coerce")
223
- big_df["网上-发行数量"] = pd.to_numeric(big_df["网上-发行数量"], errors="coerce")
224
- big_df["网上-申购上限"] = pd.to_numeric(big_df["网上-申购上限"], errors="coerce")
225
- big_df["网上-顶格所需资金"] = pd.to_numeric(big_df["网上-顶格所需资金"], errors="coerce")
240
+ big_df["网上-发行数量"] = pd.to_numeric(
241
+ big_df["网上-发行数量"], errors="coerce"
242
+ )
243
+ big_df["网上-申购上限"] = pd.to_numeric(
244
+ big_df["网上-申购上限"], errors="coerce"
245
+ )
246
+ big_df["网上-顶格所需资金"] = pd.to_numeric(
247
+ big_df["网上-顶格所需资金"], errors="coerce"
248
+ )
226
249
  big_df["发行价格"] = pd.to_numeric(big_df["发行价格"], errors="coerce")
227
250
  big_df["中签率"] = pd.to_numeric(big_df["中签率"], errors="coerce")
228
- big_df["稳获百股需配资金"] = pd.to_numeric(big_df["稳获百股需配资金"], errors="coerce")
229
- big_df["最新价格-价格"] = pd.to_numeric(big_df["最新价格-价格"], errors="coerce")
230
- big_df["最新价格-累计涨幅"] = pd.to_numeric(big_df["最新价格-累计涨幅"], errors="coerce")
231
- big_df["上市首日-均价"] = pd.to_numeric(big_df["上市首日-均价"], errors="coerce")
232
- big_df["上市首日-涨幅"] = pd.to_numeric(big_df["上市首日-涨幅"], errors="coerce")
233
- big_df["上市首日-每百股获利"] = pd.to_numeric(big_df["上市首日-每百股获利"], errors="coerce")
234
- big_df["上市首日-约合年化收益"] = pd.to_numeric(big_df["上市首日-约合年化收益"], errors="coerce")
251
+ big_df["稳获百股需配资金"] = pd.to_numeric(
252
+ big_df["稳获百股需配资金"], errors="coerce"
253
+ )
254
+ big_df["最新价格-价格"] = pd.to_numeric(
255
+ big_df["最新价格-价格"], errors="coerce"
256
+ )
257
+ big_df["最新价格-累计涨幅"] = pd.to_numeric(
258
+ big_df["最新价格-累计涨幅"], errors="coerce"
259
+ )
260
+ big_df["上市首日-均价"] = pd.to_numeric(
261
+ big_df["上市首日-均价"], errors="coerce"
262
+ )
263
+ big_df["上市首日-涨幅"] = pd.to_numeric(
264
+ big_df["上市首日-涨幅"], errors="coerce"
265
+ )
266
+ big_df["上市首日-每百股获利"] = pd.to_numeric(
267
+ big_df["上市首日-每百股获利"], errors="coerce"
268
+ )
269
+ big_df["上市首日-约合年化收益"] = pd.to_numeric(
270
+ big_df["上市首日-约合年化收益"], errors="coerce"
271
+ )
235
272
  big_df["发行市盈率"] = pd.to_numeric(big_df["发行市盈率"], errors="coerce")
236
273
  big_df["行业市盈率"] = pd.to_numeric(big_df["行业市盈率"], errors="coerce")
237
274
  big_df["参与申购资金"] = pd.to_numeric(big_df["参与申购资金"], errors="coerce")
238
275
  big_df["参与申购人数"] = pd.to_numeric(big_df["参与申购人数"], errors="coerce")
239
276
  big_df["申购日"] = pd.to_datetime(big_df["申购日"], errors="coerce").dt.date
240
- big_df["上市首日-上市日"] = pd.to_datetime(big_df["上市首日-上市日"], errors="coerce").dt.date
277
+ big_df["上市首日-上市日"] = pd.to_datetime(
278
+ big_df["上市首日-上市日"], errors="coerce"
279
+ ).dt.date
241
280
  return big_df
242
281
  else:
243
282
  params = {
@@ -347,7 +386,9 @@ def stock_xgsglb_em(symbol: str = "全部股票") -> pd.DataFrame:
347
386
  big_df["中签缴款日期"] = pd.to_datetime(big_df["中签缴款日期"]).dt.date
348
387
  big_df["发行总数"] = pd.to_numeric(big_df["发行总数"], errors="coerce")
349
388
  big_df["网上发行"] = pd.to_numeric(big_df["网上发行"], errors="coerce")
350
- big_df["顶格申购需配市值"] = pd.to_numeric(big_df["顶格申购需配市值"], errors="coerce")
389
+ big_df["顶格申购需配市值"] = pd.to_numeric(
390
+ big_df["顶格申购需配市值"], errors="coerce"
391
+ )
351
392
  big_df["申购上限"] = pd.to_numeric(big_df["申购上限"], errors="coerce")
352
393
  big_df["发行价格"] = pd.to_numeric(big_df["发行价格"], errors="coerce")
353
394
  big_df["最新价"] = pd.to_numeric(big_df["最新价"], errors="coerce")
@@ -355,8 +396,12 @@ def stock_xgsglb_em(symbol: str = "全部股票") -> pd.DataFrame:
355
396
  big_df["发行市盈率"] = pd.to_numeric(big_df["发行市盈率"], errors="coerce")
356
397
  big_df["行业市盈率"] = pd.to_numeric(big_df["行业市盈率"], errors="coerce")
357
398
  big_df["中签率"] = pd.to_numeric(big_df["中签率"], errors="coerce")
358
- big_df["询价累计报价倍数"] = pd.to_numeric(big_df["询价累计报价倍数"], errors="coerce")
359
- big_df["配售对象报价家数"] = pd.to_numeric(big_df["配售对象报价家数"], errors="coerce")
399
+ big_df["询价累计报价倍数"] = pd.to_numeric(
400
+ big_df["询价累计报价倍数"], errors="coerce"
401
+ )
402
+ big_df["配售对象报价家数"] = pd.to_numeric(
403
+ big_df["配售对象报价家数"], errors="coerce"
404
+ )
360
405
  big_df["涨幅"] = pd.to_numeric(big_df["涨幅"], errors="coerce")
361
406
  big_df["每中一签获利"] = pd.to_numeric(big_df["每中一签获利"], errors="coerce")
362
407
  return big_df
@@ -5,6 +5,7 @@ Date: 2023/1/28 11:03
5
5
  Desc: 东方财富网-数据中心-特色数据-高管持股
6
6
  https://data.eastmoney.com/executive/gdzjc.html
7
7
  """
8
+
8
9
  from tqdm import tqdm
9
10
 
10
11
  import pandas as pd
@@ -105,12 +106,22 @@ def stock_ggcg_em(symbol: str = "全部") -> pd.DataFrame:
105
106
  big_df["最新价"] = pd.to_numeric(big_df["最新价"], errors="coerce")
106
107
  big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce")
107
108
  big_df["持股变动信息-变动数量"] = pd.to_numeric(big_df["持股变动信息-变动数量"])
108
- big_df["持股变动信息-占总股本比例"] = pd.to_numeric(big_df["持股变动信息-占总股本比例"])
109
- big_df["持股变动信息-占流通股比例"] = pd.to_numeric(big_df["持股变动信息-占流通股比例"])
109
+ big_df["持股变动信息-占总股本比例"] = pd.to_numeric(
110
+ big_df["持股变动信息-占总股本比例"]
111
+ )
112
+ big_df["持股变动信息-占流通股比例"] = pd.to_numeric(
113
+ big_df["持股变动信息-占流通股比例"]
114
+ )
110
115
  big_df["变动后持股情况-持股总数"] = pd.to_numeric(big_df["变动后持股情况-持股总数"])
111
- big_df["变动后持股情况-占总股本比例"] = pd.to_numeric(big_df["变动后持股情况-占总股本比例"])
112
- big_df["变动后持股情况-持流通股数"] = pd.to_numeric(big_df["变动后持股情况-持流通股数"])
113
- big_df["变动后持股情况-占流通股比例"] = pd.to_numeric(big_df["变动后持股情况-占流通股比例"])
116
+ big_df["变动后持股情况-占总股本比例"] = pd.to_numeric(
117
+ big_df["变动后持股情况-占总股本比例"]
118
+ )
119
+ big_df["变动后持股情况-持流通股数"] = pd.to_numeric(
120
+ big_df["变动后持股情况-持流通股数"]
121
+ )
122
+ big_df["变动后持股情况-占流通股比例"] = pd.to_numeric(
123
+ big_df["变动后持股情况-占流通股比例"]
124
+ )
114
125
  big_df["变动开始日"] = pd.to_datetime(big_df["变动开始日"]).dt.date
115
126
  big_df["变动截止日"] = pd.to_datetime(big_df["变动截止日"]).dt.date
116
127
  big_df["公告日"] = pd.to_datetime(big_df["公告日"]).dt.date