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.

Files changed (236) hide show
  1. akshare/__init__.py +441 -138
  2. akshare/air/air_hebei.py +79 -53
  3. akshare/air/air_zhenqi.py +29 -43
  4. akshare/air/sunrise_tad.py +32 -17
  5. akshare/bank/bank_cbirc_2020.py +12 -9
  6. akshare/bond/bond_cb_ths.py +17 -9
  7. akshare/bond/bond_china.py +38 -39
  8. akshare/bond/bond_china_money.py +75 -48
  9. akshare/bond/bond_info_cm.py +28 -8
  10. akshare/bond/bond_issue_cninfo.py +73 -30
  11. akshare/bond/bond_zh_cov.py +1 -1
  12. akshare/bond/bond_zh_sina.py +57 -51
  13. akshare/cal/__init__.py +0 -0
  14. akshare/cal/rv.py +170 -0
  15. akshare/cost/cost_living.py +7 -5
  16. akshare/currency/currency_safe.py +7 -6
  17. akshare/data/cninfo.js +15 -0
  18. akshare/datasets.py +10 -21
  19. akshare/economic/macro_bank.py +95 -653
  20. akshare/economic/macro_china.py +772 -1024
  21. akshare/economic/macro_china_hk.py +65 -243
  22. akshare/economic/macro_china_nbs.py +24 -7
  23. akshare/economic/macro_constitute.py +17 -12
  24. akshare/economic/macro_euro.py +13 -6
  25. akshare/economic/macro_finance_ths.py +133 -0
  26. akshare/economic/macro_info_ws.py +100 -0
  27. akshare/economic/macro_japan.py +5 -4
  28. akshare/economic/macro_other.py +12 -9
  29. akshare/economic/macro_usa.py +376 -1940
  30. akshare/economic/marco_cnbs.py +11 -6
  31. akshare/energy/energy_carbon.py +94 -125
  32. akshare/event/migration.py +3 -2
  33. akshare/exceptions.py +43 -0
  34. akshare/file_fold/calendar.json +245 -2
  35. akshare/fortune/fortune_500.py +15 -48
  36. akshare/fund/fund_amac.py +157 -75
  37. akshare/fund/fund_em.py +191 -184
  38. akshare/fund/fund_etf_em.py +16 -15
  39. akshare/fund/fund_etf_sina.py +71 -23
  40. akshare/fund/fund_etf_ths.py +93 -0
  41. akshare/fund/fund_fee_em.py +98 -0
  42. akshare/fund/fund_portfolio_em.py +60 -50
  43. akshare/fund/fund_rank_em.py +91 -82
  44. akshare/fund/fund_report_cninfo.py +63 -48
  45. akshare/fund/fund_scale_sina.py +20 -10
  46. akshare/fund/fund_xq.py +139 -109
  47. akshare/futures/cons.py +8 -31
  48. akshare/futures/cot.py +185 -137
  49. akshare/futures/futures_basis.py +97 -32
  50. akshare/futures/futures_comm_ctp.py +37 -0
  51. akshare/futures/futures_comm_qihuo.py +74 -45
  52. akshare/futures/futures_daily_bar.py +121 -184
  53. akshare/futures/futures_hf_em.py +66 -61
  54. akshare/futures/futures_hq_sina.py +79 -61
  55. akshare/futures/futures_index_ccidx.py +6 -3
  56. akshare/futures/futures_inventory_99.py +61 -272
  57. akshare/futures/futures_news_shmet.py +4 -2
  58. akshare/futures/futures_roll_yield.py +12 -25
  59. akshare/futures/futures_spot_stock_em.py +19 -13
  60. akshare/futures/futures_stock_js.py +14 -12
  61. akshare/futures/futures_to_spot.py +38 -33
  62. akshare/futures/futures_warehouse_receipt.py +75 -71
  63. akshare/futures/futures_zh_sina.py +5 -5
  64. akshare/futures/symbol_var.py +18 -13
  65. akshare/futures_derivative/futures_contract_info_czce.py +60 -52
  66. akshare/futures_derivative/futures_contract_info_ine.py +43 -34
  67. akshare/futures_derivative/futures_contract_info_shfe.py +46 -35
  68. akshare/futures_derivative/futures_cot_sina.py +26 -19
  69. akshare/futures_derivative/futures_spot_sys.py +21 -8
  70. akshare/fx/currency_investing.py +19 -285
  71. akshare/index/index_cflp.py +29 -26
  72. akshare/index/index_cni.py +86 -88
  73. akshare/index/index_cons.py +26 -10
  74. akshare/index/index_cx.py +248 -47
  75. akshare/index/index_drewry.py +17 -16
  76. akshare/index/index_option_qvix.py +329 -0
  77. akshare/index/index_research_fund_sw.py +134 -0
  78. akshare/index/{index_sw_research.py → index_research_sw.py} +122 -58
  79. akshare/index/index_spot.py +9 -5
  80. akshare/index/index_stock_hk.py +35 -16
  81. akshare/index/index_stock_us_sina.py +1 -1
  82. akshare/index/index_stock_zh.py +180 -89
  83. akshare/index/index_stock_zh_csindex.py +15 -369
  84. akshare/index/index_sw.py +62 -34
  85. akshare/index/index_yw.py +46 -23
  86. akshare/index/index_zh_a_scope.py +48 -0
  87. akshare/index/index_zh_em.py +6 -4
  88. akshare/interest_rate/interbank_rate_em.py +14 -9
  89. akshare/movie/artist_yien.py +32 -5
  90. akshare/movie/movie_yien.py +92 -18
  91. akshare/movie/video_yien.py +28 -5
  92. akshare/news/news_baidu.py +78 -44
  93. akshare/news/news_cctv.py +38 -38
  94. akshare/news/news_stock.py +6 -3
  95. akshare/nlp/nlp_interface.py +7 -8
  96. akshare/option/cons.py +11 -11
  97. akshare/option/option_comm_qihuo.py +86 -0
  98. akshare/option/option_commodity.py +178 -51
  99. akshare/option/option_daily_stats_sse_szse.py +146 -0
  100. akshare/option/option_em.py +147 -138
  101. akshare/option/option_finance_sina.py +160 -137
  102. akshare/option/option_lhb_em.py +62 -56
  103. akshare/option/option_risk_indicator_sse.py +17 -14
  104. akshare/other/other_car_cpca.py +934 -0
  105. akshare/other/{other_car.py → other_car_gasgoo.py} +15 -54
  106. akshare/qdii/__init__.py +0 -0
  107. akshare/qdii/qdii_jsl.py +233 -0
  108. akshare/request.py +117 -0
  109. akshare/spot/spot_hog_soozhu.py +232 -0
  110. akshare/spot/spot_price_qh.py +121 -0
  111. akshare/spot/spot_sge.py +63 -10
  112. akshare/stock/stock_allotment_cninfo.py +10 -9
  113. akshare/stock/stock_board_concept_em.py +23 -14
  114. akshare/stock/stock_board_industry_em.py +40 -34
  115. akshare/stock/stock_cg_equity_mortgage.py +15 -11
  116. akshare/stock/stock_cg_guarantee.py +41 -51
  117. akshare/stock/stock_cg_lawsuit.py +36 -35
  118. akshare/stock/stock_dividend_cninfo.py +12 -6
  119. akshare/stock/stock_dzjy_em.py +347 -260
  120. akshare/stock/stock_fund_em.py +332 -84
  121. akshare/stock/stock_hk_famous.py +108 -0
  122. akshare/stock/stock_hk_sina.py +8 -7
  123. akshare/stock/stock_hold_control_cninfo.py +100 -15
  124. akshare/stock/stock_hold_control_em.py +4 -3
  125. akshare/stock/stock_hold_num_cninfo.py +18 -12
  126. akshare/stock/stock_hot_rank_em.py +2 -1
  127. akshare/stock/stock_hot_search_baidu.py +5 -2
  128. akshare/stock/stock_industry_cninfo.py +24 -18
  129. akshare/stock/stock_industry_pe_cninfo.py +45 -31
  130. akshare/stock/stock_industry_sw.py +9 -10
  131. akshare/stock/stock_info.py +25 -15
  132. akshare/stock/stock_info_em.py +5 -2
  133. akshare/stock/stock_intraday_em.py +5 -2
  134. akshare/stock/stock_intraday_sina.py +22 -18
  135. akshare/stock/stock_ipo_summary_cninfo.py +25 -10
  136. akshare/stock/stock_new_cninfo.py +32 -19
  137. akshare/stock/stock_news_cx.py +39 -0
  138. akshare/stock/stock_profile_cninfo.py +9 -8
  139. akshare/stock/stock_rank_forecast.py +8 -6
  140. akshare/stock/stock_share_changes_cninfo.py +18 -14
  141. akshare/stock/stock_share_hold.py +24 -19
  142. akshare/stock/stock_summary.py +54 -26
  143. akshare/stock/stock_us_famous.py +15 -6
  144. akshare/stock/stock_us_pink.py +7 -5
  145. akshare/stock/stock_us_sina.py +15 -12
  146. akshare/stock/stock_xq.py +38 -12
  147. akshare/stock/stock_zh_a_sina.py +53 -78
  148. akshare/stock/stock_zh_b_sina.py +32 -55
  149. akshare/stock/stock_zh_kcb_report.py +11 -9
  150. akshare/stock/stock_zh_kcb_sina.py +67 -64
  151. akshare/stock_feature/stock_a_below_net_asset_statistics.py +5 -2
  152. akshare/stock_feature/stock_a_high_low.py +5 -2
  153. akshare/stock_feature/stock_a_indicator.py +12 -9
  154. akshare/stock_feature/stock_a_pe_and_pb.py +27 -6
  155. akshare/stock_feature/stock_account_em.py +58 -40
  156. akshare/stock_feature/stock_analyst_em.py +36 -27
  157. akshare/stock_feature/stock_board_industry_ths.py +136 -400
  158. akshare/stock_feature/stock_comment_em.py +118 -85
  159. akshare/stock_feature/stock_concept_futu.py +183 -0
  160. akshare/stock_feature/stock_cyq_em.py +58 -54
  161. akshare/stock_feature/stock_disclosure_cninfo.py +147 -102
  162. akshare/stock_feature/stock_esg_sina.py +216 -11
  163. akshare/stock_feature/stock_fhps_em.py +60 -25
  164. akshare/stock_feature/stock_fhps_ths.py +25 -6
  165. akshare/stock_feature/stock_fund_flow.py +38 -25
  166. akshare/stock_feature/stock_gdfx_em.py +180 -95
  167. akshare/stock_feature/stock_gdhs.py +73 -49
  168. akshare/stock_feature/stock_gpzy_em.py +78 -46
  169. akshare/stock_feature/stock_hist_em.py +55 -23
  170. akshare/stock_feature/stock_hk_valuation_baidu.py +20 -8
  171. akshare/stock_feature/stock_hsgt_em.py +184 -452
  172. akshare/stock_feature/stock_info.py +52 -29
  173. akshare/stock_feature/stock_inner_trade_xq.py +39 -31
  174. akshare/stock_feature/stock_irm_cninfo.py +32 -9
  175. akshare/stock_feature/stock_jgdy_em.py +41 -38
  176. akshare/stock_feature/stock_lh_yybpm.py +36 -37
  177. akshare/stock_feature/stock_lhb_em.py +135 -71
  178. akshare/stock_feature/stock_lhb_sina.py +93 -46
  179. akshare/stock_feature/stock_margin_em.py +102 -0
  180. akshare/stock_feature/{stock_sse_margin.py → stock_margin_sse.py} +21 -15
  181. akshare/stock_feature/{stock_szse_margin.py → stock_margin_szse.py} +23 -19
  182. akshare/stock_feature/stock_market_legu.py +13 -8
  183. akshare/stock_feature/stock_pankou_em.py +72 -34
  184. akshare/stock_feature/stock_report_em.py +244 -54
  185. akshare/stock_feature/stock_research_report_em.py +48 -19
  186. akshare/stock_feature/stock_sns_sseinfo.py +15 -12
  187. akshare/stock_feature/stock_sy_em.py +86 -33
  188. akshare/stock_feature/stock_technology_ths.py +152 -120
  189. akshare/stock_feature/stock_tfp_em.py +35 -13
  190. akshare/stock_feature/stock_three_report_em.py +119 -77
  191. akshare/stock_feature/stock_ttm_lyr.py +4 -7
  192. akshare/stock_feature/stock_value_em.py +83 -0
  193. akshare/stock_feature/stock_wencai.py +21 -9
  194. akshare/stock_feature/stock_yjyg_em.py +63 -28
  195. akshare/stock_feature/stock_zf_pg.py +61 -38
  196. akshare/stock_feature/stock_zh_valuation_baidu.py +3 -2
  197. akshare/stock_feature/stock_ztb_em.py +62 -40
  198. akshare/stock_fundamental/stock_finance.py +150 -58
  199. akshare/stock_fundamental/stock_finance_ths.py +116 -31
  200. akshare/stock_fundamental/stock_mda_ym.py +5 -3
  201. akshare/stock_fundamental/stock_notice.py +29 -15
  202. akshare/stock_fundamental/stock_profit_forecast_em.py +31 -13
  203. akshare/stock_fundamental/stock_profit_forecast_ths.py +19 -10
  204. akshare/stock_fundamental/stock_register_em.py +448 -0
  205. akshare/stock_fundamental/stock_restricted_em.py +79 -32
  206. akshare/stock_fundamental/stock_zygc.py +10 -8
  207. akshare/stock_fundamental/stock_zyjs_ths.py +5 -3
  208. akshare/tool/trade_date_hist.py +4 -3
  209. akshare/utils/cons.py +10 -0
  210. akshare/utils/context.py +43 -0
  211. akshare/utils/demjson.py +2 -2
  212. akshare/utils/func.py +26 -0
  213. akshare/utils/tqdm.py +13 -3
  214. {akshare-1.12.99.dist-info → akshare-1.15.72.dist-info}/METADATA +52 -69
  215. akshare-1.15.72.dist-info/RECORD +385 -0
  216. {akshare-1.12.99.dist-info → akshare-1.15.72.dist-info}/WHEEL +1 -1
  217. tests/test_func.py +3 -5
  218. akshare/bond/bond_futures.py +0 -50
  219. akshare/bond/bond_investing.py +0 -139
  220. akshare/crypto/crypto_hist_investing.py +0 -249
  221. akshare/fortune/fortune_it_juzi.py +0 -123
  222. akshare/futures/futures_international.py +0 -170
  223. akshare/futures/futures_news_baidu.py +0 -54
  224. akshare/futures/inventory_data.py +0 -100
  225. akshare/futures_derivative/futures_index_price_nh.py +0 -61
  226. akshare/futures_derivative/futures_index_return_nh.py +0 -47
  227. akshare/futures_derivative/futures_index_volatility_nh.py +0 -51
  228. akshare/futures_derivative/futures_other_index_nh.py +0 -145
  229. akshare/index/index_fear_greed_funddb.py +0 -71
  230. akshare/index/index_investing.py +0 -232
  231. akshare/sport/sport_olympic_winter.py +0 -39
  232. akshare/stock_feature/stock_board_concept_ths.py +0 -422
  233. akshare/stock_fundamental/stock_register.py +0 -292
  234. akshare-1.12.99.dist-info/RECORD +0 -374
  235. {akshare-1.12.99.dist-info → akshare-1.15.72.dist-info}/LICENSE +0 -0
  236. {akshare-1.12.99.dist-info → akshare-1.15.72.dist-info}/top_level.txt +0 -0
