akshare 1.13.46__py3-none-any.whl → 1.17.99__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 (388) hide show
  1. akshare/__init__.py +757 -161
  2. akshare/air/air_hebei.py +79 -53
  3. akshare/air/air_zhenqi.py +3 -7
  4. akshare/air/cons.py +1 -0
  5. akshare/air/crypto.js +1 -1
  6. akshare/air/outcrypto.js +1 -1
  7. akshare/air/sunrise_tad.py +32 -17
  8. akshare/article/cons.py +1 -0
  9. akshare/article/epu_index.py +4 -3
  10. akshare/article/ff_factor.py +19 -8
  11. akshare/article/fred_md.py +4 -1
  12. akshare/article/risk_rv.py +3 -8
  13. akshare/bank/bank_cbirc_2020.py +11 -11
  14. akshare/bank/cons.py +7 -6
  15. akshare/bond/bond_buy_back_em.py +228 -0
  16. akshare/bond/bond_cb_sina.py +1 -0
  17. akshare/bond/bond_cb_ths.py +17 -9
  18. akshare/bond/bond_cbond.py +19 -14
  19. akshare/bond/bond_china.py +38 -39
  20. akshare/bond/bond_china_money.py +75 -48
  21. akshare/bond/bond_convert.py +10 -9
  22. akshare/bond/bond_em.py +37 -17
  23. akshare/bond/bond_info_cm.py +28 -8
  24. akshare/bond/bond_issue_cninfo.py +73 -30
  25. akshare/bond/bond_summary.py +38 -37
  26. akshare/bond/bond_zh_cov.py +31 -40
  27. akshare/bond/bond_zh_sina.py +61 -51
  28. akshare/bond/cons.py +14 -11
  29. akshare/cal/__init__.py +0 -0
  30. akshare/cal/rv.py +170 -0
  31. akshare/cost/cost_living.py +7 -5
  32. akshare/crypto/__init__.py +1 -1
  33. akshare/crypto/crypto_bitcoin_cme.py +9 -7
  34. akshare/crypto/crypto_hold.py +4 -2
  35. akshare/currency/currency.py +1 -0
  36. akshare/currency/currency_china_bank_sina.py +11 -6
  37. akshare/currency/currency_safe.py +7 -6
  38. akshare/data/__init__.py +1 -1
  39. akshare/data/cninfo.js +1 -1
  40. akshare/datasets.py +10 -21
  41. akshare/economic/cons.py +10 -3
  42. akshare/economic/macro_australia.py +74 -69
  43. akshare/economic/macro_bank.py +95 -653
  44. akshare/economic/macro_canada.py +92 -81
  45. akshare/economic/macro_china.py +163 -117
  46. akshare/economic/macro_china_hk.py +0 -1
  47. akshare/economic/macro_china_nbs.py +24 -7
  48. akshare/economic/macro_euro.py +103 -56
  49. akshare/economic/macro_finance_ths.py +135 -0
  50. akshare/economic/macro_germany.py +1 -1
  51. akshare/economic/macro_info_ws.py +100 -0
  52. akshare/economic/macro_japan.py +0 -1
  53. akshare/economic/macro_other.py +1 -6
  54. akshare/economic/macro_swiss.py +2 -3
  55. akshare/economic/macro_uk.py +1 -1
  56. akshare/economic/macro_usa.py +7 -9
  57. akshare/economic/marco_cnbs.py +11 -6
  58. akshare/energy/energy_carbon.py +94 -126
  59. akshare/energy/energy_oil_em.py +1 -2
  60. akshare/event/cons.py +1 -0
  61. akshare/event/migration.py +3 -2
  62. akshare/exceptions.py +43 -0
  63. akshare/file_fold/calendar.json +245 -2
  64. akshare/forex/__init__.py +0 -0
  65. akshare/forex/cons.py +192 -0
  66. akshare/forex/forex_em.py +149 -0
  67. akshare/fortune/fortune_500.py +15 -48
  68. akshare/fortune/fortune_bloomberg.py +6 -3
  69. akshare/fortune/fortune_forbes_500.py +3 -6
  70. akshare/fortune/fortune_hurun.py +2 -1
  71. akshare/fortune/fortune_xincaifu_500.py +17 -14
  72. akshare/fund/fund_amac.py +38 -15
  73. akshare/fund/fund_announcement_em.py +145 -0
  74. akshare/fund/fund_aum_em.py +49 -35
  75. akshare/fund/fund_em.py +251 -220
  76. akshare/fund/fund_etf_em.py +44 -35
  77. akshare/fund/fund_etf_sina.py +76 -27
  78. akshare/fund/fund_etf_ths.py +95 -0
  79. akshare/fund/fund_fee_em.py +172 -0
  80. akshare/fund/fund_fhsp_em.py +42 -32
  81. akshare/fund/fund_init_em.py +8 -5
  82. akshare/fund/fund_lof_em.py +12 -19
  83. akshare/fund/fund_manager.py +25 -11
  84. akshare/fund/fund_overview_em.py +42 -0
  85. akshare/fund/fund_portfolio_em.py +78 -66
  86. akshare/fund/fund_position_lg.py +19 -8
  87. akshare/fund/fund_rank_em.py +90 -84
  88. akshare/fund/fund_rating.py +33 -12
  89. akshare/fund/fund_report_cninfo.py +63 -48
  90. akshare/fund/fund_scale_em.py +24 -13
  91. akshare/fund/fund_scale_sina.py +20 -10
  92. akshare/fund/fund_xq.py +3 -2
  93. akshare/futures/cons.py +141 -46
  94. akshare/futures/cot.py +89 -88
  95. akshare/futures/futures_basis.py +99 -33
  96. akshare/futures/futures_comex_em.py +1 -0
  97. akshare/futures/futures_comm_ctp.py +13 -2
  98. akshare/futures/futures_contract_detail.py +59 -9
  99. akshare/futures/futures_daily_bar.py +75 -62
  100. akshare/futures/futures_foreign.py +14 -8
  101. akshare/futures/futures_hf_em.py +215 -61
  102. akshare/futures/futures_hist_em.py +191 -0
  103. akshare/futures/futures_hq_sina.py +79 -61
  104. akshare/futures/futures_index_ccidx.py +24 -82
  105. akshare/futures/futures_inventory_99.py +70 -272
  106. akshare/futures/futures_inventory_em.py +14 -11
  107. akshare/futures/futures_news_shmet.py +2 -2
  108. akshare/futures/futures_roll_yield.py +11 -24
  109. akshare/futures/futures_rule.py +7 -3
  110. akshare/futures/futures_rule_em.py +38 -0
  111. akshare/futures/futures_settlement_price_sgx.py +21 -6
  112. akshare/futures/futures_stock_js.py +1 -2
  113. akshare/futures/futures_to_spot.py +43 -39
  114. akshare/futures/futures_warehouse_receipt.py +53 -48
  115. akshare/futures/futures_zh_sina.py +4 -4
  116. akshare/futures/receipt.py +298 -165
  117. akshare/futures/requests_fun.py +16 -3
  118. akshare/futures/symbol_var.py +32 -13
  119. akshare/futures_derivative/cons.py +100 -103
  120. akshare/futures_derivative/futures_contract_info_cffex.py +55 -39
  121. akshare/futures_derivative/futures_contract_info_czce.py +2 -0
  122. akshare/futures_derivative/futures_contract_info_dce.py +43 -17
  123. akshare/futures_derivative/futures_contract_info_gfex.py +43 -31
  124. akshare/futures_derivative/futures_contract_info_ine.py +43 -34
  125. akshare/futures_derivative/futures_contract_info_shfe.py +7 -8
  126. akshare/futures_derivative/futures_cot_sina.py +28 -19
  127. akshare/futures_derivative/futures_index_sina.py +25 -13
  128. akshare/fx/cons.py +12 -7
  129. akshare/fx/currency_investing.py +19 -285
  130. akshare/fx/fx_c_swap_cm.py +62 -0
  131. akshare/fx/fx_quote.py +3 -2
  132. akshare/fx/fx_quote_baidu.py +2 -1
  133. akshare/hf/__init__.py +1 -1
  134. akshare/hf/hf_sp500.py +8 -7
  135. akshare/index/cons.py +132 -28
  136. akshare/index/index_cflp.py +29 -26
  137. akshare/index/index_cni.py +89 -91
  138. akshare/index/index_cons.py +26 -10
  139. akshare/index/index_csindex.py +68 -0
  140. akshare/index/index_cx.py +263 -62
  141. akshare/index/index_drewry.py +17 -16
  142. akshare/index/index_eri.py +1 -0
  143. akshare/index/index_global_em.py +167 -0
  144. akshare/index/index_global_sina.py +82 -0
  145. akshare/index/index_kq_fz.py +17 -14
  146. akshare/index/index_kq_ss.py +1 -0
  147. akshare/index/index_option_qvix.py +351 -16
  148. akshare/index/index_research_sw.py +38 -38
  149. akshare/index/index_spot.py +9 -5
  150. akshare/index/index_stock_hk.py +6 -10
  151. akshare/index/index_stock_us_sina.py +1 -1
  152. akshare/index/index_stock_zh.py +193 -101
  153. akshare/index/index_stock_zh_csindex.py +15 -369
  154. akshare/index/index_sugar.py +18 -4
  155. akshare/index/index_sw.py +62 -34
  156. akshare/index/index_yw.py +53 -75
  157. akshare/index/index_zh_em.py +15 -82
  158. akshare/interest_rate/interbank_rate_em.py +14 -10
  159. akshare/movie/artist_yien.py +32 -5
  160. akshare/movie/jm.js +0 -1
  161. akshare/movie/movie_yien.py +92 -18
  162. akshare/movie/video_yien.py +28 -5
  163. akshare/news/__init__.py +1 -1
  164. akshare/news/news_baidu.py +395 -220
  165. akshare/news/news_cctv.py +38 -38
  166. akshare/news/news_stock.py +49 -13
  167. akshare/nlp/nlp_interface.py +7 -8
  168. akshare/option/cons.py +12 -12
  169. akshare/option/option_comm_qihuo.py +86 -0
  170. akshare/option/option_commodity.py +355 -211
  171. akshare/option/option_commodity_sina.py +22 -26
  172. akshare/option/option_contract_info_ctp.py +63 -0
  173. akshare/option/option_current_sse.py +61 -0
  174. akshare/option/option_current_szse.py +84 -0
  175. akshare/option/option_czce.py +37 -9
  176. akshare/option/option_daily_stats_sse_szse.py +145 -0
  177. akshare/option/option_em.py +4 -8
  178. akshare/option/option_finance.py +60 -12
  179. akshare/option/option_finance_sina.py +28 -26
  180. akshare/option/option_lhb_em.py +62 -57
  181. akshare/option/option_margin.py +62 -0
  182. akshare/option/option_premium_analysis_em.py +58 -53
  183. akshare/option/option_risk_analysis_em.py +11 -8
  184. akshare/option/option_risk_indicator_sse.py +18 -16
  185. akshare/option/option_value_analysis_em.py +62 -55
  186. akshare/other/__init__.py +1 -1
  187. akshare/other/other_car_cpca.py +20 -20
  188. akshare/pro/__init__.py +0 -1
  189. akshare/pro/client.py +6 -4
  190. akshare/pro/cons.py +3 -2
  191. akshare/pro/data_pro.py +6 -5
  192. akshare/qdii/__init__.py +0 -0
  193. akshare/qdii/qdii_jsl.py +233 -0
  194. akshare/qhkc/__init__.py +1 -6
  195. akshare/qhkc/qhkc_api.py +64 -22
  196. akshare/qhkc_web/__init__.py +1 -6
  197. akshare/qhkc_web/qhkc_fund.py +10 -6
  198. akshare/qhkc_web/qhkc_index.py +28 -14
  199. akshare/qhkc_web/qhkc_tool.py +62 -59
  200. akshare/rate/__init__.py +1 -1
  201. akshare/rate/repo_rate.py +36 -32
  202. akshare/reits/__init__.py +1 -1
  203. akshare/reits/reits_basic.py +149 -13
  204. akshare/request.py +117 -0
  205. akshare/spot/__init__.py +1 -1
  206. akshare/spot/spot_hog_soozhu.py +232 -0
  207. akshare/spot/spot_price_qh.py +121 -0
  208. akshare/spot/spot_sge.py +70 -9
  209. akshare/stock/cons.py +60 -23
  210. akshare/stock/stock_allotment_cninfo.py +10 -9
  211. akshare/stock/stock_ask_bid_em.py +3 -78
  212. akshare/stock/stock_board_concept_em.py +160 -35
  213. akshare/stock/stock_board_industry_em.py +163 -70
  214. akshare/stock/stock_cg_equity_mortgage.py +15 -11
  215. akshare/stock/stock_cg_guarantee.py +41 -51
  216. akshare/stock/stock_cg_lawsuit.py +36 -35
  217. akshare/stock/stock_dividend_cninfo.py +36 -16
  218. akshare/stock/stock_dzjy_em.py +347 -260
  219. akshare/stock/stock_fund_em.py +73 -64
  220. akshare/stock/stock_fund_hold.py +1 -2
  221. akshare/stock/stock_gsrl_em.py +1 -0
  222. akshare/stock/stock_hk_comparison_em.py +175 -0
  223. akshare/stock/stock_hk_famous.py +107 -0
  224. akshare/stock/stock_hk_fhpx_ths.py +2 -1
  225. akshare/stock/stock_hk_hot_rank_em.py +1 -0
  226. akshare/stock/stock_hk_sina.py +91 -42
  227. akshare/stock/stock_hold_control_cninfo.py +100 -15
  228. akshare/stock/stock_hold_control_em.py +4 -5
  229. akshare/stock/stock_hold_num_cninfo.py +18 -12
  230. akshare/stock/stock_hot_rank_em.py +4 -1
  231. akshare/stock/stock_hot_search_baidu.py +32 -19
  232. akshare/stock/stock_hot_up_em.py +4 -1
  233. akshare/stock/stock_hsgt_em.py +155 -0
  234. akshare/stock/stock_industry.py +1 -0
  235. akshare/stock/stock_industry_cninfo.py +25 -20
  236. akshare/stock/stock_industry_pe_cninfo.py +45 -31
  237. akshare/stock/stock_industry_sw.py +5 -9
  238. akshare/stock/stock_info.py +31 -19
  239. akshare/stock/stock_info_em.py +17 -11
  240. akshare/stock/stock_intraday_em.py +9 -80
  241. akshare/stock/stock_intraday_sina.py +2 -2
  242. akshare/stock/stock_ipo_summary_cninfo.py +25 -10
  243. akshare/stock/stock_new_cninfo.py +32 -19
  244. akshare/stock/stock_news_cx.py +39 -0
  245. akshare/stock/stock_profile_cninfo.py +9 -8
  246. akshare/stock/stock_profile_em.py +302 -0
  247. akshare/stock/stock_rank_forecast.py +8 -6
  248. akshare/stock/stock_repurchase_em.py +7 -2
  249. akshare/stock/stock_share_changes_cninfo.py +18 -14
  250. akshare/stock/stock_share_hold.py +24 -20
  251. akshare/stock/stock_stop.py +6 -6
  252. akshare/stock/stock_summary.py +153 -417
  253. akshare/stock/stock_us_famous.py +19 -11
  254. akshare/stock/stock_us_js.py +3 -2
  255. akshare/stock/stock_us_pink.py +38 -27
  256. akshare/stock/stock_us_sina.py +15 -12
  257. akshare/stock/stock_weibo_nlp.py +18 -20
  258. akshare/stock/stock_xq.py +36 -9
  259. akshare/stock/stock_zh_a_sina.py +58 -80
  260. akshare/stock/stock_zh_a_special.py +240 -243
  261. akshare/stock/stock_zh_a_tick_tx.py +11 -3
  262. akshare/stock/stock_zh_ah_tx.py +23 -26
  263. akshare/stock/stock_zh_b_sina.py +32 -55
  264. akshare/stock/stock_zh_comparison_em.py +250 -0
  265. akshare/stock/stock_zh_kcb_report.py +11 -9
  266. akshare/stock/stock_zh_kcb_sina.py +67 -64
  267. akshare/stock_a/__init__.py +0 -0
  268. akshare/stock_a/stock_board_concept_name_em.py +170 -0
  269. akshare/stock_a/stock_individual_fund_flow_rank.py +258 -0
  270. akshare/stock_a/stock_zh_a_spot.py +212 -0
  271. akshare/stock_feature/cons.py +1 -0
  272. akshare/stock_feature/stock_a_below_net_asset_statistics.py +5 -2
  273. akshare/stock_feature/stock_a_high_low.py +5 -2
  274. akshare/stock_feature/stock_a_indicator.py +15 -57
  275. akshare/stock_feature/stock_a_pe_and_pb.py +39 -9
  276. akshare/stock_feature/stock_account_em.py +0 -1
  277. akshare/stock_feature/stock_all_pb.py +2 -1
  278. akshare/stock_feature/stock_analyst_em.py +36 -30
  279. akshare/stock_feature/stock_board_concept_ths.py +144 -252
  280. akshare/stock_feature/stock_board_industry_ths.py +137 -401
  281. akshare/stock_feature/stock_buffett_index_lg.py +10 -8
  282. akshare/stock_feature/stock_classify_sina.py +3 -6
  283. akshare/stock_feature/stock_comment_em.py +81 -144
  284. akshare/stock_feature/stock_concept_futu.py +183 -0
  285. akshare/stock_feature/stock_congestion_lg.py +2 -1
  286. akshare/stock_feature/stock_cyq_em.py +5 -11
  287. akshare/stock_feature/stock_disclosure_cninfo.py +20 -10
  288. akshare/stock_feature/stock_dxsyl_em.py +121 -74
  289. akshare/stock_feature/stock_ebs_lg.py +5 -4
  290. akshare/stock_feature/stock_esg_sina.py +33 -15
  291. akshare/stock_feature/stock_fhps_em.py +62 -26
  292. akshare/stock_feature/stock_fhps_ths.py +34 -7
  293. akshare/stock_feature/stock_fund_flow.py +38 -25
  294. akshare/stock_feature/stock_gddh_em.py +19 -11
  295. akshare/stock_feature/stock_gdfx_em.py +226 -113
  296. akshare/stock_feature/stock_gdhs.py +75 -50
  297. akshare/stock_feature/stock_gdzjc_em.py +21 -10
  298. akshare/stock_feature/stock_gpzy_em.py +78 -46
  299. akshare/stock_feature/stock_gxl_lg.py +3 -2
  300. akshare/stock_feature/stock_hist_em.py +158 -237
  301. akshare/stock_feature/stock_hist_tx.py +13 -10
  302. akshare/stock_feature/stock_hk_valuation_baidu.py +20 -8
  303. akshare/stock_feature/stock_hot_xq.py +4 -6
  304. akshare/stock_feature/stock_hsgt_em.py +269 -97
  305. akshare/stock_feature/stock_hsgt_exchange_rate.py +115 -87
  306. akshare/stock_feature/stock_hsgt_min_em.py +13 -16
  307. akshare/stock_feature/stock_info.py +8 -81
  308. akshare/stock_feature/stock_inner_trade_xq.py +38 -31
  309. akshare/stock_feature/stock_irm_cninfo.py +32 -9
  310. akshare/stock_feature/stock_jgdy_em.py +43 -40
  311. akshare/stock_feature/stock_lh_yybpm.py +36 -37
  312. akshare/stock_feature/stock_lhb_em.py +165 -35
  313. akshare/stock_feature/stock_lhb_sina.py +93 -46
  314. akshare/stock_feature/stock_margin_em.py +101 -0
  315. akshare/stock_feature/{stock_sse_margin.py → stock_margin_sse.py} +21 -17
  316. akshare/stock_feature/{stock_szse_margin.py → stock_margin_szse.py} +7 -7
  317. akshare/stock_feature/stock_market_legu.py +4 -2
  318. akshare/stock_feature/stock_pankou_em.py +71 -35
  319. akshare/stock_feature/stock_qsjy_em.py +13 -4
  320. akshare/stock_feature/stock_report_em.py +152 -8
  321. akshare/stock_feature/stock_research_report_em.py +55 -20
  322. akshare/stock_feature/stock_sns_sseinfo.py +15 -12
  323. akshare/stock_feature/stock_sy_em.py +20 -15
  324. akshare/stock_feature/stock_technology_ths.py +152 -120
  325. akshare/stock_feature/stock_tfp_em.py +37 -14
  326. akshare/stock_feature/stock_three_report_em.py +120 -78
  327. akshare/stock_feature/stock_ttm_lyr.py +18 -9
  328. akshare/stock_feature/stock_value_em.py +83 -0
  329. akshare/stock_feature/stock_yjbb_em.py +58 -32
  330. akshare/stock_feature/stock_yjyg_cninfo.py +6 -2
  331. akshare/stock_feature/stock_yjyg_em.py +1 -1
  332. akshare/stock_feature/stock_yzxdr_em.py +24 -22
  333. akshare/stock_feature/stock_zdhtmx_em.py +20 -6
  334. akshare/stock_feature/stock_zh_valuation_baidu.py +3 -2
  335. akshare/stock_feature/stock_zh_vote_baidu.py +4 -1
  336. akshare/stock_feature/stock_ztb_em.py +39 -24
  337. akshare/stock_fundamental/__init__.py +1 -1
  338. akshare/stock_fundamental/stock_basic_info_xq.py +119 -0
  339. akshare/stock_fundamental/{stock_finance_hk.py → stock_finance_hk_em.py} +23 -16
  340. akshare/stock_fundamental/{stock_finance.py → stock_finance_sina.py} +203 -59
  341. akshare/stock_fundamental/stock_finance_ths.py +524 -57
  342. akshare/stock_fundamental/stock_finance_us_em.py +268 -0
  343. akshare/stock_fundamental/stock_gbjg_em.py +80 -0
  344. akshare/stock_fundamental/stock_hold.py +26 -17
  345. akshare/stock_fundamental/stock_ipo_declare.py +1 -0
  346. akshare/stock_fundamental/stock_kcb_detail_sse.py +10 -10
  347. akshare/stock_fundamental/stock_kcb_sse.py +26 -25
  348. akshare/stock_fundamental/stock_notice.py +41 -18
  349. akshare/stock_fundamental/stock_profit_forecast_em.py +31 -13
  350. akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py +64 -41
  351. akshare/stock_fundamental/stock_profit_forecast_ths.py +86 -35
  352. akshare/stock_fundamental/stock_recommend.py +20 -4
  353. akshare/stock_fundamental/stock_register_em.py +448 -0
  354. akshare/stock_fundamental/stock_zygc.py +5 -62
  355. akshare/tool/trade_date_hist.py +1 -1
  356. akshare/utils/context.py +43 -0
  357. akshare/utils/demjson.py +2009 -1338
  358. akshare/utils/func.py +49 -2
  359. akshare/utils/multi_decrypt.py +53 -0
  360. akshare/utils/token_process.py +6 -5
  361. akshare/utils/tqdm.py +13 -3
  362. {akshare-1.13.46.dist-info → akshare-1.17.99.dist-info}/METADATA +56 -86
  363. akshare-1.17.99.dist-info/RECORD +409 -0
  364. {akshare-1.13.46.dist-info → akshare-1.17.99.dist-info}/WHEEL +1 -1
  365. {akshare-1.13.46.dist-info → akshare-1.17.99.dist-info/licenses}/LICENSE +1 -1
  366. tests/test_func.py +3 -5
  367. akshare/bond/bond_futures.py +0 -50
  368. akshare/bond/bond_investing.py +0 -139
  369. akshare/crypto/crypto_hist_investing.py +0 -249
  370. akshare/fortune/fortune_it_juzi.py +0 -123
  371. akshare/fund/fund_announcement.py +0 -56
  372. akshare/futures/futures_international.py +0 -170
  373. akshare/futures/futures_news_baidu.py +0 -54
  374. akshare/futures/inventory_data.py +0 -100
  375. akshare/futures_derivative/futures_index_price_nh.py +0 -61
  376. akshare/futures_derivative/futures_index_return_nh.py +0 -47
  377. akshare/futures_derivative/futures_index_volatility_nh.py +0 -51
  378. akshare/futures_derivative/futures_other_index_nh.py +0 -145
  379. akshare/index/index_fear_greed_funddb.py +0 -78
  380. akshare/index/index_investing.py +0 -232
  381. akshare/sport/__init__.py +0 -6
  382. akshare/sport/sport_olympic.py +0 -27
  383. akshare/sport/sport_olympic_winter.py +0 -39
  384. akshare/stock_feature/stock_wencai.py +0 -104
  385. akshare/stock_fundamental/stock_mda_ym.py +0 -40
  386. akshare/stock_fundamental/stock_register.py +0 -292
  387. akshare-1.13.46.dist-info/RECORD +0 -380
  388. {akshare-1.13.46.dist-info → akshare-1.17.99.dist-info}/top_level.txt +0 -0
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2024/3/20 15:00
4
+ Date: 2025/3/10 18:00
5
5
  Desc: 东方财富网-行情首页-沪深京 A 股
