akshare 1.12.99__py3-none-any.whl → 1.15.73__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of akshare might be problematic. Click here for more details.

Files changed (236) hide show
  1. akshare/__init__.py +442 -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.73.dist-info}/METADATA +52 -69
  215. akshare-1.15.73.dist-info/RECORD +385 -0
  216. {akshare-1.12.99.dist-info → akshare-1.15.73.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.73.dist-info}/LICENSE +0 -0
  236. {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,12 @@
1
1
  # -*- coding:utf-8 -*-
2
2
  # !/usr/bin/env python
3
3
  """
4
- Date: 2023/11/27 16:30
4
+ Date: 2024/9/3 16:30
5
5
  Desc: 主营构成
6
6
  https://emweb.securities.eastmoney.com/PC_HSF10/BusinessAnalysis/Index?type=web&code=SH688041#
7
- http://f10.emoney.cn/f10/zbyz/1000001
7
+ https://f10.emoney.cn/f10/zbyz/1000001
8
8
  """
9
+
9
10
  from io import StringIO
10
11
 
11
12
  import pandas as pd
@@ -16,7 +17,7 @@ from bs4 import BeautifulSoup
16
17
  def stock_zygc_ym(symbol: str = "000001") -> pd.DataFrame:
17
18
  """
18
19
  益盟-F10-主营构成
19
- http://f10.emoney.cn/f10/zbyz/1000001
20
+ https://f10.emoney.cn/f10/zbyz/1000001
20
21
  :param symbol: 股票代码
21
22
  :type symbol: str
22
23
  :return: 主营构成
@@ -24,12 +25,11 @@ def stock_zygc_ym(symbol: str = "000001") -> pd.DataFrame:
24
25
  """
25
26
  url = f"http://f10.emoney.cn/f10/zygc/{symbol}"
26
27
  r = requests.get(url)
27
- soup = BeautifulSoup(r.text, "lxml")
28
+ soup = BeautifulSoup(r.text, features="lxml")
28
29
  year_list = [
29
30
  item.text.strip()
30
31
  for item in soup.find(attrs={"class": "swlab_t"}).find_all("li")
31
32
  ]
32
-
33
33
  big_df = pd.DataFrame()
34
34
  for i, item in enumerate(year_list, 2):
35
35
  temp_df = pd.read_html(StringIO(r.text), header=0)[i]
@@ -113,8 +113,10 @@ def stock_zygc_em(symbol: str = "SH688041") -> pd.DataFrame:
113
113
  "毛利率",
114
114
  ]
115
115
  ]
116
- temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"]).dt.date
117
- temp_df["分类类型"] = temp_df["分类类型"].map({"2": "按产品分类", "3": "按地区分类"})
116
+ temp_df["报告日期"] = pd.to_datetime(temp_df["报告日期"], errors="coerce").dt.date
117
+ temp_df["分类类型"] = temp_df["分类类型"].map(
118
+ {"2": "按产品分类", "3": "按地区分类"}
119
+ )
118
120
  temp_df["主营收入"] = pd.to_numeric(temp_df["主营收入"], errors="coerce")
119
121
  temp_df["收入比例"] = pd.to_numeric(temp_df["收入比例"], errors="coerce")
120
122
  temp_df["主营成本"] = pd.to_numeric(temp_df["主营成本"], errors="coerce")
@@ -126,7 +128,7 @@ def stock_zygc_em(symbol: str = "SH688041") -> pd.DataFrame:
126
128
 
127
129
 
128
130
  if __name__ == "__main__":
129
- stock_zygc_ym_df = stock_zygc_ym(symbol="000001")
131
+ stock_zygc_ym_df = stock_zygc_ym(symbol="000338")
130
132
  print(stock_zygc_ym_df)
131
133
 
132
134
  stock_zygc_em_df = stock_zygc_em(symbol="SH688041")
@@ -1,10 +1,11 @@
1
1
  # -*- coding:utf-8 -*-
2
2
  # !/usr/bin/env python
3
3
  """
4
- Date: 2023/2/2 11:30
4
+ Date: 2024/3/29 10:30
5
5
  Desc: 同花顺-主营介绍
6
6
  https://basic.10jqka.com.cn/new/000066/operate.html
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
  from bs4 import BeautifulSoup
@@ -19,9 +20,10 @@ def stock_zyjs_ths(symbol: str = "000066") -> pd.DataFrame:
19
20
  :return: 主营介绍
20
21
  :rtype: pandas.DataFrame
21
22
  """