akshare/index/index_yw.py CHANGED
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/6/12 14:17
4
+ Date: 2024/4/17 19:17
5
5
  Desc: 义乌小商品指数
6
6
  https://www.ywindex.com/Home/Product/index/
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
  from bs4 import BeautifulSoup
@@ -19,14 +20,18 @@ def index_yw(symbol: str = "月景气指数") -> pd.DataFrame:
19
20
  :return: 指数结果
20
21
  :rtype: pandas.DataFrame
21
22
  """
23
+ import urllib3
24
+
25
+ # 禁用InsecureRequestWarning
26
+ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
22
27
  name_num_dict = {
23
28
  "周价格指数": 1,
24
29
  "月价格指数": 3,
25
30
  "月景气指数": 5,
26
31
  }
27
- url = "http://www.ywindex.com/Home/Product/index/"
32
+ url = "https://www.ywindex.com/Home/Product/index/"
28
33
  res = requests.get(url, verify=False)
29
- soup = BeautifulSoup(res.text, "lxml")
34
+ soup = BeautifulSoup(res.text, features="lxml")
30
35
  table_name = (
31
36
  soup.find_all(attrs={"class": "tablex"})[name_num_dict[symbol]]
32
37
  .get_text()
@@ -44,38 +49,56 @@ def index_yw(symbol: str = "月景气指数") -> pd.DataFrame:
44
49
  :, :5
45
50
  ]
46
51
  table_df.columns = ["期数", "景气指数", "规模指数", "效益指数", "市场信心指数"]
47
- table_df["期数"] = pd.to_datetime(table_df["期数"]).dt.date
48
- table_df["景气指数"] = pd.to_numeric(table_df["景气指数"])
49
- table_df["规模指数"] = pd.to_numeric(table_df["规模指数"])
50
- table_df["效益指数"] = pd.to_numeric(table_df["效益指数"])
51
- table_df["市场信心指数"] = pd.to_numeric(table_df["市场信心指数"])
52
- table_df.sort_values(['期数'], inplace=True, ignore_index=True)
52
+ table_df["期数"] = pd.to_datetime(table_df["期数"], errors="coerce").dt.date
53
+ table_df["景气指数"] = pd.to_numeric(table_df["景气指数"], errors="coerce")
54
+ table_df["规模指数"] = pd.to_numeric(table_df["规模指数"], errors="coerce")
55
+ table_df["效益指数"] = pd.to_numeric(table_df["效益指数"], errors="coerce")
56
+ table_df["市场信心指数"] = pd.to_numeric(
57
+ table_df["市场信心指数"], errors="coerce"
58
+ )
59
+ table_df.sort_values(["期数"], inplace=True, ignore_index=True)
53
60
  return table_df
54
61
  elif symbol == "周价格指数":
55
62
  table_df = pd.DataFrame([item.split("\n") for item in table_content]).iloc[
56
63
  :, :6
57
64
  ]
58
65
  table_df.columns = table_name
59
- table_df["期数"] = pd.to_datetime(table_df["期数"]).dt.date
60
- table_df["价格指数"] = pd.to_numeric(table_df["价格指数"])
61
- table_df["场内价格指数"] = pd.to_numeric(table_df["场内价格指数"])
62
- table_df["网上价格指数"] = pd.to_numeric(table_df["网上价格指数"])
63
- table_df["订单价格指数"] = pd.to_numeric(table_df["订单价格指数"])
64
- table_df["出口价格指数"] = pd.to_numeric(table_df["出口价格指数"])
65
- table_df.sort_values(['期数'], inplace=True, ignore_index=True)
66
+ table_df["期数"] = pd.to_datetime(table_df["期数"], errors="coerce").dt.date
67
+ table_df["价格指数"] = pd.to_numeric(table_df["价格指数"], errors="coerce")
68
+ table_df["场内价格指数"] = pd.to_numeric(
69
+ table_df["场内价格指数"], errors="coerce"
70
+ )
71
+ table_df["网上价格指数"] = pd.to_numeric(
72
+ table_df["网上价格指数"], errors="coerce"
73
+ )
74
+ table_df["订单价格指数"] = pd.to_numeric(
75
+ table_df["订单价格指数"], errors="coerce"
76
+ )
77
+ table_df["出口价格指数"] = pd.to_numeric(
78
+ table_df["出口价格指数"], errors="coerce"
79
+ )
80
+ table_df.sort_values(["期数"], inplace=True, ignore_index=True)
66
81
  return table_df
67
82
  elif symbol == "月价格指数":
68
83
  table_df = pd.DataFrame([item.split("\n") for item in table_content]).iloc[
69
84
  :, :6
70
85
  ]
71
86
  table_df.columns = table_name
72
- table_df["期数"] = pd.to_datetime(table_df["期数"]).dt.date
73
- table_df["价格指数"] = pd.to_numeric(table_df["价格指数"])
74
- table_df["场内价格指数"] = pd.to_numeric(table_df["场内价格指数"])
75
- table_df["网上价格指数"] = pd.to_numeric(table_df["网上价格指数"])
76
- table_df["订单价格指数"] = pd.to_numeric(table_df["订单价格指数"])
77
- table_df["出口价格指数"] = pd.to_numeric(table_df["出口价格指数"])
78
- table_df.sort_values(['期数'], inplace=True, ignore_index=True)
87
+ table_df["期数"] = pd.to_datetime(table_df["期数"], errors="coerce").dt.date
88
+ table_df["价格指数"] = pd.to_numeric(table_df["价格指数"], errors="coerce")
89
+ table_df["场内价格指数"] = pd.to_numeric(
90
+ table_df["场内价格指数"], errors="coerce"
91
+ )
92
+ table_df["网上价格指数"] = pd.to_numeric(
93
+ table_df["网上价格指数"], errors="coerce"
94
+ )
95
+ table_df["订单价格指数"] = pd.to_numeric(
96
+ table_df["订单价格指数"], errors="coerce"
97
+ )
98
+ table_df["出口价格指数"] = pd.to_numeric(
99
+ table_df["出口价格指数"], errors="coerce"
100
+ )
101
+ table_df.sort_values(["期数"], inplace=True, ignore_index=True)
79
102
  return table_df
80
103
 
81
104
 
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding:utf-8 -*-
3
+ """
4
+ Date: 2024/4/17 19:00
5
+ Desc: 数库-A股新闻情绪指数
6
+ https://www.chinascope.com/reasearch.html
7
+ """
8
+
9
+ import pandas as pd
10
+ import requests
11
+
12
+
13
+ def index_news_sentiment_scope() -> pd.DataFrame:
14
+ """
15
+ 数库-A股新闻情绪指数
16
+ https://www.chinascope.com/reasearch.html
17
+ :return: A股新闻情绪指数
18
+ :rtype: pandas.DataFrame
19
+ """
20
+ url = "https://www.chinascope.com/inews/senti/index"
21
+ params = {"period": "YEAR"}
22
+ r = requests.get(url=url, params=params)
23
+ data_json = r.json()
24
+ temp_df = pd.DataFrame(data_json)
25
+ temp_df.rename(
26
+ columns={
27
+ "tradeDate": "日期",
28
+ "maIndex1": "市场情绪指数",
29
+ "marketClose": "沪深300指数",
30
+ },
31
+ inplace=True,
32
+ )
33
+ temp_df = temp_df[
34
+ [
35
+ "日期",
36
+ "市场情绪指数",
37
+ "沪深300指数",
38
+ ]
39
+ ]
40
+ temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
41
+ temp_df["市场情绪指数"] = pd.to_numeric(temp_df["市场情绪指数"], errors="coerce")
42
+ temp_df["沪深300指数"] = pd.to_numeric(temp_df["沪深300指数"], errors="coerce")
43
+ return temp_df
44
+
45
+
46
+ if __name__ == "__main__":
47
+ index_news_sentiment_scope_df = index_news_sentiment_scope()
48
+ print(index_news_sentiment_scope_df)
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/12/11 20:20
4
+ Date: 2025/1/10 18:10
5
5
  Desc: 东方财富网-指数行情数据
6
6
  """