6
6
  https://quote.eastmoney.com/
7
7
  """
8
8
 
9
- from functools import lru_cache
10
-
11
9
  import pandas as pd
12
10
  import requests
13
11
 
12
+ from akshare.utils.func import fetch_paginated_data
13
+
14
14
 
15
15
  def stock_zh_a_spot_em() -> pd.DataFrame:
16
16
  """
@@ -22,24 +22,20 @@ def stock_zh_a_spot_em() -> pd.DataFrame:
22
22
  url = "https://82.push2.eastmoney.com/api/qt/clist/get"
23
23
  params = {
24
24
  "pn": "1",
25
- "pz": "50000",
25
+ "pz": "100",
26
26
  "po": "1",
27
27
  "np": "1",
28
28
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
29
29
  "fltt": "2",
30
30
  "invt": "2",
31
- "fid": "f3",
31
+ "fid": "f12",
32
32
  "fs": "m:0 t:6,m:0 t:80,m:1 t:2,m:1 t:23,m:0 t:81 s:2048",
33
33
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,"
34
- "f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
35
- "_": "1623833739532",
34
+ "f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
36
35
  }
37
- r = requests.get(url, timeout=15, params=params)
38
- data_json = r.json()
39
- if not data_json["data"]["diff"]:
40
- return pd.DataFrame()
41
- temp_df = pd.DataFrame(data_json["data"]["diff"])
36
+ temp_df = fetch_paginated_data(url, params)
42
37
  temp_df.columns = [
38
+ "index",
43
39
  "_",
44
40
  "最新价",
45
41
  "涨跌幅",
@@ -72,8 +68,6 @@ def stock_zh_a_spot_em() -> pd.DataFrame:
72
68
  "-",
73
69
  "-",
74
70
  ]