22
- url = f"http://basic.10jqka.com.cn/new/{symbol}/operate.html"
23
+ url = f"https://basic.10jqka.com.cn/new/{symbol}/operate.html"
23
24
  headers = {
24
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
25
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
26
+ "Chrome/109.0.0.0 Safari/537.36"
25
27
  }
26
28
  r = requests.get(url, headers=headers)
27
29
  r.encoding = "gb2312"
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2023/12/27 22:27
4
+ Date: 2024/3/25 16:30
5
5
  Desc: 新浪财经-交易日历
6
6
  https://finance.sina.com.cn/realstock/company/klc_td_sh.txt
7
7
  此处可以用来更新 calendar.json 文件,注意末尾没有 "," 号
8
8
  """
9
+
9
10
  import datetime
10
11
 
11
12
  import pandas as pd
12
13
  import requests
13
- from py_mini_racer import py_mini_racer
14
+ import py_mini_racer
14
15
 
15
16
  from akshare.stock.cons import hk_js_decode
16
17
 
@@ -32,7 +33,7 @@ def tool_trade_date_hist_sina() -> pd.DataFrame:
32
33
  temp_df["trade_date"] = pd.to_datetime(temp_df["trade_date"]).dt.date
33
34
  temp_list = temp_df["trade_date"].to_list()
34
35
  # 该日期是交易日,但是在新浪返回的交易日历缺失该日期,这里补充上
35
- temp_list.append(datetime.date(1992, 5, 4))
36
+ temp_list.append(datetime.date(year=1992, month=5, day=4))
36
37
  temp_list.sort()
37
38
  temp_df = pd.DataFrame(temp_list, columns=["trade_date"])
38
39
  return temp_df
akshare/utils/cons.py ADDED
@@ -0,0 +1,10 @@
1
+ # !/usr/bin/env python
2
+ """
3
+ Date: 2024/4/7 15:30
4
+ Desc: 通用变量
5
+ """
6
+
7
+ headers = {
8
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
9
+ "Chrome/114.0.0.0 Safari/537.36"
10
+ }
@@ -0,0 +1,43 @@
1
+ class AkshareConfig:
2
+ _instance = None
3
+
4
+ def __new__(cls):
5
+ if cls._instance is None:
6
+ cls._instance = super().__new__(cls)
7
+ cls._instance.proxies = None
8
+ return cls._instance
9
+
10
+ @classmethod
11
+ def set_proxies(cls, proxies):
12
+ cls().proxies = proxies
13
+
14
+ @classmethod
15
+ def get_proxies(cls):
16
+ return cls().proxies
17
+
18
+
19
+ config = AkshareConfig()
20
+
21
+
22
+ # 导出 set_proxies 函数
23
+ def set_proxies(proxies):
24
+ config.set_proxies(proxies)
25
+
26
+
27
+ def get_proxies():
28
+ return config.get_proxies()
29
+
30
+
31
+ class ProxyContext:
32
+ def __init__(self, proxies):
33
+ self.proxies = proxies
34
+ self.old_proxies = None
35
+
36
+ def __enter__(self):
37
+ self.old_proxies = config.get_proxies()
38
+ config.set_proxies(self.proxies)
39
+ return self
40
+
41
+ def __exit__(self, exc_type, exc_val, exc_tb):
42
+ config.set_proxies(self.old_proxies)
43
+ return False # 不处理异常
akshare/utils/demjson.py CHANGED
@@ -117,7 +117,7 @@ def determine_float_limits(number_type=float):
117
117
  else:
118
118
  numeric_exceptions = (ValueError,)
119
119
 
120
- if decimal and number_type == decimal.Decimal:
120
+ if decimal and number_type is decimal.Decimal:
121
121
  number_type = decimal.DefaultContext
122
122
 
123
123
  if decimal and isinstance(number_type, decimal.Context):
@@ -125,7 +125,7 @@ def determine_float_limits(number_type=float):
125
125
  create_num = number_type.create_decimal
126
126
  decimal_ctx = decimal.localcontext(number_type)
127
127
  is_zero_or_subnormal = lambda n: n.is_zero() or n.is_subnormal()
128
- elif number_type == float:
128
+ elif number_type is float:
129
129
  create_num = number_type
130
130
  decimal_ctx = _dummy_context_manager
131
131
  is_zero_or_subnormal = lambda n: n == 0
akshare/utils/func.py ADDED
@@ -0,0 +1,26 @@
1
+ # !/usr/bin/env python
2
+ """
3
+ Date: 2024/4/7 15:30
4
+ Desc: 通用帮助函数
5
+ """
6
+
7
+ from typing import List
8
+
9
+ import pandas as pd
10
+
11
+
12
+ def set_df_columns(df: pd.DataFrame, cols: List[str]) -> pd.DataFrame:
13
+ """
14
+ 设置 pandas.DataFrame 为空的情况
15
+ :param df: 需要设置命名的数据框
16
+ :type df: pandas.DataFrame
17
+ :param cols: 字段的列表
18
+ :type cols: list
19
+ :return: 重新设置后的数据
20
+ :rtype: pandas.DataFrame
21
+ """
22
+ if df.shape == (0, 0):
23
+ return pd.DataFrame(data=[], columns=cols)
24
+ else:
25
+ df.columns = cols
26
+ return df
akshare/utils/tqdm.py CHANGED
@@ -1,12 +1,22 @@
1
- def get_tqdm():
1
+ def get_tqdm(enable: bool = True):
2
2
  """