7
7
 
@@ -85,6 +85,8 @@ def index_code_id_map_em() -> dict:
85
85
  key: value - 1 if value == 1 else value + 1
86
86
  for key, value in code_id_dict.items()
87
87
  }
88
+ # 单独增加品种
89
+ code_id_dict.update({"932000": 2})
88
90
  return code_id_dict
89
91
 
90
92
 
@@ -438,9 +440,9 @@ if __name__ == "__main__":
438
440
  print(index_zh_a_hist_df)
439
441
 
440
442
  index_zh_a_hist_min_em_df = index_zh_a_hist_min_em(
441
- symbol="000001",
443
+ symbol="932000",
442
444
  period="1",
443
- start_date="2024-03-20 09:30:00",
444
- end_date="2024-03-20 19:00:00",
445
+ start_date="2025-01-10 09:30:00",
446
+ end_date="2025-01-10 19:00:00",
445
447
  )
446
448
  print(index_zh_a_hist_min_em_df)
@@ -1,12 +1,14 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2022/5/24 20:13
4
+ Date: 2024/5/11 22:00
5
5
  Desc: 东方财富网-经济数据-银行间拆借利率
6
+ https://data.eastmoney.com/shibor/shibor.aspx
6
7
  """
8
+
7
9
  import pandas as pd
8
10
  import requests
9
- from tqdm import tqdm
11
+ from akshare.utils.tqdm import get_tqdm
10
12
 
11
13
 
12
14
  def rate_interbank(
@@ -16,7 +18,7 @@ def rate_interbank(
16
18
  ):
17
19
  """