75
- temp_df.reset_index(inplace=True)
76
- temp_df["index"] = temp_df.index + 1
77
71
  temp_df.rename(columns={"index": "序号"}, inplace=True)
78
72
  temp_df = temp_df[
79
73
  [
@@ -137,24 +131,20 @@ def stock_sh_a_spot_em() -> pd.DataFrame:
137
131
  url = "https://82.push2.eastmoney.com/api/qt/clist/get"
138
132
  params = {
139
133
  "pn": "1",
140
- "pz": "50000",
134
+ "pz": "100",
141
135
  "po": "1",
142
136
  "np": "1",
143
137
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
144
138
  "fltt": "2",
145
139
  "invt": "2",
146
- "fid": "f3",
140
+ "fid": "f12",
147
141
  "fs": "m:1 t:2,m:1 t:23",
148
142
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,"
149
- "f24,f25,f22,f11,f62,f128,f136,f115,f152",
150
- "_": "1623833739532",
143
+ "f24,f25,f22,f11,f62,f128,f136,f115,f152",
151
144
  }
152
- r = requests.get(url, timeout=15, params=params)
153
- data_json = r.json()
154
- if not data_json["data"]["diff"]:
155
- return pd.DataFrame()
156
- temp_df = pd.DataFrame(data_json["data"]["diff"])
145
+ temp_df = fetch_paginated_data(url, params)
157
146
  temp_df.columns = [
147
+ "序号",
158
148
  "_",
159
149
  "最新价",
160
150
  "涨跌幅",
@@ -187,9 +177,6 @@ def stock_sh_a_spot_em() -> pd.DataFrame:
187
177
  "-",
188
178
  "-",
189
179
  ]
190
- temp_df.reset_index(inplace=True)
191
- temp_df["index"] = temp_df.index + 1
192
- temp_df.rename(columns={"index": "序号"}, inplace=True)
193
180
  temp_df = temp_df[
194
181
  [
195
182
  "序号",
@@ -252,24 +239,20 @@ def stock_sz_a_spot_em() -> pd.DataFrame:
252
239
  url = "https://82.push2.eastmoney.com/api/qt/clist/get"
253
240
  params = {
254
241
  "pn": "1",
255
- "pz": "50000",
242
+ "pz": "100",
256
243
  "po": "1",
257
244
  "np": "1",
258
245
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
259
246
  "fltt": "2",
260
247
  "invt": "2",
261
- "fid": "f3",
248
+ "fid": "f12",
262
249
  "fs": "m:0 t:6,m:0 t:80",
263
250
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,"
264
- "f25,f22,f11,f62,f128,f136,f115,f152",
265
- "_": "1623833739532",
251
+ "f25,f22,f11,f62,f128,f136,f115,f152",
266
252
  }
267
- r = requests.get(url, timeout=15, params=params)
268
- data_json = r.json()
269
- if not data_json["data"]["diff"]:
270
- return pd.DataFrame()
271
- temp_df = pd.DataFrame(data_json["data"]["diff"])
253
+ temp_df = fetch_paginated_data(url, params)
272
254
  temp_df.columns = [
255
+ "序号",
273
256
  "_",
274
257
  "最新价",
275
258
  "涨跌幅",
@@ -302,9 +285,6 @@ def stock_sz_a_spot_em() -> pd.DataFrame:
302
285
  "-",
303
286
  "-",
304
287
  ]
305
- temp_df.reset_index(inplace=True)
306
- temp_df["index"] = temp_df.index + 1
307
- temp_df.rename(columns={"index": "序号"}, inplace=True)
308
288
  temp_df = temp_df[
309
289
  [
310
290
  "序号",
@@ -367,24 +347,20 @@ def stock_bj_a_spot_em() -> pd.DataFrame:
367
347
  url = "https://82.push2.eastmoney.com/api/qt/clist/get"
368
348
  params = {
369
349
  "pn": "1",
370
- "pz": "50000",
350
+ "pz": "100",
371
351
  "po": "1",
372
352
  "np": "1",
373
353
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
374
354
  "fltt": "2",
375
355
  "invt": "2",
376
- "fid": "f3",
356
+ "fid": "f12",
377
357
  "fs": "m:0 t:81 s:2048",
378
358
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24"
379
- ",f25,f22,f11,f62,f128,f136,f115,f152",
380
- "_": "1623833739532",
359
+ ",f25,f22,f11,f62,f128,f136,f115,f152",
381
360
  }
382
- r = requests.get(url, timeout=15, params=params)
383
- data_json = r.json()
384
- if not data_json["data"]["diff"]:
385
- return pd.DataFrame()
386
- temp_df = pd.DataFrame(data_json["data"]["diff"])
361
+ temp_df = fetch_paginated_data(url, params)
387
362
  temp_df.columns = [
363
+ "序号",
388
364
  "_",
389
365
  "最新价",
390
366
  "涨跌幅",
@@ -417,9 +393,6 @@ def stock_bj_a_spot_em() -> pd.DataFrame:
417
393
  "-",
418
394
  "-",
419
395
  ]
420
- temp_df.reset_index(inplace=True)
421
- temp_df["index"] = temp_df.index + 1
422
- temp_df.rename(columns={"index": "序号"}, inplace=True)
423
396
  temp_df = temp_df[
424
397
  [
425
398
  "序号",
@@ -482,7 +455,7 @@ def stock_new_a_spot_em() -> pd.DataFrame:
482
455
  url = "https://82.push2.eastmoney.com/api/qt/clist/get"
483
456
  params = {
484
457
  "pn": "1",
485
- "pz": "50000",
458
+ "pz": "100",
486
459
  "po": "1",
487
460
  "np": "1",
488
461
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
@@ -492,15 +465,11 @@ def stock_new_a_spot_em() -> pd.DataFrame:
492
465
  "fid": "f26",
493
466
  "fs": "m:0 f:8,m:1 f:8",
494
467
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,"
495
- "f25,f26,f22,f11,f62,f128,f136,f115,f152",
496
- "_": "1623833739532",
468
+ "f25,f26,f22,f11,f62,f128,f136,f115,f152",
497
469
  }
498
- r = requests.get(url, timeout=15, params=params)
499
- data_json = r.json()
500
- if not data_json["data"]["diff"]:
501
- return pd.DataFrame()
502
- temp_df = pd.DataFrame(data_json["data"]["diff"])
470
+ temp_df = fetch_paginated_data(url, params)
503
471
  temp_df.columns = [
472
+ "序号",
504
473
  "_",
505
474
  "最新价",
506
475
  "涨跌幅",
@@ -534,9 +503,6 @@ def stock_new_a_spot_em() -> pd.DataFrame:
534
503
  "-",
535
504
  "-",
536
505
  ]
537
- temp_df.reset_index(inplace=True)
538
- temp_df["index"] = temp_df.index + 1
539
- temp_df.rename(columns={"index": "序号"}, inplace=True)
540
506
  temp_df = temp_df[
541
507
  [
542
508
  "序号",
@@ -602,25 +568,21 @@ def stock_cy_a_spot_em() -> pd.DataFrame:
602
568
  url = "https://7.push2.eastmoney.com/api/qt/clist/get"
603
569
  params = {
604
570
  "pn": "1",
605
- "pz": "50000",
571
+ "pz": "100",
606
572
  "po": "1",
607
573
  "np": "1",
608
574
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
609
575
  "fltt": "2",
610
576
  "invt": "2",
611
577
  "wbp2u": "|0|0|0|web",
612
- "fid": "f3",
578
+ "fid": "f12",
613
579
  "fs": "m:0 t:80",
614
580
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,"
615
- "f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
616
- "_": "1623833739532",
581
+ "f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
617
582
  }
618
- r = requests.get(url, timeout=15, params=params)
619
- data_json = r.json()
620
- if not data_json["data"]["diff"]:
621
- return pd.DataFrame()
622
- temp_df = pd.DataFrame(data_json["data"]["diff"])
583
+ temp_df = fetch_paginated_data(url, params)
623
584
  temp_df.columns = [
585
+ "序号",
624
586
  "_",
625
587
  "最新价",
626
588
  "涨跌幅",
@@ -653,9 +615,6 @@ def stock_cy_a_spot_em() -> pd.DataFrame:
653
615
  "-",
654
616
  "-",
655
617
  ]
656
- temp_df.reset_index(inplace=True)
657
- temp_df["index"] = temp_df.index + 1
658
- temp_df.rename(columns={"index": "序号"}, inplace=True)
659
618
  temp_df = temp_df[
660
619
  [
661
620
  "序号",
@@ -718,25 +677,21 @@ def stock_kc_a_spot_em() -> pd.DataFrame:
718
677
  url = "https://7.push2.eastmoney.com/api/qt/clist/get"
719
678
  params = {
720
679
  "pn": "1",
721
- "pz": "50000",
680
+ "pz": "100",
722
681
  "po": "1",
723
682
  "np": "1",
724
683
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
725
684
  "fltt": "2",
726
685
  "invt": "2",
727
686
  "wbp2u": "|0|0|0|web",
728
- "fid": "f3",
687
+ "fid": "f12",
729
688
  "fs": "m:1 t:23",
730
689
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
731
- "f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
732
- "_": "1623833739532",
690
+ "f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
733
691
  }
734
- r = requests.get(url, timeout=15, params=params)
735
- data_json = r.json()
736
- if not data_json["data"]["diff"]:
737
- return pd.DataFrame()
738
- temp_df = pd.DataFrame(data_json["data"]["diff"])
692
+ temp_df = fetch_paginated_data(url, params)
739
693
  temp_df.columns = [
694
+ "序号",
740
695
  "_",
741
696
  "最新价",
742
697
  "涨跌幅",
@@ -769,9 +724,6 @@ def stock_kc_a_spot_em() -> pd.DataFrame:
769
724
  "-",
770
725
  "-",
771
726
  ]
772
- temp_df.reset_index(inplace=True)
773
- temp_df["index"] = temp_df.index + 1
774
- temp_df.rename(columns={"index": "序号"}, inplace=True)
775
727
  temp_df = temp_df[
776
728
  [
777
729
  "序号",
@@ -824,6 +776,69 @@ def stock_kc_a_spot_em() -> pd.DataFrame:
824
776
  return temp_df
825
777
 
826
778
 
779
+ def stock_zh_ab_comparison_em() -> pd.DataFrame:
780
+ """
781
+ 东方财富网-行情中心-沪深京个股-AB股比价-全部AB股比价
782
+ https://quote.eastmoney.com/center/gridlist.html#ab_comparison
783
+ :return: 实时行情
784
+ :rtype: pandas.DataFrame
785
+ """
786
+ url = "https://push2.eastmoney.com/api/qt/clist/get"
787
+ params = {
788
+ "np": "1",
789
+ "fltt": "1",
790
+ "invt": "2",
791
+ "fs": "m:1+b:BK0498,m:0+b:BK0498",
792
+ "fields": "f201,f202,f203,f196,f200,f197,f152,f12,f13,f14,f1,f2,f4,f3,f199",
793
+ "fid": "f199",
794
+ "pn": "1",
795
+ "pz": "100",
796
+ "po": "1",
797
+ "dect": "1",
798
+ "wbp2u": "|0|0|0|web",
799
+ }
800
+ columns_map = {
801
+ "index": "序号",
802
+ "f1": "-",
803
+ "f2": "最新价B",
804
+ "f3": "涨跌幅B",
805
+ "f4": "-",
806
+ "f12": "A股代码",
807
+ "f13": "-",
808
+ "f14": "A股名称",
809
+ "f152": "-",
810
+ "f196": "最新价A",
811
+ "f197": "涨跌幅A",
812
+ "f199": "比价",
813
+ "f200": "-",
814
+ "f201": "B股代码",
815
+ "f202": "-",
816
+ "f203": "B股名称"
817
+ }
818
+ temp_df = fetch_paginated_data(url, params)
819
+ temp_df = temp_df.rename(columns=columns_map)
820
+ list_name = [value for key, value in columns_map.items() if value != "_"]
821
+ temp_df = temp_df[list_name]
822
+ temp_df = temp_df[[
823
+ "序号",
824
+ "B股代码",
825
+ "B股名称",
826
+ "最新价B",
827
+ "涨跌幅B",
828
+ "A股代码",
829
+ "A股名称",
830
+ "最新价A",
831
+ "涨跌幅A",
832
+ "比价",
833
+ ]]
834
+ temp_df["最新价B"] = pd.to_numeric(temp_df["最新价B"], errors="coerce") / 100
835
+ temp_df["涨跌幅B"] = pd.to_numeric(temp_df["涨跌幅B"], errors="coerce") / 100
836
+ temp_df["最新价A"] = pd.to_numeric(temp_df["最新价A"], errors="coerce") / 100
837
+ temp_df["涨跌幅A"] = pd.to_numeric(temp_df["涨跌幅A"], errors="coerce") / 100
838
+ temp_df["比价"] = pd.to_numeric(temp_df["比价"], errors="coerce") / 100
839
+ return temp_df
840
+
841
+
827
842
  def stock_zh_b_spot_em() -> pd.DataFrame:
828
843
  """
829
844
  东方财富网- B 股-实时行情
@@ -834,24 +849,20 @@ def stock_zh_b_spot_em() -> pd.DataFrame:
834
849
  url = "https://28.push2.eastmoney.com/api/qt/clist/get"
835
850
  params = {
836
851
  "pn": "1",
837
- "pz": "50000",
852
+ "pz": "100",
838
853
  "po": "1",
839
854
  "np": "1",
840
855
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
841
856
  "fltt": "2",
842
857
  "invt": "2",
843
- "fid": "f3",
858
+ "fid": "f12",
844
859
  "fs": "m:0 t:7,m:1 t:3",
845
860
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20"
846
- ",f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
847
- "_": "1623833739532",
861
+ ",f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
848
862
  }
849
- r = requests.get(url, timeout=15, params=params)
850
- data_json = r.json()
851
- if not data_json["data"]["diff"]:
852
- return pd.DataFrame()
853
- temp_df = pd.DataFrame(data_json["data"]["diff"])
863
+ temp_df = fetch_paginated_data(url, params)
854
864
  temp_df.columns = [
865
+ "序号",
855
866
  "_",
856
867
  "最新价",
857
868
  "涨跌幅",
@@ -884,9 +895,6 @@ def stock_zh_b_spot_em() -> pd.DataFrame:
884
895
  "-",
885
896
  "-",
886
897
  ]
887
- temp_df.reset_index(inplace=True)
888
- temp_df["index"] = temp_df.index + 1
889
- temp_df.rename(columns={"index": "序号"}, inplace=True)
890
898
  temp_df = temp_df[
891
899
  [
892
900
  "序号",
@@ -939,79 +947,6 @@ def stock_zh_b_spot_em() -> pd.DataFrame:
939
947
  return temp_df
940
948
 
941
949
 
942
- @lru_cache()
943
- def code_id_map_em() -> dict:
944
- """
945
- 东方财富-股票和市场代码
946
- https://quote.eastmoney.com/center/gridlist.html#hs_a_board
947
- :return: 股票和市场代码
948
- :rtype: dict
949
- """
950
- url = "https://80.push2.eastmoney.com/api/qt/clist/get"
951
- params = {
952
- "pn": "1",
953
- "pz": "50000",
954
- "po": "1",
955
- "np": "1",
956
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
957
- "fltt": "2",
958
- "invt": "2",
959
- "fid": "f3",
960
- "fs": "m:1 t:2,m:1 t:23",
961
- "fields": "f12",
962
- "_": "1623833739532",
963
- }
964
- r = requests.get(url, timeout=15, params=params)
965
- data_json = r.json()
966
- if not data_json["data"]["diff"]:
967
- return dict()
968
- temp_df = pd.DataFrame(data_json["data"]["diff"])
969
- temp_df["market_id"] = 1
970
- temp_df.columns = ["sh_code", "sh_id"]
971
- code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"]))
972
- params = {
973
- "pn": "1",
974
- "pz": "50000",
975
- "po": "1",
976
- "np": "1",
977
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
978
- "fltt": "2",
979
- "invt": "2",
980
- "fid": "f3",
981
- "fs": "m:0 t:6,m:0 t:80",
982
- "fields": "f12",
983
- "_": "1623833739532",
984
- }
985
- r = requests.get(url, timeout=15, params=params)
986
- data_json = r.json()
987
- if not data_json["data"]["diff"]:
988
- return dict()
989
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
990
- temp_df_sz["sz_id"] = 0
991
- code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"])))
992
- params = {
993
- "pn": "1",
994
- "pz": "50000",
995
- "po": "1",
996
- "np": "1",
997
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
998
- "fltt": "2",
999
- "invt": "2",
1000
- "fid": "f3",
1001
- "fs": "m:0 t:81 s:2048",
1002
- "fields": "f12",
1003
- "_": "1623833739532",
1004
- }
1005
- r = requests.get(url, timeout=15, params=params)
1006
- data_json = r.json()
1007
- if not data_json["data"]["diff"]:
1008
- return dict()
1009
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
1010
- temp_df_sz["bj_id"] = 0
1011
- code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["bj_id"])))
1012
- return code_id_dict
1013
-
1014
-
1015
950
  def stock_zh_a_hist(
1016
951
  symbol: str = "000001",
1017
952
  period: str = "daily",
@@ -1038,7 +973,7 @@ def stock_zh_a_hist(
1038
973
  :return: 每日行情
1039
974
  :rtype: pandas.DataFrame
1040
975
  """
1041
- code_id_dict = code_id_map_em()
976
+ market_code = 1 if symbol.startswith("6") else 0
1042
977
  adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
1043
978
  period_dict = {"daily": "101", "weekly": "102", "monthly": "103"}
1044
979
  url = "https://push2his.eastmoney.com/api/qt/stock/kline/get"
@@ -1048,16 +983,16 @@ def stock_zh_a_hist(
1048
983
  "ut": "7eea3edcaed734bea9cbfc24409ed989",
1049
984
  "klt": period_dict[period],
1050
985
  "fqt": adjust_dict[adjust],
1051
- "secid": f"{code_id_dict[symbol]}.{symbol}",
986
+ "secid": f"{market_code}.{symbol}",
1052
987
  "beg": start_date,
1053
988
  "end": end_date,
1054
- "_": "1623766962675",
1055
989
  }
1056
990
  r = requests.get(url, params=params, timeout=timeout)
1057
991
  data_json = r.json()
1058
992
  if not (data_json["data"] and data_json["data"]["klines"]):
1059
993
  return pd.DataFrame()
1060
994
  temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
995
+ temp_df["股票代码"] = symbol
1061
996
  temp_df.columns = [
1062
997
  "日期",
1063
998
  "开盘",
@@ -1070,6 +1005,7 @@ def stock_zh_a_hist(
1070
1005
  "涨跌幅",
1071
1006
  "涨跌额",
1072
1007
  "换手率",
1008
+ "股票代码",
1073
1009
  ]
1074
1010
  temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
1075
1011
  temp_df["开盘"] = pd.to_numeric(temp_df["开盘"], errors="coerce")
@@ -1082,6 +1018,22 @@ def stock_zh_a_hist(
1082
1018
  temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
1083
1019
  temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
1084
1020
  temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
1021
+ temp_df = temp_df[
1022
+ [
1023
+ "日期",
1024
+ "股票代码",
1025
+ "开盘",
1026
+ "收盘",
1027
+ "最高",
1028
+ "最低",
1029
+ "成交量",
1030
+ "成交额",
1031
+ "振幅",
1032
+ "涨跌幅",
1033
+ "涨跌额",
1034
+ "换手率",
1035
+ ]
1036
+ ]
1085
1037
  return temp_df
1086
1038
 
1087
1039
 
@@ -1108,7 +1060,7 @@ def stock_zh_a_hist_min_em(
1108
1060
  :return: 每日分时行情
1109
1061
  :rtype: pandas.DataFrame
1110
1062
  """
1111
- code_id_dict = code_id_map_em()
1063
+ market_code = 1 if symbol.startswith("6") else 0
1112
1064
  adjust_map = {
1113
1065
  "": "0",
1114
1066
  "qfq": "1",
@@ -1122,8 +1074,7 @@ def stock_zh_a_hist_min_em(
1122
1074
  "ut": "7eea3edcaed734bea9cbfc24409ed989",
1123
1075
  "ndays": "5",
1124
1076
  "iscr": "0",
1125
- "secid": f"{code_id_dict[symbol]}.{symbol}",
1126
- "_": "1623766962675",
1077
+ "secid": f"{market_code}.{symbol}",
1127
1078
  }
1128
1079
  r = requests.get(url, timeout=15, params=params)
1129
1080
  data_json = r.json()
@@ -1160,10 +1111,9 @@ def stock_zh_a_hist_min_em(
1160
1111
  "ut": "7eea3edcaed734bea9cbfc24409ed989",
1161
1112
  "klt": period,
1162
1113
  "fqt": adjust_map[adjust],
1163
- "secid": f"{code_id_dict[symbol]}.{symbol}",
1114
+ "secid": f"{market_code}.{symbol}",
1164
1115
  "beg": "0",
1165
1116
  "end": "20500000",
1166
- "_": "1630930917857",
1167
1117
  }
1168
1118
  r = requests.get(url, timeout=15, params=params)
1169
1119
  data_json = r.json()
@@ -1232,17 +1182,15 @@ def stock_zh_a_hist_pre_min_em(
1232
1182
  :return: 每日分时行情包含盘前数据
1233
1183
  :rtype: pandas.DataFrame
1234
1184
  """
1235
- code_id_dict = code_id_map_em()
1185
+ market_code = 1 if symbol.startswith("6") else 0
1236
1186
  url = "https://push2.eastmoney.com/api/qt/stock/trends2/get"
1237
1187
  params = {
1238
1188
  "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
1239
1189
  "fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
1240
- "ut": "fa5fd1943c7b386f172d6893dbfba10b",
1241
1190
  "ndays": "1",
1242
1191
  "iscr": "1",
1243
1192
  "iscca": "0",
1244
- "secid": f"{code_id_dict[symbol]}.{symbol}",
1245
- "_": "1623766962675",
1193
+ "secid": f"{market_code}.{symbol}",
1246
1194
  }
1247
1195
  r = requests.get(url, timeout=15, params=params)
1248
1196
  data_json = r.json()
@@ -1259,7 +1207,7 @@ def stock_zh_a_hist_pre_min_em(
1259
1207
  ]
1260
1208
  temp_df.index = pd.to_datetime(temp_df["时间"])
1261
1209
  date_format = temp_df.index[0].date().isoformat()
1262
- temp_df = temp_df[date_format + " " + start_time : date_format + " " + end_time]
1210
+ temp_df = temp_df[date_format + " " + start_time: date_format + " " + end_time]
1263
1211
  temp_df.reset_index(drop=True, inplace=True)
1264
1212
  temp_df["开盘"] = pd.to_numeric(temp_df["开盘"], errors="coerce")
1265
1213
  temp_df["收盘"] = pd.to_numeric(temp_df["收盘"], errors="coerce")
@@ -1282,22 +1230,20 @@ def stock_hk_spot_em() -> pd.DataFrame:
1282
1230
  url = "https://72.push2.eastmoney.com/api/qt/clist/get"
1283
1231
  params = {
1284
1232
  "pn": "1",
1285
- "pz": "50000",
1233
+ "pz": "100",
1286
1234
  "po": "1",
1287
1235
  "np": "1",
1288
1236
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
1289
1237
  "fltt": "2",
1290
1238
  "invt": "2",
1291
- "fid": "f3",
1239
+ "fid": "f12",
1292
1240
  "fs": "m:128 t:3,m:128 t:4,m:128 t:1,m:128 t:2",
1293
1241
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
1294
- "f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
1295
- "_": "1624010056945",
1242
+ "f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
1296
1243
  }
1297
- r = requests.get(url, timeout=15, params=params)
1298
- data_json = r.json()
1299
- temp_df = pd.DataFrame(data_json["data"]["diff"])
1244
+ temp_df = fetch_paginated_data(url, params)
1300
1245
  temp_df.columns = [
1246
+ "序号",
1301
1247
  "_",
1302
1248
  "最新价",
1303
1249
  "涨跌幅",
@@ -1330,9 +1276,6 @@ def stock_hk_spot_em() -> pd.DataFrame:
1330
1276
  "_",
1331
1277
  "_",
1332
1278
  ]
1333
- temp_df.reset_index(inplace=True)
1334
- temp_df["index"] = temp_df.index + 1
1335
- temp_df.rename(columns={"index": "序号"}, inplace=True)
1336
1279
  temp_df = temp_df[
1337
1280
  [
1338
1281
  "序号",
@@ -1372,22 +1315,20 @@ def stock_hk_main_board_spot_em() -> pd.DataFrame:
1372
1315
  url = "https://81.push2.eastmoney.com/api/qt/clist/get"
1373
1316
  params = {
1374
1317
  "pn": "1",
1375
- "pz": "50000",
1318
+ "pz": "100",
1376
1319
  "po": "1",
1377
1320
  "np": "1",
1378
1321
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
1379
1322
  "fltt": "2",
1380
1323
  "invt": "2",
1381
- "fid": "f3",
1324
+ "fid": "f12",
1382
1325
  "fs": "m:128 t:3",
1383
1326
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
1384
- "f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
1385
- "_": "1624010056945",
1327
+ "f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
1386
1328
  }
1387
- r = requests.get(url, timeout=15, params=params)
1388
- data_json = r.json()
1389
- temp_df = pd.DataFrame(data_json["data"]["diff"])
1329
+ temp_df = fetch_paginated_data(url, params)
1390
1330
  temp_df.columns = [
1331
+ "序号",
1391
1332
  "_",
1392
1333
  "最新价",
1393
1334
  "涨跌幅",
@@ -1420,9 +1361,6 @@ def stock_hk_main_board_spot_em() -> pd.DataFrame:
1420
1361
  "_",
1421
1362
  "_",
1422
1363
  ]
1423
- temp_df.reset_index(inplace=True)
1424
- temp_df["index"] = temp_df.index + 1
1425
- temp_df.rename(columns={"index": "序号"}, inplace=True)
1426
1364
  temp_df = temp_df[
1427
1365
  [
1428
1366
  "序号",
@@ -1480,14 +1418,12 @@ def stock_hk_hist(
1480
1418
  url = "https://33.push2his.eastmoney.com/api/qt/stock/kline/get"
1481
1419
  params = {
1482
1420
  "secid": f"116.{symbol}",
1483
- "ut": "fa5fd1943c7b386f172d6893dbfba10b",
1484
1421
  "fields1": "f1,f2,f3,f4,f5,f6",
1485
1422
  "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
1486
1423
  "klt": period_dict[period],
1487
1424
  "fqt": adjust_dict[adjust],
1488
1425
  "end": "20500000",
1489
1426
  "lmt": "1000000",
1490
- "_": "1623766962675",
1491
1427
  }
1492
1428
  r = requests.get(url, timeout=15, params=params)
1493
1429
  data_json = r.json()
@@ -1559,11 +1495,9 @@ def stock_hk_hist_min_em(
1559
1495
  params = {
1560
1496
  "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
1561
1497
  "fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
1562
- "ut": "fa5fd1943c7b386f172d6893dbfba10b",
1563
1498
  "iscr": "0",
1564
1499
  "ndays": "5",
1565
1500
  "secid": f"116.{symbol}",
1566
- "_": "1623766962675",
1567
1501
  }
1568
1502
  r = requests.get(url, timeout=15, params=params)
1569
1503
  data_json = r.json()
@@ -1603,7 +1537,6 @@ def stock_hk_hist_min_em(
1603
1537
  "secid": f"116.{symbol}",
1604
1538
  "beg": "0",
1605
1539
  "end": "20500000",
1606
- "_": "1630930917857",
1607
1540
  }
1608
1541
  r = requests.get(url, timeout=15, params=params)
1609
1542
  data_json = r.json()
@@ -1665,22 +1598,20 @@ def stock_us_spot_em() -> pd.DataFrame:
1665
1598
  url = "https://72.push2.eastmoney.com/api/qt/clist/get"
1666
1599
  params = {
1667
1600
  "pn": "1",
1668
- "pz": "20000",
1601
+ "pz": "100",
1669
1602
  "po": "1",
1670
1603
  "np": "1",
1671
1604
  "ut": "bd1d9ddb04089700cf9c27f6f7426281",
1672
1605
  "fltt": "2",
1673
1606
  "invt": "2",
1674
- "fid": "f3",
1607
+ "fid": "f12",
1675
1608
  "fs": "m:105,m:106,m:107",
1676
1609
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
1677
- "f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152",
1678
- "_": "1624010056945",
1610
+ "f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152",
1679
1611
  }
1680
- r = requests.get(url, timeout=15, params=params)
1681
- data_json = r.json()
1682
- temp_df = pd.DataFrame(data_json["data"]["diff"])
1612
+ temp_df = fetch_paginated_data(url, params)
1683
1613
  temp_df.columns = [
1614
+ "序号",
1684
1615
  "_",
1685
1616
  "最新价",
1686
1617
  "涨跌幅",
@@ -1715,9 +1646,6 @@ def stock_us_spot_em() -> pd.DataFrame:
1715
1646
  "_",
1716
1647
  "_",
1717
1648
  ]
1718
- temp_df.reset_index(inplace=True)
1719
- temp_df["index"] = range(1, len(temp_df) + 1)
1720
- temp_df.rename(columns={"index": "序号"}, inplace=True)
1721
1649
  temp_df["代码"] = temp_df["编码"].astype(str) + "." + temp_df["简称"]
1722
1650
  temp_df = temp_df[
1723
1651
  [
@@ -1783,14 +1711,12 @@ def stock_us_hist(
1783
1711
  url = "https://63.push2his.eastmoney.com/api/qt/stock/kline/get"
1784
1712
  params = {
1785
1713
  "secid": f"{symbol}",
1786
- "ut": "fa5fd1943c7b386f172d6893dbfba10b",
1787
1714
  "fields1": "f1,f2,f3,f4,f5,f6",
1788
1715
  "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",
1789
1716
  "klt": period_dict[period],
1790
1717
  "fqt": adjust_dict[adjust],
1791
1718
  "end": "20500000",
1792
1719
  "lmt": "1000000",
1793
- "_": "1623766962675",
1794
1720
  }
1795
1721
  r = requests.get(url, timeout=15, params=params)
1796
1722
  data_json = r.json()
@@ -1848,13 +1774,11 @@ def stock_us_hist_min_em(
1848
1774
  params = {
1849
1775
  "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",
1850
1776
  "fields2": "f51,f52,f53,f54,f55,f56,f57,f58",
1851
- "ut": "fa5fd1943c7b386f172d6893dbfba10b",
1852
1777
  "iscr": "0",
1853
1778
  "ndays": "5",
1854
1779
  "secid": f"{symbol.split('.')[0]}.{symbol.split('.')[1]}",
1855
- "_": "1623766962675",
1856
1780
  }
1857
- r = requests.get(url, timeout=15, params=params)
1781
+ r = requests.get(url, params=params, timeout=15)
1858
1782
  data_json = r.json()
1859
1783
  if not data_json["data"]["trends"]:
1860
1784
  return pd.DataFrame()
@@ -1879,7 +1803,7 @@ def stock_us_hist_min_em(
1879
1803
  temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
1880
1804
  temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
1881
1805
  temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
1882
- temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
1806
+ temp_df["时间"] = pd.to_datetime(temp_df["时间"], errors="coerce").astype(str)
1883
1807
  return temp_df
1884
1808
 
1885
1809
 
@@ -1908,9 +1832,6 @@ if __name__ == "__main__":
1908
1832
  stock_zh_b_spot_em_df = stock_zh_b_spot_em()
1909
1833
  print(stock_zh_b_spot_em_df)
1910
1834
 
1911
- code_id_map_em_df = code_id_map_em()
1912
- print(code_id_map_em_df)
1913
-
1914
1835
  stock_hk_spot_em_df = stock_hk_spot_em()
1915
1836
  print(stock_hk_spot_em_df)
1916
1837
 
@@ -1918,11 +1839,11 @@ if __name__ == "__main__":
1918
1839
  print(stock_hk_main_board_spot_em_df)
1919
1840
 
1920
1841
  stock_zh_a_hist_df = stock_zh_a_hist(
1921
- symbol="000001",
1842
+ symbol="600734",
1922
1843
  period="daily",
1923
- start_date="20170301",
1924
- end_date="20231030",
1925
- adjust="",
1844
+ start_date="20050501",
1845
+ end_date="20250304",
1846
+ adjust="hfq",
1926
1847
  )
1927
1848
  print(stock_zh_a_hist_df)
1928
1849
 
@@ -1987,9 +1908,9 @@ if __name__ == "__main__":
1987
1908
  print(stock_us_hist_min_em_df)
1988
1909
 
1989
1910
  stock_zh_a_hist_min_em_df = stock_zh_a_hist_min_em(
1990
- symbol="000001",
1991
- start_date="2024-03-20 09:30:00",
1992
- end_date="2024-03-20 15:00:00",
1911
+ symbol="300364",
1912
+ start_date="2025-03-07 09:30:00",
1913
+ end_date="2025-03-07 15:00:00",
1993
1914
  period="5",
1994
1915
  adjust="hfq",
1995
1916
  )
@@ -1999,7 +1920,7 @@ if __name__ == "__main__":
1999
1920
  symbol="833454",
2000
1921
  period="daily",
2001
1922
  start_date="20170301",
2002
- end_date="20211115",
1923
+ end_date="20241115",
2003
1924
  adjust="hfq",
2004
1925
  )
2005
1926
  print(stock_zh_a_hist_df)
@@ -2008,8 +1929,8 @@ if __name__ == "__main__":
2008
1929
  symbol="01611",
2009
1930
  period="1",
2010
1931
  adjust="",
2011
- start_date="2024-04-12 09:30:00",
2012
- end_date="2024-04-12 18:32:00",
1932
+ start_date="2025-03-07 09:30:00",
1933
+ end_date="2025-03-07 18:32:00",
2013
1934
  )
2014
1935
  print(stock_hk_hist_min_em_df)
2015
1936