akshare 1.14.49__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 (343) hide show
  1. akshare/__init__.py +595 -129
  2. akshare/air/air_hebei.py +77 -54
  3. akshare/air/air_zhenqi.py +0 -4
  4. akshare/air/cons.py +1 -0
  5. akshare/air/crypto.js +1 -1
  6. akshare/air/outcrypto.js +1 -1
  7. akshare/article/cons.py +1 -0
  8. akshare/article/epu_index.py +4 -3
  9. akshare/article/ff_factor.py +19 -8
  10. akshare/article/fred_md.py +4 -1
  11. akshare/article/risk_rv.py +3 -8
  12. akshare/bank/bank_cbirc_2020.py +11 -11
  13. akshare/bank/cons.py +7 -6
  14. akshare/bond/bond_buy_back_em.py +228 -0
  15. akshare/bond/bond_cb_sina.py +1 -0
  16. akshare/bond/bond_cb_ths.py +17 -9
  17. akshare/bond/bond_cbond.py +19 -14
  18. akshare/bond/bond_china.py +38 -39
  19. akshare/bond/bond_china_money.py +1 -1
  20. akshare/bond/bond_convert.py +10 -9
  21. akshare/bond/bond_em.py +37 -17
  22. akshare/bond/bond_summary.py +38 -37
  23. akshare/bond/bond_zh_cov.py +31 -40
  24. akshare/bond/bond_zh_sina.py +4 -0
  25. akshare/bond/cons.py +14 -11
  26. akshare/cal/__init__.py +0 -0
  27. akshare/cal/rv.py +170 -0
  28. akshare/cost/cost_living.py +7 -5
  29. akshare/crypto/__init__.py +1 -1
  30. akshare/crypto/crypto_bitcoin_cme.py +9 -7
  31. akshare/crypto/crypto_hold.py +4 -2
  32. akshare/currency/currency.py +1 -0
  33. akshare/currency/currency_china_bank_sina.py +11 -6
  34. akshare/data/__init__.py +1 -1
  35. akshare/data/cninfo.js +1 -1
  36. akshare/datasets.py +10 -21
  37. akshare/economic/cons.py +10 -3
  38. akshare/economic/macro_australia.py +74 -69
  39. akshare/economic/macro_bank.py +95 -653
  40. akshare/economic/macro_canada.py +92 -81
  41. akshare/economic/macro_china.py +97 -105
  42. akshare/economic/macro_china_hk.py +0 -1
  43. akshare/economic/macro_euro.py +103 -56
  44. akshare/economic/macro_finance_ths.py +7 -5
  45. akshare/economic/macro_germany.py +1 -1
  46. akshare/economic/macro_japan.py +0 -1
  47. akshare/economic/macro_other.py +1 -6
  48. akshare/economic/macro_swiss.py +2 -3
  49. akshare/economic/macro_uk.py +1 -1
  50. akshare/economic/macro_usa.py +7 -9
  51. akshare/economic/marco_cnbs.py +11 -6
  52. akshare/energy/energy_carbon.py +0 -1
  53. akshare/energy/energy_oil_em.py +1 -2
  54. akshare/event/cons.py +1 -0
  55. akshare/exceptions.py +43 -0
  56. akshare/file_fold/calendar.json +245 -2
  57. akshare/forex/__init__.py +0 -0
  58. akshare/forex/cons.py +192 -0
  59. akshare/forex/forex_em.py +149 -0
  60. akshare/fortune/fortune_500.py +1 -37
  61. akshare/fortune/fortune_bloomberg.py +6 -3
  62. akshare/fortune/fortune_forbes_500.py +3 -6
  63. akshare/fortune/fortune_hurun.py +2 -1
  64. akshare/fortune/fortune_xincaifu_500.py +17 -14
  65. akshare/fund/fund_announcement_em.py +145 -0
  66. akshare/fund/fund_aum_em.py +49 -35
  67. akshare/fund/fund_em.py +251 -220
  68. akshare/fund/fund_etf_em.py +44 -35
  69. akshare/fund/fund_etf_sina.py +75 -27
  70. akshare/fund/fund_etf_ths.py +2 -0
  71. akshare/fund/fund_fee_em.py +172 -0
  72. akshare/fund/fund_fhsp_em.py +42 -32
  73. akshare/fund/fund_init_em.py +8 -5
  74. akshare/fund/fund_lof_em.py +12 -19
  75. akshare/fund/fund_manager.py +25 -11
  76. akshare/fund/fund_overview_em.py +42 -0
  77. akshare/fund/fund_portfolio_em.py +23 -21
  78. akshare/fund/fund_position_lg.py +19 -8
  79. akshare/fund/fund_rank_em.py +2 -5
  80. akshare/fund/fund_rating.py +33 -12
  81. akshare/fund/fund_scale_em.py +24 -13
  82. akshare/fund/fund_scale_sina.py +20 -10
  83. akshare/fund/fund_xq.py +3 -2
  84. akshare/futures/cons.py +135 -39
  85. akshare/futures/cot.py +55 -56
  86. akshare/futures/futures_basis.py +49 -11
  87. akshare/futures/futures_comex_em.py +1 -0
  88. akshare/futures/futures_comm_ctp.py +1 -1
  89. akshare/futures/futures_contract_detail.py +59 -9
  90. akshare/futures/futures_daily_bar.py +66 -59
  91. akshare/futures/futures_foreign.py +14 -8
  92. akshare/futures/futures_hf_em.py +215 -61
  93. akshare/futures/futures_hist_em.py +191 -0
  94. akshare/futures/futures_hq_sina.py +5 -3
  95. akshare/futures/futures_index_ccidx.py +24 -82
  96. akshare/futures/futures_inventory_99.py +70 -272
  97. akshare/futures/futures_inventory_em.py +14 -11
  98. akshare/futures/futures_news_shmet.py +2 -2
  99. akshare/futures/futures_roll_yield.py +11 -24
  100. akshare/futures/futures_rule.py +7 -3
  101. akshare/futures/futures_rule_em.py +38 -0
  102. akshare/futures/futures_settlement_price_sgx.py +21 -6
  103. akshare/futures/futures_stock_js.py +0 -1
  104. akshare/futures/futures_to_spot.py +5 -6
  105. akshare/futures/futures_warehouse_receipt.py +48 -47
  106. akshare/futures/futures_zh_sina.py +3 -3
  107. akshare/futures/receipt.py +298 -165
  108. akshare/futures/requests_fun.py +16 -3
  109. akshare/futures/symbol_var.py +32 -13
  110. akshare/futures_derivative/cons.py +100 -103
  111. akshare/futures_derivative/futures_contract_info_cffex.py +55 -39
  112. akshare/futures_derivative/futures_contract_info_czce.py +2 -0
  113. akshare/futures_derivative/futures_contract_info_dce.py +43 -17
  114. akshare/futures_derivative/futures_contract_info_gfex.py +43 -31
  115. akshare/futures_derivative/futures_contract_info_ine.py +43 -34
  116. akshare/futures_derivative/futures_contract_info_shfe.py +3 -4
  117. akshare/futures_derivative/futures_cot_sina.py +8 -6
  118. akshare/futures_derivative/futures_index_sina.py +25 -13
  119. akshare/fx/cons.py +12 -7
  120. akshare/fx/fx_c_swap_cm.py +62 -0
  121. akshare/fx/fx_quote.py +3 -2
  122. akshare/fx/fx_quote_baidu.py +2 -1
  123. akshare/hf/__init__.py +1 -1
  124. akshare/hf/hf_sp500.py +8 -7
  125. akshare/index/cons.py +132 -28
  126. akshare/index/index_cni.py +7 -7
  127. akshare/index/index_cons.py +2 -2
  128. akshare/index/index_csindex.py +68 -0
  129. akshare/index/index_cx.py +20 -20
  130. akshare/index/index_drewry.py +17 -16
  131. akshare/index/index_eri.py +1 -0
  132. akshare/index/index_global_em.py +167 -0
  133. akshare/index/index_global_sina.py +82 -0
  134. akshare/index/index_kq_fz.py +17 -14
  135. akshare/index/index_kq_ss.py +1 -0
  136. akshare/index/index_option_qvix.py +351 -16
  137. akshare/index/index_research_sw.py +21 -21
  138. akshare/index/index_spot.py +9 -5
  139. akshare/index/index_stock_hk.py +5 -9
  140. akshare/index/index_stock_zh.py +111 -24
  141. akshare/index/index_stock_zh_csindex.py +3 -367
  142. akshare/index/index_sugar.py +18 -4
  143. akshare/index/index_sw.py +10 -2
  144. akshare/index/index_yw.py +53 -75
  145. akshare/index/index_zh_em.py +15 -82
  146. akshare/interest_rate/interbank_rate_em.py +0 -1
  147. akshare/movie/jm.js +0 -1
  148. akshare/news/__init__.py +1 -1
  149. akshare/news/news_baidu.py +395 -222
  150. akshare/news/news_stock.py +49 -16
  151. akshare/option/cons.py +2 -2
  152. akshare/option/option_commodity.py +341 -220
  153. akshare/option/option_commodity_sina.py +22 -26
  154. akshare/option/option_contract_info_ctp.py +63 -0
  155. akshare/option/option_current_sse.py +61 -0
  156. akshare/option/option_current_szse.py +84 -0
  157. akshare/option/option_czce.py +37 -9
  158. akshare/option/option_daily_stats_sse_szse.py +0 -1
  159. akshare/option/option_em.py +4 -8
  160. akshare/option/option_finance.py +60 -12
  161. akshare/option/option_finance_sina.py +7 -7
  162. akshare/option/option_lhb_em.py +0 -1
  163. akshare/option/option_margin.py +62 -0
  164. akshare/option/option_premium_analysis_em.py +58 -53
  165. akshare/option/option_risk_analysis_em.py +11 -8
  166. akshare/option/option_risk_indicator_sse.py +3 -4
  167. akshare/option/option_value_analysis_em.py +62 -55
  168. akshare/other/__init__.py +1 -1
  169. akshare/pro/__init__.py +0 -1
  170. akshare/pro/client.py +6 -4
  171. akshare/pro/cons.py +3 -2
  172. akshare/pro/data_pro.py +6 -5
  173. akshare/qdii/__init__.py +0 -0
  174. akshare/qdii/qdii_jsl.py +233 -0
  175. akshare/qhkc/__init__.py +1 -6
  176. akshare/qhkc/qhkc_api.py +64 -22
  177. akshare/qhkc_web/__init__.py +1 -6
  178. akshare/qhkc_web/qhkc_fund.py +10 -6
  179. akshare/qhkc_web/qhkc_index.py +28 -14
  180. akshare/qhkc_web/qhkc_tool.py +62 -59
  181. akshare/rate/__init__.py +1 -1
  182. akshare/rate/repo_rate.py +36 -32
  183. akshare/reits/__init__.py +1 -1
  184. akshare/reits/reits_basic.py +149 -13
  185. akshare/request.py +117 -0
  186. akshare/spot/__init__.py +1 -1
  187. akshare/spot/spot_hog_soozhu.py +165 -3
  188. akshare/spot/spot_sge.py +70 -9
  189. akshare/stock/cons.py +60 -23
  190. akshare/stock/stock_allotment_cninfo.py +8 -8
  191. akshare/stock/stock_ask_bid_em.py +3 -78
  192. akshare/stock/stock_board_concept_em.py +160 -35
  193. akshare/stock/stock_board_industry_em.py +163 -70
  194. akshare/stock/stock_dividend_cninfo.py +31 -17
  195. akshare/stock/stock_dzjy_em.py +347 -260
  196. akshare/stock/stock_fund_em.py +72 -64
  197. akshare/stock/stock_fund_hold.py +1 -2
  198. akshare/stock/stock_gsrl_em.py +1 -0
  199. akshare/stock/stock_hk_comparison_em.py +175 -0
  200. akshare/stock/stock_hk_famous.py +4 -5
  201. akshare/stock/stock_hk_fhpx_ths.py +2 -1
  202. akshare/stock/stock_hk_hot_rank_em.py +1 -0
  203. akshare/stock/stock_hk_sina.py +84 -36
  204. akshare/stock/stock_hold_control_cninfo.py +82 -0
  205. akshare/stock/stock_hold_control_em.py +0 -2
  206. akshare/stock/stock_hot_rank_em.py +4 -1
  207. akshare/stock/stock_hot_search_baidu.py +32 -19
  208. akshare/stock/stock_hot_up_em.py +4 -1
  209. akshare/stock/stock_hsgt_em.py +155 -0
  210. akshare/stock/stock_industry.py +1 -0
  211. akshare/stock/stock_industry_cninfo.py +1 -2
  212. akshare/stock/stock_info.py +6 -4
  213. akshare/stock/stock_info_em.py +17 -11
  214. akshare/stock/stock_intraday_em.py +4 -78
  215. akshare/stock/stock_intraday_sina.py +2 -2
  216. akshare/stock/stock_news_cx.py +39 -0
  217. akshare/stock/stock_profile_cninfo.py +7 -7
  218. akshare/stock/stock_profile_em.py +302 -0
  219. akshare/stock/stock_rank_forecast.py +6 -5
  220. akshare/stock/stock_repurchase_em.py +7 -2
  221. akshare/stock/stock_share_changes_cninfo.py +7 -5
  222. akshare/stock/stock_share_hold.py +24 -20
  223. akshare/stock/stock_stop.py +6 -6
  224. akshare/stock/stock_summary.py +153 -417
  225. akshare/stock/stock_us_famous.py +5 -6
  226. akshare/stock/stock_us_js.py +3 -2
  227. akshare/stock/stock_us_pink.py +38 -27
  228. akshare/stock/stock_us_sina.py +7 -3
  229. akshare/stock/stock_weibo_nlp.py +18 -20
  230. akshare/stock/stock_xq.py +24 -22
  231. akshare/stock/stock_zh_a_sina.py +8 -5
  232. akshare/stock/stock_zh_a_special.py +240 -243
  233. akshare/stock/stock_zh_a_tick_tx.py +11 -3
  234. akshare/stock/stock_zh_ah_tx.py +23 -26
  235. akshare/stock/stock_zh_b_sina.py +2 -2
  236. akshare/stock/stock_zh_comparison_em.py +250 -0
  237. akshare/stock/stock_zh_kcb_sina.py +67 -64
  238. akshare/stock_a/__init__.py +0 -0
  239. akshare/stock_a/stock_board_concept_name_em.py +170 -0
  240. akshare/stock_a/stock_individual_fund_flow_rank.py +258 -0
  241. akshare/stock_a/stock_zh_a_spot.py +212 -0
  242. akshare/stock_feature/cons.py +1 -0
  243. akshare/stock_feature/stock_a_indicator.py +9 -54
  244. akshare/stock_feature/stock_a_pe_and_pb.py +23 -5
  245. akshare/stock_feature/stock_account_em.py +0 -1
  246. akshare/stock_feature/stock_all_pb.py +2 -1
  247. akshare/stock_feature/stock_analyst_em.py +36 -30
  248. akshare/stock_feature/stock_board_concept_ths.py +328 -0
  249. akshare/stock_feature/stock_board_industry_ths.py +57 -2
  250. akshare/stock_feature/stock_buffett_index_lg.py +10 -8
  251. akshare/stock_feature/stock_classify_sina.py +3 -6
  252. akshare/stock_feature/stock_comment_em.py +81 -144
  253. akshare/stock_feature/stock_congestion_lg.py +2 -1
  254. akshare/stock_feature/stock_cyq_em.py +5 -11
  255. akshare/stock_feature/stock_disclosure_cninfo.py +6 -6
  256. akshare/stock_feature/stock_dxsyl_em.py +121 -74
  257. akshare/stock_feature/stock_ebs_lg.py +5 -4
  258. akshare/stock_feature/stock_esg_sina.py +29 -7
  259. akshare/stock_feature/stock_fhps_em.py +2 -1
  260. akshare/stock_feature/stock_fhps_ths.py +15 -7
  261. akshare/stock_feature/stock_fund_flow.py +30 -22
  262. akshare/stock_feature/stock_gddh_em.py +19 -11
  263. akshare/stock_feature/stock_gdfx_em.py +226 -113
  264. akshare/stock_feature/stock_gdhs.py +75 -50
  265. akshare/stock_feature/stock_gdzjc_em.py +21 -10
  266. akshare/stock_feature/stock_gpzy_em.py +78 -46
  267. akshare/stock_feature/stock_gxl_lg.py +3 -2
  268. akshare/stock_feature/stock_hist_em.py +137 -234
  269. akshare/stock_feature/stock_hist_tx.py +13 -10
  270. akshare/stock_feature/stock_hk_valuation_baidu.py +20 -8
  271. akshare/stock_feature/stock_hot_xq.py +4 -6
  272. akshare/stock_feature/stock_hsgt_em.py +269 -97
  273. akshare/stock_feature/stock_hsgt_exchange_rate.py +115 -87
  274. akshare/stock_feature/stock_hsgt_min_em.py +13 -16
  275. akshare/stock_feature/stock_info.py +7 -80
  276. akshare/stock_feature/stock_inner_trade_xq.py +38 -31
  277. akshare/stock_feature/stock_jgdy_em.py +43 -40
  278. akshare/stock_feature/stock_lhb_em.py +119 -3
  279. akshare/stock_feature/stock_margin_em.py +0 -1
  280. akshare/stock_feature/stock_margin_sse.py +0 -2
  281. akshare/stock_feature/stock_pankou_em.py +71 -35
  282. akshare/stock_feature/stock_qsjy_em.py +13 -4
  283. akshare/stock_feature/stock_report_em.py +151 -7
  284. akshare/stock_feature/stock_research_report_em.py +55 -20
  285. akshare/stock_feature/stock_sy_em.py +20 -15
  286. akshare/stock_feature/stock_technology_ths.py +122 -77
  287. akshare/stock_feature/stock_tfp_em.py +2 -1
  288. akshare/stock_feature/stock_three_report_em.py +21 -5
  289. akshare/stock_feature/stock_ttm_lyr.py +18 -9
  290. akshare/stock_feature/stock_value_em.py +83 -0
  291. akshare/stock_feature/stock_yjbb_em.py +58 -32
  292. akshare/stock_feature/stock_yjyg_cninfo.py +6 -2
  293. akshare/stock_feature/stock_yjyg_em.py +1 -1
  294. akshare/stock_feature/stock_yzxdr_em.py +24 -22
  295. akshare/stock_feature/stock_zdhtmx_em.py +20 -6
  296. akshare/stock_feature/stock_zh_vote_baidu.py +4 -1
  297. akshare/stock_feature/stock_ztb_em.py +39 -24
  298. akshare/stock_fundamental/__init__.py +1 -1
  299. akshare/stock_fundamental/stock_basic_info_xq.py +119 -0
  300. akshare/stock_fundamental/{stock_finance_hk.py → stock_finance_hk_em.py} +23 -16
  301. akshare/stock_fundamental/{stock_finance.py → stock_finance_sina.py} +60 -7
  302. akshare/stock_fundamental/stock_finance_ths.py +524 -57
  303. akshare/stock_fundamental/stock_finance_us_em.py +268 -0
  304. akshare/stock_fundamental/stock_gbjg_em.py +80 -0
  305. akshare/stock_fundamental/stock_hold.py +26 -17
  306. akshare/stock_fundamental/stock_ipo_declare.py +1 -0
  307. akshare/stock_fundamental/stock_kcb_detail_sse.py +10 -10
  308. akshare/stock_fundamental/stock_kcb_sse.py +26 -25
  309. akshare/stock_fundamental/stock_notice.py +12 -3
  310. akshare/stock_fundamental/stock_profit_forecast_em.py +31 -13
  311. akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py +64 -41
  312. akshare/stock_fundamental/stock_profit_forecast_ths.py +86 -35
  313. akshare/stock_fundamental/stock_recommend.py +20 -4
  314. akshare/stock_fundamental/stock_zygc.py +5 -62
  315. akshare/utils/context.py +43 -0
  316. akshare/utils/demjson.py +2009 -1338
  317. akshare/utils/func.py +49 -2
  318. akshare/utils/multi_decrypt.py +53 -0
  319. akshare/utils/token_process.py +6 -5
  320. {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info}/METADATA +54 -80
  321. akshare-1.17.99.dist-info/RECORD +409 -0
  322. {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info}/WHEEL +1 -1
  323. {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info/licenses}/LICENSE +1 -1
  324. tests/test_func.py +3 -5
  325. akshare/bond/bond_futures.py +0 -50
  326. akshare/bond/bond_investing.py +0 -139
  327. akshare/crypto/crypto_hist_investing.py +0 -249
  328. akshare/fund/fund_announcement.py +0 -56
  329. akshare/futures/futures_international.py +0 -170
  330. akshare/futures/futures_news_baidu.py +0 -54
  331. akshare/futures/inventory_data.py +0 -100
  332. akshare/futures_derivative/futures_index_price_nh.py +0 -61
  333. akshare/futures_derivative/futures_index_return_nh.py +0 -47
  334. akshare/futures_derivative/futures_index_volatility_nh.py +0 -53
  335. akshare/futures_derivative/futures_other_index_nh.py +0 -145
  336. akshare/index/index_fear_greed_funddb.py +0 -78
  337. akshare/index/index_investing.py +0 -232
  338. akshare/sport/__init__.py +0 -6
  339. akshare/sport/sport_olympic.py +0 -27
  340. akshare/stock_feature/stock_wencai.py +0 -104
  341. akshare/stock_fundamental/stock_mda_ym.py +0 -40
  342. akshare-1.14.49.dist-info/RECORD +0 -387
  343. {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
- Date: 2022/5/25 21:11
4
+ Date: 2024/11/5 17:11
5
5
  Desc: 金十数据中心-经济指标-央行利率-主要央行利率
6
6
  https://datacenter.jin10.com/economic
7
7
  输出数据格式为 float64
@@ -17,6 +17,7 @@ https://datacenter.jin10.com/economic
17
17
  印度央行决议报告
18
18
  巴西央行决议报告
19
19
  """
20
+
20
21
  import datetime
21
22
  import time
22
23
 
@@ -24,80 +25,87 @@ import pandas as pd
24
25
  import requests
25
26
 
26
27
 
27
- # 金十数据中心-经济指标-央行利率-主要央行利率-美联储利率决议报告
28
- def macro_bank_usa_interest_rate() -> pd.DataFrame:
28
+ def __get_interest_rate_data(attr_id: str, name: str = "利率") -> pd.DataFrame:
29
29
  """
30
- 美联储利率决议报告, 数据区间从 19820927-至今
30
+ 利率决议报告公共函数
31
31
  https://datacenter.jin10.com/reportType/dc_usa_interest_rate_decision
32
- https://cdn.jin10.com/dc/reports/dc_usa_interest_rate_decision_all.js?v=1578581921
33
- :return: 美联储利率决议报告-今值(%)
32
+ :param attr_id: 内置属性
33
+ :type attr_id: str
34
+ :param name: 利率报告名称
35
+ :type name: str
36
+ :return: 利率决议报告数据
34
37
  :rtype: pandas.Series
35
38
  """
36
39
  t = time.time()
37
40
  headers = {
38
- "accept": "*/*",
39
- "accept-encoding": "gzip, deflate, br",
40
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
41
- "cache-control": "no-cache",
42
- "origin": "https://datacenter.jin10.com",
43
- "pragma": "no-cache",
44
- "sec-fetch-dest": "empty",
45
- "sec-fetch-mode": "cors",
46
- "sec-fetch-site": "same-site",
47
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
41
+ "Accept": "*/*",
42
+ "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
43
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
44
+ "Chrome/120.0.0.0 Safari/537.36",
45
+ "Origin": "https://datacenter.jin10.com",
46
+ "Referer": "https://datacenter.jin10.com/",
48
47
  "x-app-id": "rU6QIu7JHe2gOUeR",
49
- "x-csrf-token": "",
50
48
  "x-version": "1.0.0",
51
49
  }
52
- url = "https://datacenter-api.jin10.com/reports/list_v2"
50
+ base_url = "https://datacenter-api.jin10.com/reports/list_v2"
53
51
  params = {
54
52
  "max_date": "",
55
53
  "category": "ec",
56
- "attr_id": "24",
54
+ "attr_id": attr_id,
57
55
  "_": str(int(round(t * 1000))),
58
56
  }
59
- big_df = pd.DataFrame()
60
- while True:
61
- r = requests.get(url, params=params, headers=headers)
62
- data_json = r.json()
63
- if not data_json["data"]["values"]:
64
- break
65
- temp_df = pd.DataFrame(data_json["data"]["values"])
66
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
67
- last_date_str = temp_df.iat[-1, 0]
68
- last_date_str = (
69
- (
70
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
71
- - datetime.timedelta(days=1)
57
+ interest_rate_data = []
58
+ try:
59
+ while True:
60
+ response = requests.get(
61
+ url=base_url, params=params, headers=headers, timeout=10
72
62
  )
73
- .date()
74
- .isoformat()
75
- )
76
- params.update({"max_date": f"{last_date_str}"})
77
- big_df["商品"] = "美联储利率决议"
78
- big_df.columns = [
79
- "日期",
80
- "今值",
81
- "预测值",
82
- "前值",
83
- "商品",
84
- ]
85
- big_df = big_df[
86
- [
87
- "商品",
88
- "日期",
89
- "今值",
90
- "预测值",
91
- "前值",
92
- ]
93
- ]
63
+ data = response.json()
64
+ if not data.get("data", {}).get("values"):
65
+ break
66
+ interest_rate_data.extend(data["data"]["values"])
67
+
68
+ # Update max_date for pagination
69
+ last_date = data["data"]["values"][-1][0]
70
+ next_date = (
71
+ datetime.datetime.strptime(last_date, "%Y-%m-%d").date()
72
+ - datetime.timedelta(days=1)
73
+ ).isoformat()
74
+ params["max_date"] = next_date
75
+
76
+ except requests.exceptions.RequestException as e:
77
+ print(f"Error fetching data: {e}")
78
+ return pd.DataFrame()
79
+
80
+ # Convert to DataFrame
81
+ big_df = pd.DataFrame(interest_rate_data)
82
+
83
+ if big_df.empty:
84
+ return pd.DataFrame()
85
+
86
+ # Process DataFrame
87
+ big_df["商品"] = name
88
+ big_df.columns = ["日期", "今值", "预测值", "前值", "商品"]
89
+ big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]]
90
+
91
+ # Convert data types
94
92
  big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
95
- big_df["今值"] = pd.to_numeric(big_df["今值"])
96
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
97
- big_df["前值"] = pd.to_numeric(big_df["前值"])
98
- big_df.sort_values(["日期"], inplace=True)
99
- big_df.reset_index(inplace=True, drop=True)
100
- return big_df
93
+ numeric_columns = ["今值", "预测值", "前值"]
94
+ for col in numeric_columns:
95
+ big_df[col] = pd.to_numeric(big_df[col], errors="coerce")
96
+
97
+ return big_df.sort_values("日期").reset_index(drop=True)
98
+
99
+
100
+ # 金十数据中心-经济指标-央行利率-主要央行利率-美联储利率决议报告
101
+ def macro_bank_usa_interest_rate() -> pd.DataFrame:
102
+ """
103
+ 美联储利率决议报告, 数据区间从 19820927-至今
104
+ https://datacenter.jin10.com/reportType/dc_usa_interest_rate_decision
105
+ :return: 美联储利率决议报告-今值(%)
106
+ :rtype: pandas.Series
107
+ """
108
+ return __get_interest_rate_data(attr_id="24", name="美联储利率决议报告")
101
109
 
102
110
 
103
111
  # 金十数据中心-经济指标-央行利率-主要央行利率-欧洲央行决议报告
@@ -109,71 +117,7 @@ def macro_bank_euro_interest_rate() -> pd.DataFrame:
109
117
  :return: 欧洲央行决议报告-今值(%)
110
118
  :rtype: pandas.Series
111
119
  """
112
- t = time.time()
113
- headers = {
114
- "accept": "*/*",
115
- "accept-encoding": "gzip, deflate, br",
116
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
117
- "cache-control": "no-cache",
118
- "origin": "https://datacenter.jin10.com",
119
- "pragma": "no-cache",
120
- "sec-fetch-dest": "empty",
121
- "sec-fetch-mode": "cors",
122
- "sec-fetch-site": "same-site",
123
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
124
- "x-app-id": "rU6QIu7JHe2gOUeR",
125
- "x-csrf-token": "",
126
- "x-version": "1.0.0",
127
- }
128
- url = "https://datacenter-api.jin10.com/reports/list_v2"
129
- params = {
130
- "max_date": "",
131
- "category": "ec",
132
- "attr_id": "21",
133
- "_": str(int(round(t * 1000))),
134
- }
135
- big_df = pd.DataFrame()
136
- while True:
137
- r = requests.get(url, params=params, headers=headers)
138
- data_json = r.json()
139
- if not data_json["data"]["values"]:
140
- break
141
- temp_df = pd.DataFrame(data_json["data"]["values"])
142
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
143
- last_date_str = temp_df.iat[-1, 0]
144
- last_date_str = (
145
- (
146
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
147
- - datetime.timedelta(days=1)
148
- )
149
- .date()
150
- .isoformat()
151
- )
152
- params.update({"max_date": f"{last_date_str}"})
153
- big_df["商品"] = "欧元区利率决议"
154
- big_df.columns = [
155
- "日期",
156
- "今值",
157
- "预测值",
158
- "前值",
159
- "商品",
160
- ]
161
- big_df = big_df[
162
- [
163
- "商品",
164
- "日期",
165
- "今值",
166
- "预测值",
167
- "前值",
168
- ]
169
- ]
170
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
171
- big_df["今值"] = pd.to_numeric(big_df["今值"])
172
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
173
- big_df["前值"] = pd.to_numeric(big_df["前值"])
174
- big_df.sort_values(["日期"], inplace=True)
175
- big_df.reset_index(inplace=True, drop=True)
176
- return big_df
120
+ return __get_interest_rate_data(attr_id="21", name="欧洲央行决议报告")
177
121
 
178
122
 
179
123
  # 金十数据中心-经济指标-央行利率-主要央行利率-新西兰联储决议报告
@@ -185,71 +129,19 @@ def macro_bank_newzealand_interest_rate() -> pd.DataFrame:
185
129
  :return: 新西兰联储决议报告-今值(%)
186
130
  :rtype: pandas.Series
187
131
  """
188
- t = time.time()
189
- headers = {
190
- "accept": "*/*",
191
- "accept-encoding": "gzip, deflate, br",
192
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
193
- "cache-control": "no-cache",
194
- "origin": "https://datacenter.jin10.com",
195
- "pragma": "no-cache",
196
- "sec-fetch-dest": "empty",
197
- "sec-fetch-mode": "cors",
198
- "sec-fetch-site": "same-site",
199
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
200
- "x-app-id": "rU6QIu7JHe2gOUeR",
201
- "x-csrf-token": "",
202
- "x-version": "1.0.0",
203
- }
204
- url = "https://datacenter-api.jin10.com/reports/list_v2"
205
- params = {
206
- "max_date": "",
207
- "category": "ec",
208
- "attr_id": "23",
209
- "_": str(int(round(t * 1000))),
210
- }
211
- big_df = pd.DataFrame()
212
- while True:
213
- r = requests.get(url, params=params, headers=headers)
214
- data_json = r.json()
215
- if not data_json["data"]["values"]:
216
- break
217
- temp_df = pd.DataFrame(data_json["data"]["values"])
218
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
219
- last_date_str = temp_df.iat[-1, 0]
220
- last_date_str = (
221
- (
222
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
223
- - datetime.timedelta(days=1)
224
- )
225
- .date()
226
- .isoformat()
227
- )
228
- params.update({"max_date": f"{last_date_str}"})
229
- big_df["商品"] = "新西兰利率决议报告"
230
- big_df.columns = [
231
- "日期",
232
- "今值",
233
- "预测值",
234
- "前值",
235
- "商品",
236
- ]
237
- big_df = big_df[
238
- [
239
- "商品",
240
- "日期",
241
- "今值",
242
- "预测值",
243
- "前值",
244
- ]
245
- ]
246
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
247
- big_df["今值"] = pd.to_numeric(big_df["今值"])
248
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
249
- big_df["前值"] = pd.to_numeric(big_df["前值"])
250
- big_df.sort_values(["日期"], inplace=True)
251
- big_df.reset_index(inplace=True, drop=True)
252
- return big_df
132
+ return __get_interest_rate_data(attr_id="23", name="新西兰利率决议报告")
133
+
134
+
135
+ # 金十数据中心-经济指标-央行利率-主要央行利率-中国央行决议报告
136
+ def macro_bank_china_interest_rate() -> pd.DataFrame:
137
+ """
138
+ 中国央行决议报告, 数据区间从 19990105-至今
139
+ https://datacenter.jin10.com/reportType/dc_newzealand_interest_rate_decision
140
+ https://cdn.jin10.com/dc/reports/dc_newzealand_interest_rate_decision_all.js?v=1578582075
141
+ :return: 新西兰联储决议报告-今值(%)
142
+ :rtype: pandas.Series
143
+ """
144
+ return __get_interest_rate_data(attr_id="91", name="中国央行决议报告")
253
145
 
254
146
 
255
147
  # 金十数据中心-经济指标-央行利率-主要央行利率-瑞士央行决议报告
@@ -261,71 +153,7 @@ def macro_bank_switzerland_interest_rate() -> pd.DataFrame:
261
153
  :return: 瑞士央行利率决议报告-今值(%)
262
154
  :rtype: pandas.Series
263
155
  """
264
- t = time.time()
265
- headers = {
266
- "accept": "*/*",
267
- "accept-encoding": "gzip, deflate, br",
268
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
269
- "cache-control": "no-cache",
270
- "origin": "https://datacenter.jin10.com",
271
- "pragma": "no-cache",
272
- "sec-fetch-dest": "empty",
273
- "sec-fetch-mode": "cors",
274
- "sec-fetch-site": "same-site",
275
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
276
- "x-app-id": "rU6QIu7JHe2gOUeR",
277
- "x-csrf-token": "",
278
- "x-version": "1.0.0",
279
- }
280
- url = "https://datacenter-api.jin10.com/reports/list_v2"
281
- params = {
282
- "max_date": "",
283
- "category": "ec",
284
- "attr_id": "25",
285
- "_": str(int(round(t * 1000))),
286
- }
287
- big_df = pd.DataFrame()
288
- while True:
289
- r = requests.get(url, params=params, headers=headers)
290
- data_json = r.json()
291
- if not data_json["data"]["values"]:
292
- break
293
- temp_df = pd.DataFrame(data_json["data"]["values"])
294
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
295
- last_date_str = temp_df.iat[-1, 0]
296
- last_date_str = (
297
- (
298
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
299
- - datetime.timedelta(days=1)
300
- )
301
- .date()
302
- .isoformat()
303
- )
304
- params.update({"max_date": f"{last_date_str}"})
305
- big_df["商品"] = "瑞士央行利率决议报告"
306
- big_df.columns = [
307
- "日期",
308
- "今值",
309
- "预测值",
310
- "前值",
311
- "商品",
312
- ]
313
- big_df = big_df[
314
- [
315
- "商品",
316
- "日期",
317
- "今值",
318
- "预测值",
319
- "前值",
320
- ]
321
- ]
322
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
323
- big_df["今值"] = pd.to_numeric(big_df["今值"])
324
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
325
- big_df["前值"] = pd.to_numeric(big_df["前值"])
326
- big_df.sort_values(["日期"], inplace=True)
327
- big_df.reset_index(inplace=True, drop=True)
328
- return big_df
156
+ return __get_interest_rate_data(attr_id="25", name="瑞士央行决议报告")
329
157
 
330
158
 
331
159
  # 金十数据中心-经济指标-央行利率-主要央行利率-英国央行决议报告
@@ -337,71 +165,7 @@ def macro_bank_english_interest_rate() -> pd.DataFrame:
337
165
  :return: 英国央行决议报告-今值(%)
338
166
  :rtype: pandas.Series
339
167
  """
340
- t = time.time()
341
- headers = {
342
- "accept": "*/*",
343
- "accept-encoding": "gzip, deflate, br",
344
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
345
- "cache-control": "no-cache",
346
- "origin": "https://datacenter.jin10.com",
347
- "pragma": "no-cache",
348
- "sec-fetch-dest": "empty",
349
- "sec-fetch-mode": "cors",
350
- "sec-fetch-site": "same-site",
351
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
352
- "x-app-id": "rU6QIu7JHe2gOUeR",
353
- "x-csrf-token": "",
354
- "x-version": "1.0.0",
355
- }
356
- url = "https://datacenter-api.jin10.com/reports/list_v2"
357
- params = {
358
- "max_date": "",
359
- "category": "ec",
360
- "attr_id": "26",
361
- "_": str(int(round(t * 1000))),
362
- }
363
- big_df = pd.DataFrame()
364
- while True:
365
- r = requests.get(url, params=params, headers=headers)
366
- data_json = r.json()
367
- if not data_json["data"]["values"]:
368
- break
369
- temp_df = pd.DataFrame(data_json["data"]["values"])
370
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
371
- last_date_str = temp_df.iat[-1, 0]
372
- last_date_str = (
373
- (
374
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
375
- - datetime.timedelta(days=1)
376
- )
377
- .date()
378
- .isoformat()
379
- )
380
- params.update({"max_date": f"{last_date_str}"})
381
- big_df["商品"] = "英国利率决议报告"
382
- big_df.columns = [
383
- "日期",
384
- "今值",
385
- "预测值",
386
- "前值",
387
- "商品",
388
- ]
389
- big_df = big_df[
390
- [
391
- "商品",
392
- "日期",
393
- "今值",
394
- "预测值",
395
- "前值",
396
- ]
397
- ]
398
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
399
- big_df["今值"] = pd.to_numeric(big_df["今值"])
400
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
401
- big_df["前值"] = pd.to_numeric(big_df["前值"])
402
- big_df.sort_values(["日期"], inplace=True)
403
- big_df.reset_index(inplace=True, drop=True)
404
- return big_df
168
+ return __get_interest_rate_data(attr_id="26", name="英国央行决议报告")
405
169
 
406
170
 
407
171
  # 金十数据中心-经济指标-央行利率-主要央行利率-澳洲联储决议报告
@@ -413,71 +177,7 @@ def macro_bank_australia_interest_rate() -> pd.DataFrame:
413
177
  :return: 澳洲联储决议报告-今值(%)
414
178
  :rtype: pandas.Series
415
179
  """
416
- t = time.time()
417
- headers = {
418
- "accept": "*/*",
419
- "accept-encoding": "gzip, deflate, br",
420
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
421
- "cache-control": "no-cache",
422
- "origin": "https://datacenter.jin10.com",
423
- "pragma": "no-cache",
424
- "sec-fetch-dest": "empty",
425
- "sec-fetch-mode": "cors",
426
- "sec-fetch-site": "same-site",
427
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
428
- "x-app-id": "rU6QIu7JHe2gOUeR",
429
- "x-csrf-token": "",
430
- "x-version": "1.0.0",
431
- }
432
- url = "https://datacenter-api.jin10.com/reports/list_v2"
433
- params = {
434
- "max_date": "",
435
- "category": "ec",
436
- "attr_id": "27",
437
- "_": str(int(round(t * 1000))),
438
- }
439
- big_df = pd.DataFrame()
440
- while True:
441
- r = requests.get(url, params=params, headers=headers)
442
- data_json = r.json()
443
- if not data_json["data"]["values"]:
444
- break
445
- temp_df = pd.DataFrame(data_json["data"]["values"])
446
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
447
- last_date_str = temp_df.iat[-1, 0]
448
- last_date_str = (
449
- (
450
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
451
- - datetime.timedelta(days=1)
452
- )
453
- .date()
454
- .isoformat()
455
- )
456
- params.update({"max_date": f"{last_date_str}"})
457
- big_df["商品"] = "澳大利亚利率决议报告"
458
- big_df.columns = [
459
- "日期",
460
- "今值",
461
- "预测值",
462
- "前值",
463
- "商品",
464
- ]
465
- big_df = big_df[
466
- [
467
- "商品",
468
- "日期",
469
- "今值",
470
- "预测值",
471
- "前值",
472
- ]
473
- ]
474
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
475
- big_df["今值"] = pd.to_numeric(big_df["今值"])
476
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
477
- big_df["前值"] = pd.to_numeric(big_df["前值"])
478
- big_df.sort_values(["日期"], inplace=True)
479
- big_df.reset_index(inplace=True, drop=True)
480
- return big_df
180
+ return __get_interest_rate_data(attr_id="27", name="澳洲联储决议报告")
481
181
 
482
182
 
483
183
  # 金十数据中心-经济指标-央行利率-主要央行利率-日本央行决议报告
@@ -489,71 +189,7 @@ def macro_bank_japan_interest_rate() -> pd.DataFrame:
489
189
  :return: 日本利率决议报告-今值(%)
490
190
  :rtype: pandas.Series
491
191
  """
492
- t = time.time()
493
- headers = {
494
- "accept": "*/*",
495
- "accept-encoding": "gzip, deflate, br",
496
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
497
- "cache-control": "no-cache",
498
- "origin": "https://datacenter.jin10.com",
499
- "pragma": "no-cache",
500
- "sec-fetch-dest": "empty",
501
- "sec-fetch-mode": "cors",
502
- "sec-fetch-site": "same-site",
503
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
504
- "x-app-id": "rU6QIu7JHe2gOUeR",
505
- "x-csrf-token": "",
506
- "x-version": "1.0.0",
507
- }
508
- url = "https://datacenter-api.jin10.com/reports/list_v2"
509
- params = {
510
- "max_date": "",
511
- "category": "ec",
512
- "attr_id": "22",
513
- "_": str(int(round(t * 1000))),
514
- }
515
- big_df = pd.DataFrame()
516
- while True:
517
- r = requests.get(url, params=params, headers=headers)
518
- data_json = r.json()
519
- if not data_json["data"]["values"]:
520
- break
521
- temp_df = pd.DataFrame(data_json["data"]["values"])
522
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
523
- last_date_str = temp_df.iat[-1, 0]
524
- last_date_str = (
525
- (
526
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
527
- - datetime.timedelta(days=1)
528
- )
529
- .date()
530
- .isoformat()
531
- )
532
- params.update({"max_date": f"{last_date_str}"})
533
- big_df["商品"] = "日本利率决议报告"
534
- big_df.columns = [
535
- "日期",
536
- "今值",
537
- "预测值",
538
- "前值",
539
- "商品",
540
- ]
541
- big_df = big_df[
542
- [
543
- "商品",
544
- "日期",
545
- "今值",
546
- "预测值",
547
- "前值",
548
- ]
549
- ]
550
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
551
- big_df["今值"] = pd.to_numeric(big_df["今值"])
552
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
553
- big_df["前值"] = pd.to_numeric(big_df["前值"])
554
- big_df.sort_values(["日期"], inplace=True)
555
- big_df.reset_index(inplace=True, drop=True)
556
- return big_df
192
+ return __get_interest_rate_data(attr_id="22", name="日本央行决议报告")
557
193
 
558
194
 
559
195
  # 金十数据中心-经济指标-央行利率-主要央行利率-俄罗斯央行决议报告
@@ -565,71 +201,7 @@ def macro_bank_russia_interest_rate() -> pd.DataFrame:
565
201
  :return: 俄罗斯利率决议报告-今值(%)
566
202
  :rtype: pandas.Series
567
203
  """
568
- t = time.time()
569
- headers = {
570
- "accept": "*/*",
571
- "accept-encoding": "gzip, deflate, br",
572
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
573
- "cache-control": "no-cache",
574
- "origin": "https://datacenter.jin10.com",
575
- "pragma": "no-cache",
576
- "sec-fetch-dest": "empty",
577
- "sec-fetch-mode": "cors",
578
- "sec-fetch-site": "same-site",
579
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
580
- "x-app-id": "rU6QIu7JHe2gOUeR",
581
- "x-csrf-token": "",
582
- "x-version": "1.0.0",
583
- }
584
- url = "https://datacenter-api.jin10.com/reports/list_v2"
585
- params = {
586
- "max_date": "",
587
- "category": "ec",
588
- "attr_id": "64",
589
- "_": str(int(round(t * 1000))),
590
- }
591
- big_df = pd.DataFrame()
592
- while True:
593
- r = requests.get(url, params=params, headers=headers)
594
- data_json = r.json()
595
- if not data_json["data"]["values"]:
596
- break
597
- temp_df = pd.DataFrame(data_json["data"]["values"])
598
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
599
- last_date_str = temp_df.iat[-1, 0]
600
- last_date_str = (
601
- (
602
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
603
- - datetime.timedelta(days=1)
604
- )
605
- .date()
606
- .isoformat()
607
- )
608
- params.update({"max_date": f"{last_date_str}"})
609
- big_df["商品"] = "俄罗斯利率决议报告"
610
- big_df.columns = [
611
- "日期",
612
- "今值",
613
- "预测值",
614
- "前值",
615
- "商品",
616
- ]
617
- big_df = big_df[
618
- [
619
- "商品",
620
- "日期",
621
- "今值",
622
- "预测值",
623
- "前值",
624
- ]
625
- ]
626
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
627
- big_df["今值"] = pd.to_numeric(big_df["今值"])
628
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
629
- big_df["前值"] = pd.to_numeric(big_df["前值"])
630
- big_df.sort_values(["日期"], inplace=True)
631
- big_df.reset_index(inplace=True, drop=True)
632
- return big_df
204
+ return __get_interest_rate_data(attr_id="64", name="俄罗斯央行决议报告")
633
205
 
634
206
 
635
207
  # 金十数据中心-经济指标-央行利率-主要央行利率-印度央行决议报告
@@ -641,71 +213,7 @@ def macro_bank_india_interest_rate() -> pd.DataFrame:
641
213
  :return: 印度利率决议报告-今值(%)
642
214
  :rtype: pandas.Series
643
215
  """
644
- t = time.time()
645
- headers = {
646
- "accept": "*/*",
647
- "accept-encoding": "gzip, deflate, br",
648
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
649
- "cache-control": "no-cache",
650
- "origin": "https://datacenter.jin10.com",
651
- "pragma": "no-cache",
652
- "sec-fetch-dest": "empty",
653
- "sec-fetch-mode": "cors",
654
- "sec-fetch-site": "same-site",
655
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
656
- "x-app-id": "rU6QIu7JHe2gOUeR",
657
- "x-csrf-token": "",
658
- "x-version": "1.0.0",
659
- }
660
- url = "https://datacenter-api.jin10.com/reports/list_v2"
661
- params = {
662
- "max_date": "",
663
- "category": "ec",
664
- "attr_id": "68",
665
- "_": str(int(round(t * 1000))),
666
- }
667
- big_df = pd.DataFrame()
668
- while True:
669
- r = requests.get(url, params=params, headers=headers)
670
- data_json = r.json()
671
- if not data_json["data"]["values"]:
672
- break
673
- temp_df = pd.DataFrame(data_json["data"]["values"])
674
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
675
- last_date_str = temp_df.iat[-1, 0]
676
- last_date_str = (
677
- (
678
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
679
- - datetime.timedelta(days=1)
680
- )
681
- .date()
682
- .isoformat()
683
- )
684
- params.update({"max_date": f"{last_date_str}"})
685
- big_df["商品"] = "印度利率决议报告"
686
- big_df.columns = [
687
- "日期",
688
- "今值",
689
- "预测值",
690
- "前值",
691
- "商品",
692
- ]
693
- big_df = big_df[
694
- [
695
- "商品",
696
- "日期",
697
- "今值",
698
- "预测值",
699
- "前值",
700
- ]
701
- ]
702
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
703
- big_df["今值"] = pd.to_numeric(big_df["今值"])
704
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
705
- big_df["前值"] = pd.to_numeric(big_df["前值"])
706
- big_df.sort_values(["日期"], inplace=True)
707
- big_df.reset_index(inplace=True, drop=True)
708
- return big_df
216
+ return __get_interest_rate_data(attr_id="68", name="印度央行决议报告")
709
217
 
710
218
 
711
219
  # 金十数据中心-经济指标-央行利率-主要央行利率-巴西央行决议报告
@@ -717,71 +225,7 @@ def macro_bank_brazil_interest_rate() -> pd.DataFrame:
717
225
  :return: 巴西利率决议报告-今值(%)
718
226
  :rtype: pandas.Series
719
227
  """
720
- t = time.time()
721
- headers = {
722
- "accept": "*/*",
723
- "accept-encoding": "gzip, deflate, br",
724
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
725
- "cache-control": "no-cache",
726
- "origin": "https://datacenter.jin10.com",
727
- "pragma": "no-cache",
728
- "sec-fetch-dest": "empty",
729
- "sec-fetch-mode": "cors",
730
- "sec-fetch-site": "same-site",
731
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
732
- "x-app-id": "rU6QIu7JHe2gOUeR",
733
- "x-csrf-token": "",
734
- "x-version": "1.0.0",
735
- }
736
- url = "https://datacenter-api.jin10.com/reports/list_v2"
737
- params = {
738
- "max_date": "",
739
- "category": "ec",
740
- "attr_id": "55",
741
- "_": str(int(round(t * 1000))),
742
- }
743
- big_df = pd.DataFrame()
744
- while True:
745
- r = requests.get(url, params=params, headers=headers)
746
- data_json = r.json()
747
- if not data_json["data"]["values"]:
748
- break
749
- temp_df = pd.DataFrame(data_json["data"]["values"])
750
- big_df = pd.concat([big_df, temp_df], ignore_index=True)
751
- last_date_str = temp_df.iat[-1, 0]
752
- last_date_str = (
753
- (
754
- datetime.datetime.strptime(last_date_str, "%Y-%m-%d")
755
- - datetime.timedelta(days=1)
756
- )
757
- .date()
758
- .isoformat()
759
- )
760
- params.update({"max_date": f"{last_date_str}"})
761
- big_df["商品"] = "巴西利率决议报告"
762
- big_df.columns = [
763
- "日期",
764
- "今值",
765
- "预测值",
766
- "前值",
767
- "商品",
768
- ]
769
- big_df = big_df[
770
- [
771
- "商品",
772
- "日期",
773
- "今值",
774
- "预测值",
775
- "前值",
776
- ]
777
- ]
778
- big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date
779
- big_df["今值"] = pd.to_numeric(big_df["今值"])
780
- big_df["预测值"] = pd.to_numeric(big_df["预测值"])
781
- big_df["前值"] = pd.to_numeric(big_df["前值"])
782
- big_df.sort_values(["日期"], inplace=True)
783
- big_df.reset_index(inplace=True, drop=True)
784
- return big_df
228
+ return __get_interest_rate_data(attr_id="55", name="巴西央行决议报告")
785
229
 
786
230
 
787
231
  if __name__ == "__main__":
@@ -794,15 +238,15 @@ if __name__ == "__main__":
794
238
  print(macro_bank_euro_interest_rate_df)
795
239
 
796
240
  # 金十数据中心-经济指标-央行利率-主要央行利率-新西兰联储决议报告
797
- macro_bank_newzealand_interest_rate_df = (
798
- macro_bank_newzealand_interest_rate()
799
- )
241
+ macro_bank_newzealand_interest_rate_df = macro_bank_newzealand_interest_rate()
800
242
  print(macro_bank_newzealand_interest_rate_df)
801
243
 
244
+ # 金十数据中心-经济指标-央行利率-主要央行利率-中国央行决议报告
245
+ macro_bank_china_interest_rate_df = macro_bank_china_interest_rate()
246
+ print(macro_bank_china_interest_rate_df)
247
+
802
248
  # 金十数据中心-经济指标-央行利率-主要央行利率-瑞士央行决议报告
803
- macro_bank_switzerland_interest_rate_df = (
804
- macro_bank_switzerland_interest_rate()
805
- )
249
+ macro_bank_switzerland_interest_rate_df = macro_bank_switzerland_interest_rate()
806
250
  print(macro_bank_switzerland_interest_rate_df)
807
251
 
808
252
  # 金十数据中心-经济指标-央行利率-主要央行利率-英国央行决议报告
@@ -810,9 +254,7 @@ if __name__ == "__main__":
810
254
  print(macro_bank_english_interest_rate_df)
811
255
 
812
256
  # 金十数据中心-经济指标-央行利率-主要央行利率-澳洲联储决议报告
813
- macro_bank_australia_interest_rate_df = (
814
- macro_bank_australia_interest_rate()
815
- )
257
+ macro_bank_australia_interest_rate_df = macro_bank_australia_interest_rate()
816
258
  print(macro_bank_australia_interest_rate_df)
817
259
 
818
260
  # 金十数据中心-经济指标-央行利率-主要央行利率-日本央行决议报告