18
20
  东方财富-拆借利率一览-具体市场的具体品种的具体指标的拆借利率数据
19
- 具体 market 和 symbol 参见: http://data.eastmoney.com/shibor/shibor.aspx?m=sg&t=88&d=99333&cu=sgd&type=009065&p=79
21
+ 具体 market 和 symbol 参见: https://data.eastmoney.com/shibor/shibor.aspx?m=sg&t=88&d=99333&cu=sgd&type=009065&p=79
20
22
  :param market: choice of {"上海银行同业拆借市场", "中国银行同业拆借市场", "伦敦银行同业拆借市场", "欧洲银行同业拆借市场", "香港银行同业拆借市场", "新加坡银行同业拆借市场"}
21
23
  :type market: str
22
24
  :param symbol: choice of {"Shibor人民币", "Chibor人民币", "Libor英镑", "***", "Sibor美元"}
@@ -69,9 +71,11 @@ def rate_interbank(
69
71
  url = "https://datacenter-web.eastmoney.com/api/data/v1/get"
70
72
  params = {
71
73
  "reportName": "RPT_IMP_INTRESTRATEN",
72
- "columns": "REPORT_DATE,REPORT_PERIOD,IR_RATE,CHANGE_RATE,INDICATOR_ID,LATEST_RECORD,MARKET,MARKET_CODE,CURRENCY,CURRENCY_CODE",
74
+ "columns": "REPORT_DATE,REPORT_PERIOD,IR_RATE,CHANGE_RATE,INDICATOR_ID,"
75
+ "LATEST_RECORD,MARKET,MARKET_CODE,CURRENCY,CURRENCY_CODE",
73
76
  "quoteColumns": "",
74
- "filter": f"""(MARKET_CODE="{market_map[market]}")(CURRENCY_CODE="{symbol_map[symbol]}")(INDICATOR_ID="{indicator_map[indicator]}")""",
77
+ "filter": f"""(MARKET_CODE="{market_map[market]}")(CURRENCY_CODE="{symbol_map[symbol]}")
78
+ (INDICATOR_ID="{indicator_map[indicator]}")""",
75
79
  "pageNumber": "1",
76
80
  "pageSize": "500",
77
81
  "sortTypes": "-1",
@@ -87,6 +91,7 @@ def rate_interbank(
87
91
  data_json = r.json()
88
92
  total_page = data_json["result"]["pages"]
89
93
  big_df = pd.DataFrame()
94
+ tqdm = get_tqdm()
90
95
  for page in tqdm(range(1, total_page + 1), leave=False):
91
96
  params.update(
92
97
  {
@@ -99,7 +104,7 @@ def rate_interbank(
99
104
  r = requests.get(url, params=params)
100
105
  data_json = r.json()
101
106
  temp_df = pd.DataFrame(data_json["result"]["data"])
102
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
107
+ big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True)
103
108
  big_df.columns = [
104
109
  "报告日",
105
110
  "-",
@@ -119,9 +124,9 @@ def rate_interbank(
119
124
  "涨跌",
120
125
  ]
121
126
  ]
122
- big_df["报告日"] = pd.to_datetime(big_df["报告日"]).dt.date
123
- big_df["利率"] = pd.to_numeric(big_df["利率"])
124
- big_df["涨跌"] = pd.to_numeric(big_df["涨跌"])
127
+ big_df["报告日"] = pd.to_datetime(big_df["报告日"], errors="coerce").dt.date
128
+ big_df["利率"] = pd.to_numeric(big_df["利率"], errors="coerce")
129
+ big_df["涨跌"] = pd.to_numeric(big_df["涨跌"], errors="coerce")
125
130
  big_df.sort_values(["报告日"], inplace=True)
126
131
  big_df.reset_index(inplace=True, drop=True)
127
132
  return big_df
@@ -7,13 +7,14 @@ Desc: 艺恩-艺人
7
7
  艺人流量价值
8
8
  https://www.endata.com.cn/Marketing/Artist/business.html
9
9
  """
10
+
10
11
  import datetime
11
12
  import json
12
13
  import os
13
14
 
14
15
  import pandas as pd # type: ignore
15
16
  import requests
16
- from py_mini_racer import py_mini_racer # type: ignore
17
+ import py_mini_racer # type: ignore
17
18
 
18
19
 
19
20
  def _get_js_path(name: str = "", module_file: str = "") -> str:
@@ -80,8 +81,21 @@ def business_value_artist() -> pd.DataFrame:
80
81
  r.encoding = "utf8"
81
82
  data_json = json.loads(decrypt(r.text))
82
83
  temp_df = pd.DataFrame(data_json["Data"]["Table"])
83
- temp_df.columns = ["排名", "-", "艺人", "商业价值", "-", "专业热度", "关注热度", "预测热度", "美誉度", "-"]
84
- temp_df = temp_df[["排名", "艺人", "商业价值", "专业热度", "关注热度", "预测热度", "美誉度"]]
84
+ temp_df.columns = [
85
+ "排名",
86
+ "-",
87
+ "艺人",
88
+ "商业价值",
89
+ "-",
90
+ "专业热度",
91
+ "关注热度",
92
+ "预测热度",
93
+ "美誉度",
94
+ "-",
95
+ ]
96
+ temp_df = temp_df[
97
+ ["排名", "艺人", "商业价值", "专业热度", "关注热度", "预测热度", "美誉度"]
98
+ ]
85
99
  temp_df["统计日期"] = datetime.datetime.now().date().isoformat()
86
100
  return temp_df
87
101
 
@@ -105,8 +119,21 @@ def online_value_artist() -> pd.DataFrame:
105
119
  r.encoding = "utf8"
106
120
  data_json = json.loads(decrypt(r.text))
107
121
  temp_df = pd.DataFrame(data_json["Data"]["Table"])
108
- temp_df.columns = ["排名", "-", "艺人", "-", "流量价值", "专业热度", "关注热度", "预测热度", "-", "带货力"]
109
- temp_df = temp_df[["排名", "艺人", "流量价值", "专业热度", "关注热度", "预测热度", "带货力"]]
122
+ temp_df.columns = [
123
+ "排名",
124
+ "-",
125
+ "艺人",
126
+ "-",
127
+ "流量价值",
128
+ "专业热度",
129
+ "关注热度",
130
+ "预测热度",
131
+ "-",
132
+ "带货力",
133
+ ]
134
+ temp_df = temp_df[
135
+ ["排名", "艺人", "流量价值", "专业热度", "关注热度", "预测热度", "带货力"]
136
+ ]
110
137
  temp_df["统计日期"] = datetime.datetime.now().date().isoformat()
111
138
  return temp_df
112
139
 
@@ -5,13 +5,14 @@ Date: 2024/2/20 14:00
5
5
  Desc: 电影票房数据
6
6
  https://ys.endata.cn/BoxOffice/Movie
7
7
  """
8
+
8
9
  import datetime
9
10
  import json
10
11
  import os
11
12
 
12
13
  import pandas as pd
13
14
  import requests
14
- from py_mini_racer import py_mini_racer
15
+ import py_mini_racer
15
16
 
16
17
 
17
18
  def _get_js_path(name: str = "", module_file: str = "") -> str:
@@ -77,7 +78,7 @@ def decrypt(origin_data: str = "") -> str:
77
78
  def movie_boxoffice_realtime() -> pd.DataFrame:
78
79
  """
79
80
  电影票房-实时票房
80
- https://www.endata.com.cn/BoxOffice/BO/RealTime/reTimeBO.html
81
+ https://ys.endata.cn/BoxOffice/Movie
81
82
  :return: 实时票房数据
82
83
  :rtype: pandas.DataFrame
83
84
  """
@@ -93,8 +94,18 @@ def movie_boxoffice_realtime() -> pd.DataFrame:
93
94
  data_json = json.loads(decrypt(r.text))
94
95
  temp_df = pd.DataFrame(data_json["Data"]["Table1"])
95
96
  temp_df = temp_df.iloc[:, :7]
96
- temp_df.columns = ["排序", "_", "影片名称", "实时票房", "累计票房", "上映天数", "票房占比"]
97
- temp_df = temp_df[["排序", "影片名称", "实时票房", "票房占比", "上映天数", "累计票房"]]
97
+ temp_df.columns = [
98
+ "排序",
99
+ "_",
100
+ "影片名称",
101
+ "实时票房",
102
+ "累计票房",
103
+ "上映天数",
104
+ "票房占比",
105
+ ]
106
+ temp_df = temp_df[
107
+ ["排序", "影片名称", "实时票房", "票房占比", "上映天数", "累计票房"]
108
+ ]
98
109
  return temp_df
99
110
 
100
111
 
@@ -139,7 +150,17 @@ def movie_boxoffice_daily(date: str = "20240219") -> pd.DataFrame:
139
150
  "口碑指数",
140
151
  ]
141
152
  temp_df = temp_df[
142
- ["排序", "影片名称", "单日票房", "环比变化", "累计票房", "平均票价", "场均人次", "口碑指数", "上映天数"]
153
+ [
154
+ "排序",
155
+ "影片名称",
156
+ "单日票房",
157
+ "环比变化",
158
+ "累计票房",
159
+ "平均票价",
160
+ "场均人次",
161
+ "口碑指数",
162
+ "上映天数",
163
+ ]
143
164
  ]
144
165
  return temp_df
145
166
 
@@ -179,12 +200,22 @@ def movie_boxoffice_weekly(date: str = "20240218") -> pd.DataFrame:
179
200
  "口碑指数",
180
201
  ]
181
202
  temp_df = temp_df[
182
- ["排序", "影片名称", "排名变化", "单周票房", "环比变化", "累计票房", "平均票价", "场均人次", "口碑指数",
183
- "上映天数"]
203
+ [
204
+ "排序",
205
+ "影片名称",
206
+ "排名变化",
207
+ "单周票房",
208
+ "环比变化",
209
+ "累计票房",
210
+ "平均票价",
211
+ "场均人次",
212
+ "口碑指数",
213
+ "上映天数",
214
+ ]
184
215
  ]
185
- temp_df['单周票房'] = pd.to_numeric(temp_df['单周票房'], errors="coerce")
186
- temp_df['环比变化'] = pd.to_numeric(temp_df['环比变化'], errors="coerce")
187
- temp_df['累计票房'] = pd.to_numeric(temp_df['累计票房'], errors="coerce")
216
+ temp_df["单周票房"] = pd.to_numeric(temp_df["单周票房"], errors="coerce")
217
+ temp_df["环比变化"] = pd.to_numeric(temp_df["环比变化"], errors="coerce")
218
+ temp_df["累计票房"] = pd.to_numeric(temp_df["累计票房"], errors="coerce")
188
219
  return temp_df
189
220
 
190
221
 
@@ -220,9 +251,19 @@ def movie_boxoffice_monthly(date: str = "20240218") -> pd.DataFrame:
220
251
  "口碑指数",
221
252
  ]
222
253
  temp_df = temp_df[
223
- ["排序", "影片名称", "单月票房", "月度占比", "平均票价", "场均人次", "上映日期", "口碑指数", "月内天数"]
254
+ [
255
+ "排序",
256
+ "影片名称",
257
+ "单月票房",
258
+ "月度占比",
259
+ "平均票价",
260
+ "场均人次",
261
+ "上映日期",
262
+ "口碑指数",
263
+ "月内天数",
264
+ ]
224
265
  ]
225
- temp_df['上映日期'] = pd.to_datetime(temp_df['上映日期'], errors="coerce").dt.date
266
+ temp_df["上映日期"] = pd.to_datetime(temp_df["上映日期"], errors="coerce").dt.date
226
267
  return temp_df
227
268
 
228
269
 
@@ -258,8 +299,19 @@ def movie_boxoffice_yearly(date: str = "20240218") -> pd.DataFrame:
258
299
  "_",
259
300
  ]
260
301
  temp_df["排序"] = range(1, len(temp_df) + 1)
261
- temp_df = temp_df[["排序", "影片名称", "类型", "总票房", "平均票价", "场均人次", "国家及地区", "上映日期"]]
262
- temp_df['上映日期'] = pd.to_datetime(temp_df['上映日期'], errors="coerce").dt.date
302
+ temp_df = temp_df[
303
+ [
304
+ "排序",
305
+ "影片名称",
306
+ "类型",
307
+ "总票房",
308
+ "平均票价",
309
+ "场均人次",
310
+ "国家及地区",
311
+ "上映日期",
312
+ ]
313
+ ]
314
+ temp_df["上映日期"] = pd.to_datetime(temp_df["上映日期"], errors="coerce").dt.date
263
315
  return temp_df
264
316
 
265
317
 
@@ -298,9 +350,19 @@ def movie_boxoffice_yearly_first_week(date: str = "20201018") -> pd.DataFrame:
298
350
  ]