3
3
  返回适用于当前环境的 tqdm 对象。
4
+
5
+ Args:
6
+ enable (bool): 是否启用进度条。默认为 True。
7
+
8
+ Returns:
9
+ tqdm 对象。
4
10
  """
11
+ if not enable:
12
+ # 如果进度条被禁用,返回一个不显示进度条的 tqdm 对象
13
+ return lambda iterable, *args, **kwargs: iterable
14
+
5
15
  try:
6
- # 尝试检查是否在 Jupyter notebook 环境中,有利于退出进度条
16
+ # 尝试检查是否在 jupyter notebook 环境中,有利于退出进度条
7
17
  # noinspection PyUnresolvedReferences
8
18
  shell = get_ipython().__class__.__name__
9
- if shell == 'ZMQInteractiveShell':
19
+ if shell == "ZMQInteractiveShell":
10
20
  from tqdm.notebook import tqdm
11
21
  else:
12
22
  from tqdm import tqdm
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: akshare
3
- Version: 1.12.99
3
+ Version: 1.15.73
4
4
  Summary: AKShare is an elegant and simple financial data interface library for Python, built for human beings!
5
5
  Home-page: https://github.com/akfamily/akshare
6
6
  Author: AKFamily
@@ -12,39 +12,56 @@ Classifier: Programming Language :: Python :: 3.9
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
15
16
  Classifier: License :: OSI Approved :: MIT License
16
17
  Classifier: Operating System :: OS Independent
17
18
  Requires-Python: >=3.8
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE
20
- Requires-Dist: beautifulsoup4 >=4.9.1
21
- Requires-Dist: lxml >=4.2.1
22
- Requires-Dist: pandas >=0.25
23
- Requires-Dist: requests >=2.22.0
24
- Requires-Dist: pypinyin >=0.35.0
25
- Requires-Dist: html5lib >=1.0.1
26
- Requires-Dist: xlrd >=1.2.0
27
- Requires-Dist: urllib3 >=1.25.8
28
- Requires-Dist: tqdm >=4.43.0
29
- Requires-Dist: openpyxl >=3.0.3
30
- Requires-Dist: jsonpath >=0.82
31
- Requires-Dist: tabulate >=0.8.6
32
- Requires-Dist: decorator >=4.4.2
33
- Requires-Dist: py-mini-racer >=0.6.0
34
- Requires-Dist: akracer >=0.0.11
35
- Requires-Dist: pyarrow >=15.0.0
21
+ Requires-Dist: beautifulsoup4>=4.9.1
22
+ Requires-Dist: lxml>=4.2.1
23
+ Requires-Dist: pandas>=0.25
24
+ Requires-Dist: requests>=2.22.0
25
+ Requires-Dist: html5lib>=1.0.1
26
+ Requires-Dist: xlrd>=1.2.0
27
+ Requires-Dist: urllib3>=1.25.8
28
+ Requires-Dist: tqdm>=4.43.0
29
+ Requires-Dist: openpyxl>=3.0.3
30
+ Requires-Dist: jsonpath>=0.82
31
+ Requires-Dist: tabulate>=0.8.6
32
+ Requires-Dist: decorator>=4.4.2
33
+ Requires-Dist: mini-racer>=0.12.4; platform_system != "Linux"
34
+ Requires-Dist: py-mini-racer>=0.6.0; platform_system == "Linux"
35
+ Requires-Dist: akracer[py-mini-racer]>=0.0.13; platform_system == "Linux"
36
36
  Provides-Extra: full
37
- Requires-Dist: akqmt ; extra == 'full'
37
+ Requires-Dist: akqmt; extra == "full"
38
38
  Provides-Extra: qmt
39
- Requires-Dist: akqmt ; extra == 'qmt'
40
-
41
- **AKShare VIP 交流群欢迎大家的加入,加群方式请点击[【加群】](https://zmj.xet.tech/s/28gOeh)**
42
-
43
- **相关视频教程已经发布:《AKShare-初阶-使用教学》、《AKShare-初阶-实战应用》、《AKShare-源码解析》、《开源项目巡礼》**,详情请访问[课程](https://app3rqjh1z21630.h5.xiaoeknow.com)查看更多课程信息!
39
+ Requires-Dist: akqmt; extra == "qmt"
40
+ Dynamic: author
41
+ Dynamic: author-email
42
+ Dynamic: classifier
43
+ Dynamic: description
44
+ Dynamic: description-content-type
45
+ Dynamic: home-page
46
+ Dynamic: keywords
47
+ Dynamic: license
48
+ Dynamic: provides-extra
49
+ Dynamic: requires-dist
50
+ Dynamic: requires-python
51
+ Dynamic: summary
52
+
53
+ **欢迎加入专注于财经数据和量化投资的知识社区,请点击[了解更多](https://akshare.akfamily.xyz/learn.html)**
54
+
55
+ **量化投研视频课程:《PyBroker-入门及实战》已经上架!《PyBroker-进阶及实战》正在更新!**
56
+
57
+ **更多视频教程已经发布:《AKShare-初阶-使用教学》、《AKShare-初阶-实战应用》、《AKShare-源码解析》、《开源项目巡礼》**,
58
+ 详情请关注【数据科学实战】公众号,查看更多课程信息!
44
59
 
45
60
  **AKQuant 量化教程请访问:[利用 PyBroker 进行量化投资](https://akquant.akfamily.xyz/)**
46
61
 
47
- **本次发布 [AKTools](https://github.com/akfamily/aktools) 作为 AKShare 的 HTTP API 版本,突破 Python 语言的限制,欢迎各位小伙伴试用并提出更好的意见或建议! 点击 [AKTools](https://github.com/akfamily/aktools) 查看使用指南。另外提供 [awesome-data](https://github.com/akfamily/awesome-data) 方便各位小伙伴查询各种数据源。**
62
+ **本次发布 [AKTools](https://github.com/akfamily/aktools) 作为 AKShare 的 HTTP API 版本,
63
+ 突破 Python 语言的限制,欢迎各位小伙伴试用并提出更好的意见或建议!
64
+ 点击 [AKTools](https://github.com/akfamily/aktools) 查看使用指南。另外提供 [awesome-data](https://github.com/akfamily/awesome-data) 方便各位小伙伴查询各种数据源。**
48
65
 
49
66
  ![AKShare Logo](https://github.com/akfamily/akshare/blob/main/assets/images/akshare_logo.jpg)
50
67
 
@@ -63,14 +80,13 @@ Requires-Dist: akqmt ; extra == 'qmt'
63
80
 
64
81
  ## Overview
65
82
 
66
- [AKShare](https://github.com/akfamily/akshare) requires Python(64 bit) 3.8 or greater, aims to make fetch financial data as convenient as possible.
83
+ [AKShare](https://github.com/akfamily/akshare) requires Python(64 bit) 3.8 or higher and
84
+ aims to simplify the process of fetching financial data.
67
85
 
68
86
  **Write less, get more!**
69
87
 
70
88
  - Documentation: [中文文档](https://akshare.akfamily.xyz/)
71
89
 
72
- ![](https://github.com/akfamily/akshare/blob/main/assets/images/akshare.svg)
73
-
74
90
  ## Installation
75
91
 
76
92
  ### General
@@ -87,7 +103,8 @@ pip install akshare -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mir
87
103
 
88
104
  ### PR
89
105
 
90
- Please check out [documentation](https://akshare.akfamily.xyz/contributor.html) if you want to contribute to AKShare
106
+ Please check out [Documentation](https://akshare.akfamily.xyz/contributing.html) if you
107
+ want to contribute to AKShare
91
108
 
92
109
  ### Docker
93
110
 
@@ -151,11 +168,9 @@ import akshare as ak
151
168
  import mplfinance as mpf # Please install mplfinance as follows: pip install mplfinance
152
169
 
153
170
  stock_us_daily_df = ak.stock_us_daily(symbol="AAPL", adjust="qfq")
154
- stock_us_daily_df = stock_us_daily_df[["open", "high", "low", "close", "volume"]]
155
- stock_us_daily_df.columns = ["Open", "High", "Low", "Close", "Volume"]
156
- stock_us_daily_df.index.name = "Date"
171
+ stock_us_daily_df = stock_us_daily_df.set_index(["date"])
157
172
  stock_us_daily_df = stock_us_daily_df["2020-04-01": "2020-04-29"]
158
- mpf.plot(stock_us_daily_df, type='candle', mav=(3, 6, 9), volume=True, show_nontrading=False)
173
+ mpf.plot(stock_us_daily_df, type="candle", mav=(3, 6, 9), volume=True, show_nontrading=False)
159
174
  ```
160
175
 
161
176
  Output:
@@ -164,7 +179,8 @@ Output:
164
179
 
165
180
  ## Communication
166
181
 
167
- Pay attention to **数据科学实战** Official Accounts to get more information about Quant, ML, DS and so on, please visit [数据科学实战](https://akshare.akfamily.xyz/introduction.html) for more information:
182
+ Welcome to join the **数据科学实战** knowledge planet to learn more about quantitative investment,
183
+ please visit [数据科学实战](https://akshare.akfamily.xyz/learn.html) for more information:
168
184
 
169
185
  <div>
170
186
  <img alt="data science" src="https://jfds-1252952517.cos.ap-chengdu.myqcloud.com/akshare/readme/qrcode/data_scientist.png">
@@ -176,9 +192,6 @@ Pay attention to **数据科学实战** WeChat Official Accounts to get the [AKS
176
192
  <img alt="ds" src="https://github.com/akfamily/akshare/blob/main/assets/images/ds.png">
177
193
  </div>
178
194
 
179
- Application to add **AKShare-VIP QQ group** and talk about [AKShare](https://github.com/akfamily/akshare) issues, please contact **AKShare-小助手 QQ**: 1254836886
180
- ![QRCode](https://jfds-1252952517.cos.ap-chengdu.myqcloud.com/akshare/readme/qrcode/qr_code_1254836886.jpg)
181
-
182
195
  ## Features
183
196
 
184
197
  - **Easy of use**: Just one line code to fetch the data;
@@ -256,14 +269,10 @@ Special thanks [TuShare](https://github.com/waditu/tushare) for the opportunity
256
269
 
257
270
  Thanks for the data provided by [生意社网站](http://www.100ppi.com/);
258
271
 
259
- Thanks for the data provided by [奇货可查网站](https://qhkch.com/);
260
-
261
272
  Thanks for the data provided by [中国银行间市场交易商协会网站](http://www.nafmii.org.cn/);
262
273
 
263
274
  Thanks for the data provided by [99期货网站](http://www.99qh.com/);
264
275
 
265
- Thanks for the data provided by [英为财情网站](https://cn.investing.com/);
266
-
267
276
  Thanks for the data provided by [中国外汇交易中心暨全国银行间同业拆借中心网站](http://www.chinamoney.com.cn/chinese/);
268
277
 
269
278
  Thanks for the data provided by [金十数据网站](https://www.jin10.com/);
@@ -272,8 +281,6 @@ Thanks for the data provided by [和讯财经网站](http://www.hexun.com/);
272
281
 
273
282
  Thanks for the data provided by [新浪财经网站](https://finance.sina.com.cn/);
274
283
 
275
- Thanks for the data provided by [Oxford-Man Institute 网站](https://realized.oxford-man.ox.ac.uk/);
276
-
277
284
  Thanks for the data provided by [DACHENG-XIU 网站](https://dachxiu.chicagobooth.edu/);
278
285
 
279
286
  Thanks for the data provided by [上海证券交易所网站](http://www.sse.com.cn/assortment/options/price/);
@@ -300,12 +307,6 @@ Thanks for the data provided by [南华期货网站](http://www.nanhua.net/nhzc/
300
307
 
301
308
  Thanks for the data provided by [Economic Policy Uncertainty 网站](http://www.nanhua.net/nhzc/varietytrend.html);
302
309
 
303
- Thanks for the data provided by [微博指数网站](https://data.weibo.com/index/newindex);
304
-
305
- Thanks for the data provided by [百度指数网站](http://index.baidu.com/v2/main/index.html);
306
-
307
- Thanks for the data provided by [谷歌指数网站](https://trends.google.com/trends/?geo=US);
308
-
309
310
  Thanks for the data provided by [申万指数网站](http://www.swsindex.com/idx0120.aspx?columnid=8832);
310
311
 
311
312
  Thanks for the data provided by [真气网网站](https://www.zq12369.com/);
@@ -320,30 +321,12 @@ Thanks for the data provided by [北京市碳排放权电子交易平台网站](
320
321
 
321
322
  Thanks for the data provided by [国家金融与发展实验室网站](http://www.nifd.cn/);
322
323
 
323
- Thanks for the data provided by [IT桔子网站](https://www.itjuzi.com);
324
-
325
324
  Thanks for the data provided by [东方财富网站](http://data.eastmoney.com/jgdy/);
326
325
 
327
326
  Thanks for the data provided by [义乌小商品指数网站](http://www.ywindex.com/Home/Product/index/);
328
327
 
329
- Thanks for the data provided by [中国国家发展和改革委员会网站](http://jgjc.ndrc.gov.cn/dmzs.aspx?clmId=741);
330
-
331
- Thanks for the data provided by [163网站](https://news.163.com/special/epidemic/);
332
-
333
- Thanks for the data provided by [丁香园网站](http://3g.dxy.cn/newh5/view/pneumonia?scene=2&clicktime=1579615030&enterid=1579615030&from=groupmessage&isappinstalled=0);
334
-
335
- Thanks for the data provided by [百度新型肺炎网站](https://voice.baidu.com/act/newpneumonia/newpneumonia/?from=osari_pc_1);
336
-
337
328
  Thanks for the data provided by [百度迁徙网站](https://qianxi.baidu.com/?from=shoubai#city=0);
338
329
 
339
- Thanks for the data provided by [新型肺炎-相同行程查询工具网站](https://rl.inews.qq.com/h5/trip?from=newsapp&ADTAG=tgi.wx.share.message);
340
-
341
- Thanks for the data provided by [新型肺炎-小区查询网站](https://ncov.html5.qq.com/community?channelid=1&from=singlemessage&isappinstalled=0);
342
-
343
- Thanks for the data provided by [商业特许经营信息管理网站](http://txjy.syggs.mofcom.gov.cn/);
344
-
345
- Thanks for the data provided by [慈善中国网站](http://cishan.chinanpo.gov.cn/platform/login.html);
346
-
347
330
  Thanks for the data provided by [思知网站](https://www.ownthink.com/);
348
331
 
349
332
  Thanks for the data provided by [Currencyscoop 网站](https://currencyscoop.com/);
@@ -354,6 +337,6 @@ Thanks for the tutorials provided by [微信公众号: Python大咖谈](https://
354
337
 
355
338
  ## Backer and Sponsor
356
339
 
357
- <a href="https://www.jetbrains.com/?from=jindaxiang/akshare" target="_blank">
358
- <img alt="jetbrains" src="https://github.com/akfamily/akshare/blob/main/assets/images/jetbrains.svg" width="100px" height="100px">
340
+ <a href="https://www.jetbrains.com/?from=albertandking/akshare" target="_blank">
341
+ <img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains logo.">
359
342
  </a>