299
351
  temp_df["排序"] = range(1, len(temp_df) + 1)
300
352
  temp_df = temp_df[
301
- ["排序", "影片名称", "类型", "首周票房", "占总票房比重", "场均人次", "国家及地区", "上映日期", "首周天数"]
353
+ [
354
+ "排序",
355
+ "影片名称",
356
+ "类型",
357
+ "首周票房",
358
+ "占总票房比重",
359
+ "场均人次",
360
+ "国家及地区",
361
+ "上映日期",
362
+ "首周天数",
363
+ ]
302
364
  ]
303
- temp_df['上映日期'] = pd.to_datetime(temp_df['上映日期'], errors="coerce").dt.date
365
+ temp_df["上映日期"] = pd.to_datetime(temp_df["上映日期"], errors="coerce").dt.date
304
366
  return temp_df
305
367
 
306
368
 
@@ -336,7 +398,9 @@ def movie_boxoffice_cinema_daily(date: str = "20240219") -> pd.DataFrame:
336
398
  "场均人次",
337
399
  "上座率",
338
400
  ]
339
- temp_df = temp_df[["排序", "影院名称", "单日票房", "单日场次", "场均人次", "场均票价", "上座率"]]
401
+ temp_df = temp_df[
402
+ ["排序", "影院名称", "单日票房", "单日场次", "场均人次", "场均票价", "上座率"]
403
+ ]
340
404
  return temp_df
341
405
 
342
406
 
@@ -378,7 +442,17 @@ def movie_boxoffice_cinema_weekly(date: str = "20240219") -> pd.DataFrame:
378
442
  "单日单厅票房",
379
443
  "单日单厅场次",
380
444
  ]
381
- temp_df = temp_df[["排序", "影院名称", "当周票房", "单银幕票房", "场均人次", "单日单厅票房", "单日单厅场次"]]
445
+ temp_df = temp_df[
446
+ [
447
+ "排序",
448
+ "影院名称",
449
+ "当周票房",
450
+ "单银幕票房",
451
+ "场均人次",
452
+ "单日单厅票房",
453
+ "单日单厅场次",
454
+ ]
455
+ ]
382
456
  return temp_df
383
457
 
384
458
 
@@ -8,12 +8,13 @@ Desc: 艺恩
8
8
  综艺节目
9
9
  https://www.endata.com.cn/Video/index.html
10
10
  """
11
+
11
12
  import json
12
13
  import os
13
14
 
14
15
  import pandas as pd
15
16
  import requests
16
- from py_mini_racer import py_mini_racer
17
+ import py_mini_racer
17
18
 
18
19
 
19
20
  def _get_js_path(name: str = "", module_file: str = "") -> str:
@@ -75,8 +76,19 @@ def video_tv() -> pd.DataFrame:
75
76
  data_json = json.loads(decrypt(r.text))
76
77
  temp_df = pd.DataFrame(data_json["Data"]["Table"])
77
78
  report_date = data_json["Data"]["Table1"][0]["MaxDate"]
78
- temp_df.columns = ["排序", "名称", "类型", "播映指数", "用户热度", "媒体热度", "观看度", "好评度"]
79
- temp_df = temp_df[["排序", "名称", "类型", "播映指数", "媒体热度", "用户热度", "好评度", "观看度"]]
79
+ temp_df.columns = [
80
+ "排序",
81
+ "名称",
82
+ "类型",
83
+ "播映指数",
84
+ "用户热度",
85
+ "媒体热度",
86
+ "观看度",
87
+ "好评度",
88
+ ]
89
+ temp_df = temp_df[
90
+ ["排序", "名称", "类型", "播映指数", "媒体热度", "用户热度", "好评度", "观看度"]
91
+ ]
80
92
  temp_df["统计日期"] = report_date
81
93
  return temp_df
82
94
 
@@ -95,8 +107,19 @@ def video_variety_show() -> pd.DataFrame:
95
107
  data_json = json.loads(decrypt(r.text))
96
108
  temp_df = pd.DataFrame(data_json["Data"]["Table"])
97
109
  report_date = data_json["Data"]["Table1"][0]["MaxDate"]
98
- temp_df.columns = ["排序", "名称", "类型", "播映指数", "用户热度", "媒体热度", "观看度", "好评度"]
99
- temp_df = temp_df[["排序", "名称", "类型", "播映指数", "媒体热度", "用户热度", "好评度", "观看度"]]
110
+ temp_df.columns = [
111
+ "排序",
112
+ "名称",
113
+ "类型",
114
+ "播映指数",
115
+ "用户热度",
116
+ "媒体热度",
117
+ "观看度",
118
+ "好评度",
119
+ ]
120
+ temp_df = temp_df[
121
+ ["排序", "名称", "类型", "播映指数", "媒体热度", "用户热度", "好评度", "观看度"]
122
+ ]
100
123
  temp_df["统计日期"] = report_date
101
124
  return temp_df
102
125