akshare 1.12.99__py3-none-any.whl → 1.15.73__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of akshare might be problematic. Click here for more details.
- akshare/__init__.py +442 -138
- akshare/air/air_hebei.py +79 -53
- akshare/air/air_zhenqi.py +29 -43
- akshare/air/sunrise_tad.py +32 -17
- akshare/bank/bank_cbirc_2020.py +12 -9
- akshare/bond/bond_cb_ths.py +17 -9
- akshare/bond/bond_china.py +38 -39
- akshare/bond/bond_china_money.py +75 -48
- akshare/bond/bond_info_cm.py +28 -8
- akshare/bond/bond_issue_cninfo.py +73 -30
- akshare/bond/bond_zh_cov.py +1 -1
- akshare/bond/bond_zh_sina.py +57 -51
- akshare/cal/__init__.py +0 -0
- akshare/cal/rv.py +170 -0
- akshare/cost/cost_living.py +7 -5
- akshare/currency/currency_safe.py +7 -6
- akshare/data/cninfo.js +15 -0
- akshare/datasets.py +10 -21
- akshare/economic/macro_bank.py +95 -653
- akshare/economic/macro_china.py +772 -1024
- akshare/economic/macro_china_hk.py +65 -243
- akshare/economic/macro_china_nbs.py +24 -7
- akshare/economic/macro_constitute.py +17 -12
- akshare/economic/macro_euro.py +13 -6
- akshare/economic/macro_finance_ths.py +133 -0
- akshare/economic/macro_info_ws.py +100 -0
- akshare/economic/macro_japan.py +5 -4
- akshare/economic/macro_other.py +12 -9
- akshare/economic/macro_usa.py +376 -1940
- akshare/economic/marco_cnbs.py +11 -6
- akshare/energy/energy_carbon.py +94 -125
- akshare/event/migration.py +3 -2
- akshare/exceptions.py +43 -0
- akshare/file_fold/calendar.json +245 -2
- akshare/fortune/fortune_500.py +15 -48
- akshare/fund/fund_amac.py +157 -75
- akshare/fund/fund_em.py +191 -184
- akshare/fund/fund_etf_em.py +16 -15
- akshare/fund/fund_etf_sina.py +71 -23
- akshare/fund/fund_etf_ths.py +93 -0
- akshare/fund/fund_fee_em.py +98 -0
- akshare/fund/fund_portfolio_em.py +60 -50
- akshare/fund/fund_rank_em.py +91 -82
- akshare/fund/fund_report_cninfo.py +63 -48
- akshare/fund/fund_scale_sina.py +20 -10
- akshare/fund/fund_xq.py +139 -109
- akshare/futures/cons.py +8 -31
- akshare/futures/cot.py +185 -137
- akshare/futures/futures_basis.py +97 -32
- akshare/futures/futures_comm_ctp.py +37 -0
- akshare/futures/futures_comm_qihuo.py +74 -45
- akshare/futures/futures_daily_bar.py +121 -184
- akshare/futures/futures_hf_em.py +66 -61
- akshare/futures/futures_hq_sina.py +79 -61
- akshare/futures/futures_index_ccidx.py +6 -3
- akshare/futures/futures_inventory_99.py +61 -272
- akshare/futures/futures_news_shmet.py +4 -2
- akshare/futures/futures_roll_yield.py +12 -25
- akshare/futures/futures_spot_stock_em.py +19 -13
- akshare/futures/futures_stock_js.py +14 -12
- akshare/futures/futures_to_spot.py +38 -33
- akshare/futures/futures_warehouse_receipt.py +75 -71
- akshare/futures/futures_zh_sina.py +5 -5
- akshare/futures/symbol_var.py +18 -13
- akshare/futures_derivative/futures_contract_info_czce.py +60 -52
- akshare/futures_derivative/futures_contract_info_ine.py +43 -34
- akshare/futures_derivative/futures_contract_info_shfe.py +46 -35
- akshare/futures_derivative/futures_cot_sina.py +26 -19
- akshare/futures_derivative/futures_spot_sys.py +21 -8
- akshare/fx/currency_investing.py +19 -285
- akshare/index/index_cflp.py +29 -26
- akshare/index/index_cni.py +86 -88
- akshare/index/index_cons.py +26 -10
- akshare/index/index_cx.py +248 -47
- akshare/index/index_drewry.py +17 -16
- akshare/index/index_option_qvix.py +329 -0
- akshare/index/index_research_fund_sw.py +134 -0
- akshare/index/{index_sw_research.py → index_research_sw.py} +122 -58
- akshare/index/index_spot.py +9 -5
- akshare/index/index_stock_hk.py +35 -16
- akshare/index/index_stock_us_sina.py +1 -1
- akshare/index/index_stock_zh.py +180 -89
- akshare/index/index_stock_zh_csindex.py +15 -369
- akshare/index/index_sw.py +62 -34
- akshare/index/index_yw.py +46 -23
- akshare/index/index_zh_a_scope.py +48 -0
- akshare/index/index_zh_em.py +6 -4
- akshare/interest_rate/interbank_rate_em.py +14 -9
- akshare/movie/artist_yien.py +32 -5
- akshare/movie/movie_yien.py +92 -18
- akshare/movie/video_yien.py +28 -5
- akshare/news/news_baidu.py +78 -44
- akshare/news/news_cctv.py +38 -38
- akshare/news/news_stock.py +6 -3
- akshare/nlp/nlp_interface.py +7 -8
- akshare/option/cons.py +11 -11
- akshare/option/option_comm_qihuo.py +86 -0
- akshare/option/option_commodity.py +178 -51
- akshare/option/option_daily_stats_sse_szse.py +146 -0
- akshare/option/option_em.py +147 -138
- akshare/option/option_finance_sina.py +160 -137
- akshare/option/option_lhb_em.py +62 -56
- akshare/option/option_risk_indicator_sse.py +17 -14
- akshare/other/other_car_cpca.py +934 -0
- akshare/other/{other_car.py → other_car_gasgoo.py} +15 -54
- akshare/qdii/__init__.py +0 -0
- akshare/qdii/qdii_jsl.py +233 -0
- akshare/request.py +117 -0
- akshare/spot/spot_hog_soozhu.py +232 -0
- akshare/spot/spot_price_qh.py +121 -0
- akshare/spot/spot_sge.py +63 -10
- akshare/stock/stock_allotment_cninfo.py +10 -9
- akshare/stock/stock_board_concept_em.py +23 -14
- akshare/stock/stock_board_industry_em.py +40 -34
- akshare/stock/stock_cg_equity_mortgage.py +15 -11
- akshare/stock/stock_cg_guarantee.py +41 -51
- akshare/stock/stock_cg_lawsuit.py +36 -35
- akshare/stock/stock_dividend_cninfo.py +12 -6
- akshare/stock/stock_dzjy_em.py +347 -260
- akshare/stock/stock_fund_em.py +332 -84
- akshare/stock/stock_hk_famous.py +108 -0
- akshare/stock/stock_hk_sina.py +8 -7
- akshare/stock/stock_hold_control_cninfo.py +100 -15
- akshare/stock/stock_hold_control_em.py +4 -3
- akshare/stock/stock_hold_num_cninfo.py +18 -12
- akshare/stock/stock_hot_rank_em.py +2 -1
- akshare/stock/stock_hot_search_baidu.py +5 -2
- akshare/stock/stock_industry_cninfo.py +24 -18
- akshare/stock/stock_industry_pe_cninfo.py +45 -31
- akshare/stock/stock_industry_sw.py +9 -10
- akshare/stock/stock_info.py +25 -15
- akshare/stock/stock_info_em.py +5 -2
- akshare/stock/stock_intraday_em.py +5 -2
- akshare/stock/stock_intraday_sina.py +22 -18
- akshare/stock/stock_ipo_summary_cninfo.py +25 -10
- akshare/stock/stock_new_cninfo.py +32 -19
- akshare/stock/stock_news_cx.py +39 -0
- akshare/stock/stock_profile_cninfo.py +9 -8
- akshare/stock/stock_rank_forecast.py +8 -6
- akshare/stock/stock_share_changes_cninfo.py +18 -14
- akshare/stock/stock_share_hold.py +24 -19
- akshare/stock/stock_summary.py +54 -26
- akshare/stock/stock_us_famous.py +15 -6
- akshare/stock/stock_us_pink.py +7 -5
- akshare/stock/stock_us_sina.py +15 -12
- akshare/stock/stock_xq.py +38 -12
- akshare/stock/stock_zh_a_sina.py +53 -78
- akshare/stock/stock_zh_b_sina.py +32 -55
- akshare/stock/stock_zh_kcb_report.py +11 -9
- akshare/stock/stock_zh_kcb_sina.py +67 -64
- akshare/stock_feature/stock_a_below_net_asset_statistics.py +5 -2
- akshare/stock_feature/stock_a_high_low.py +5 -2
- akshare/stock_feature/stock_a_indicator.py +12 -9
- akshare/stock_feature/stock_a_pe_and_pb.py +27 -6
- akshare/stock_feature/stock_account_em.py +58 -40
- akshare/stock_feature/stock_analyst_em.py +36 -27
- akshare/stock_feature/stock_board_industry_ths.py +136 -400
- akshare/stock_feature/stock_comment_em.py +118 -85
- akshare/stock_feature/stock_concept_futu.py +183 -0
- akshare/stock_feature/stock_cyq_em.py +58 -54
- akshare/stock_feature/stock_disclosure_cninfo.py +147 -102
- akshare/stock_feature/stock_esg_sina.py +216 -11
- akshare/stock_feature/stock_fhps_em.py +60 -25
- akshare/stock_feature/stock_fhps_ths.py +25 -6
- akshare/stock_feature/stock_fund_flow.py +38 -25
- akshare/stock_feature/stock_gdfx_em.py +180 -95
- akshare/stock_feature/stock_gdhs.py +73 -49
- akshare/stock_feature/stock_gpzy_em.py +78 -46
- akshare/stock_feature/stock_hist_em.py +55 -23
- akshare/stock_feature/stock_hk_valuation_baidu.py +20 -8
- akshare/stock_feature/stock_hsgt_em.py +184 -452
- akshare/stock_feature/stock_info.py +52 -29
- akshare/stock_feature/stock_inner_trade_xq.py +39 -31
- akshare/stock_feature/stock_irm_cninfo.py +32 -9
- akshare/stock_feature/stock_jgdy_em.py +41 -38
- akshare/stock_feature/stock_lh_yybpm.py +36 -37
- akshare/stock_feature/stock_lhb_em.py +135 -71
- akshare/stock_feature/stock_lhb_sina.py +93 -46
- akshare/stock_feature/stock_margin_em.py +102 -0
- akshare/stock_feature/{stock_sse_margin.py → stock_margin_sse.py} +21 -15
- akshare/stock_feature/{stock_szse_margin.py → stock_margin_szse.py} +23 -19
- akshare/stock_feature/stock_market_legu.py +13 -8
- akshare/stock_feature/stock_pankou_em.py +72 -34
- akshare/stock_feature/stock_report_em.py +244 -54
- akshare/stock_feature/stock_research_report_em.py +48 -19
- akshare/stock_feature/stock_sns_sseinfo.py +15 -12
- akshare/stock_feature/stock_sy_em.py +86 -33
- akshare/stock_feature/stock_technology_ths.py +152 -120
- akshare/stock_feature/stock_tfp_em.py +35 -13
- akshare/stock_feature/stock_three_report_em.py +119 -77
- akshare/stock_feature/stock_ttm_lyr.py +4 -7
- akshare/stock_feature/stock_value_em.py +83 -0
- akshare/stock_feature/stock_wencai.py +21 -9
- akshare/stock_feature/stock_yjyg_em.py +63 -28
- akshare/stock_feature/stock_zf_pg.py +61 -38
- akshare/stock_feature/stock_zh_valuation_baidu.py +3 -2
- akshare/stock_feature/stock_ztb_em.py +62 -40
- akshare/stock_fundamental/stock_finance.py +150 -58
- akshare/stock_fundamental/stock_finance_ths.py +116 -31
- akshare/stock_fundamental/stock_mda_ym.py +5 -3
- akshare/stock_fundamental/stock_notice.py +29 -15
- akshare/stock_fundamental/stock_profit_forecast_em.py +31 -13
- akshare/stock_fundamental/stock_profit_forecast_ths.py +19 -10
- akshare/stock_fundamental/stock_register_em.py +448 -0
- akshare/stock_fundamental/stock_restricted_em.py +79 -32
- akshare/stock_fundamental/stock_zygc.py +10 -8
- akshare/stock_fundamental/stock_zyjs_ths.py +5 -3
- akshare/tool/trade_date_hist.py +4 -3
- akshare/utils/cons.py +10 -0
- akshare/utils/context.py +43 -0
- akshare/utils/demjson.py +2 -2
- akshare/utils/func.py +26 -0
- akshare/utils/tqdm.py +13 -3
- {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/METADATA +52 -69
- akshare-1.15.73.dist-info/RECORD +385 -0
- {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/WHEEL +1 -1
- tests/test_func.py +3 -5
- akshare/bond/bond_futures.py +0 -50
- akshare/bond/bond_investing.py +0 -139
- akshare/crypto/crypto_hist_investing.py +0 -249
- akshare/fortune/fortune_it_juzi.py +0 -123
- akshare/futures/futures_international.py +0 -170
- akshare/futures/futures_news_baidu.py +0 -54
- akshare/futures/inventory_data.py +0 -100
- akshare/futures_derivative/futures_index_price_nh.py +0 -61
- akshare/futures_derivative/futures_index_return_nh.py +0 -47
- akshare/futures_derivative/futures_index_volatility_nh.py +0 -51
- akshare/futures_derivative/futures_other_index_nh.py +0 -145
- akshare/index/index_fear_greed_funddb.py +0 -71
- akshare/index/index_investing.py +0 -232
- akshare/sport/sport_olympic_winter.py +0 -39
- akshare/stock_feature/stock_board_concept_ths.py +0 -422
- akshare/stock_fundamental/stock_register.py +0 -292
- akshare-1.12.99.dist-info/RECORD +0 -374
- {akshare-1.12.99.dist-info → akshare-1.15.73.dist-info}/LICENSE +0 -0
- {akshare-1.12.99.dist-info → akshare-1.15.73.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: 2024/
|
|
4
|
+
Date: 2024/7/13 18:00
|
|
5
5
|
Desc: 东方财富网-行情首页-沪深京 A 股
|
|
6
6
|
https://quote.eastmoney.com/
|
|
7
7
|
"""
|
|
@@ -30,7 +30,8 @@ def stock_zh_a_spot_em() -> pd.DataFrame:
|
|
|
30
30
|
"invt": "2",
|
|
31
31
|
"fid": "f3",
|
|
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
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,
|
|
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",
|
|
34
35
|
"_": "1623833739532",
|
|
35
36
|
}
|
|
36
37
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -144,7 +145,8 @@ def stock_sh_a_spot_em() -> pd.DataFrame:
|
|
|
144
145
|
"invt": "2",
|
|
145
146
|
"fid": "f3",
|
|
146
147
|
"fs": "m:1 t:2,m:1 t:23",
|
|
147
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,
|
|
148
|
+
"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",
|
|
148
150
|
"_": "1623833739532",
|
|
149
151
|
}
|
|
150
152
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -258,7 +260,8 @@ def stock_sz_a_spot_em() -> pd.DataFrame:
|
|
|
258
260
|
"invt": "2",
|
|
259
261
|
"fid": "f3",
|
|
260
262
|
"fs": "m:0 t:6,m:0 t:80",
|
|
261
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,
|
|
263
|
+
"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",
|
|
262
265
|
"_": "1623833739532",
|
|
263
266
|
}
|
|
264
267
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -372,7 +375,8 @@ def stock_bj_a_spot_em() -> pd.DataFrame:
|
|
|
372
375
|
"invt": "2",
|
|
373
376
|
"fid": "f3",
|
|
374
377
|
"fs": "m:0 t:81 s:2048",
|
|
375
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24
|
|
378
|
+
"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",
|
|
376
380
|
"_": "1623833739532",
|
|
377
381
|
}
|
|
378
382
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -487,7 +491,8 @@ def stock_new_a_spot_em() -> pd.DataFrame:
|
|
|
487
491
|
"wbp2u": "|0|0|0|web",
|
|
488
492
|
"fid": "f26",
|
|
489
493
|
"fs": "m:0 f:8,m:1 f:8",
|
|
490
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,
|
|
494
|
+
"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",
|
|
491
496
|
"_": "1623833739532",
|
|
492
497
|
}
|
|
493
498
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -606,7 +611,8 @@ def stock_cy_a_spot_em() -> pd.DataFrame:
|
|
|
606
611
|
"wbp2u": "|0|0|0|web",
|
|
607
612
|
"fid": "f3",
|
|
608
613
|
"fs": "m:0 t:80",
|
|
609
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,
|
|
614
|
+
"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",
|
|
610
616
|
"_": "1623833739532",
|
|
611
617
|
}
|
|
612
618
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -721,7 +727,8 @@ def stock_kc_a_spot_em() -> pd.DataFrame:
|
|
|
721
727
|
"wbp2u": "|0|0|0|web",
|
|
722
728
|
"fid": "f3",
|
|
723
729
|
"fs": "m:1 t:23",
|
|
724
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,
|
|
730
|
+
"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",
|
|
725
732
|
"_": "1623833739532",
|
|
726
733
|
}
|
|
727
734
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -835,7 +842,8 @@ def stock_zh_b_spot_em() -> pd.DataFrame:
|
|
|
835
842
|
"invt": "2",
|
|
836
843
|
"fid": "f3",
|
|
837
844
|
"fs": "m:0 t:7,m:1 t:3",
|
|
838
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20
|
|
845
|
+
"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",
|
|
839
847
|
"_": "1623833739532",
|
|
840
848
|
}
|
|
841
849
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -1050,6 +1058,7 @@ def stock_zh_a_hist(
|
|
|
1050
1058
|
if not (data_json["data"] and data_json["data"]["klines"]):
|
|
1051
1059
|
return pd.DataFrame()
|
|
1052
1060
|
temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
|
|
1061
|
+
temp_df["股票代码"] = symbol
|
|
1053
1062
|
temp_df.columns = [
|
|
1054
1063
|
"日期",
|
|
1055
1064
|
"开盘",
|
|
@@ -1062,6 +1071,7 @@ def stock_zh_a_hist(
|
|
|
1062
1071
|
"涨跌幅",
|
|
1063
1072
|
"涨跌额",
|
|
1064
1073
|
"换手率",
|
|
1074
|
+
"股票代码",
|
|
1065
1075
|
]
|
|
1066
1076
|
temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
|
|
1067
1077
|
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"], errors="coerce")
|
|
@@ -1074,6 +1084,22 @@ def stock_zh_a_hist(
|
|
|
1074
1084
|
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
|
|
1075
1085
|
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
|
|
1076
1086
|
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
|
|
1087
|
+
temp_df = temp_df[
|
|
1088
|
+
[
|
|
1089
|
+
"日期",
|
|
1090
|
+
"股票代码",
|
|
1091
|
+
"开盘",
|
|
1092
|
+
"收盘",
|
|
1093
|
+
"最高",
|
|
1094
|
+
"最低",
|
|
1095
|
+
"成交量",
|
|
1096
|
+
"成交额",
|
|
1097
|
+
"振幅",
|
|
1098
|
+
"涨跌幅",
|
|
1099
|
+
"涨跌额",
|
|
1100
|
+
"换手率",
|
|
1101
|
+
]
|
|
1102
|
+
]
|
|
1077
1103
|
return temp_df
|
|
1078
1104
|
|
|
1079
1105
|
|
|
@@ -1282,7 +1308,8 @@ def stock_hk_spot_em() -> pd.DataFrame:
|
|
|
1282
1308
|
"invt": "2",
|
|
1283
1309
|
"fid": "f3",
|
|
1284
1310
|
"fs": "m:128 t:3,m:128 t:4,m:128 t:1,m:128 t:2",
|
|
1285
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,
|
|
1311
|
+
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
|
|
1312
|
+
"f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
|
|
1286
1313
|
"_": "1624010056945",
|
|
1287
1314
|
}
|
|
1288
1315
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -1371,7 +1398,8 @@ def stock_hk_main_board_spot_em() -> pd.DataFrame:
|
|
|
1371
1398
|
"invt": "2",
|
|
1372
1399
|
"fid": "f3",
|
|
1373
1400
|
"fs": "m:128 t:3",
|
|
1374
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,
|
|
1401
|
+
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
|
|
1402
|
+
"f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152",
|
|
1375
1403
|
"_": "1624010056945",
|
|
1376
1404
|
}
|
|
1377
1405
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -1663,7 +1691,8 @@ def stock_us_spot_em() -> pd.DataFrame:
|
|
|
1663
1691
|
"invt": "2",
|
|
1664
1692
|
"fid": "f3",
|
|
1665
1693
|
"fs": "m:105,m:106,m:107",
|
|
1666
|
-
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,
|
|
1694
|
+
"fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,"
|
|
1695
|
+
"f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152",
|
|
1667
1696
|
"_": "1624010056945",
|
|
1668
1697
|
}
|
|
1669
1698
|
r = requests.get(url, timeout=15, params=params)
|
|
@@ -1799,7 +1828,7 @@ def stock_us_hist(
|
|
|
1799
1828
|
"涨跌额",
|
|
1800
1829
|
"换手率",
|
|
1801
1830
|
]
|
|
1802
|
-
temp_df.index = pd.to_datetime(temp_df["日期"])
|
|
1831
|
+
temp_df.index = pd.to_datetime(temp_df["日期"], errors="coerce")
|
|
1803
1832
|
temp_df = temp_df[start_date:end_date]
|
|
1804
1833
|
temp_df.reset_index(inplace=True, drop=True)
|
|
1805
1834
|
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"], errors="coerce")
|
|
@@ -1812,7 +1841,7 @@ def stock_us_hist(
|
|
|
1812
1841
|
temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce")
|
|
1813
1842
|
temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce")
|
|
1814
1843
|
temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce")
|
|
1815
|
-
temp_df.sort_values(["日期"], inplace=True)
|
|
1844
|
+
temp_df.sort_values(["日期"], inplace=True, ignore_index=True)
|
|
1816
1845
|
return temp_df
|
|
1817
1846
|
|
|
1818
1847
|
|
|
@@ -1843,7 +1872,7 @@ def stock_us_hist_min_em(
|
|
|
1843
1872
|
"secid": f"{symbol.split('.')[0]}.{symbol.split('.')[1]}",
|
|
1844
1873
|
"_": "1623766962675",
|
|
1845
1874
|
}
|
|
1846
|
-
r = requests.get(url,
|
|
1875
|
+
r = requests.get(url, params=params, timeout=15)
|
|
1847
1876
|
data_json = r.json()
|
|
1848
1877
|
if not data_json["data"]["trends"]:
|
|
1849
1878
|
return pd.DataFrame()
|
|
@@ -1858,7 +1887,7 @@ def stock_us_hist_min_em(
|
|
|
1858
1887
|
"成交额",
|
|
1859
1888
|
"最新价",
|
|
1860
1889
|
]
|
|
1861
|
-
temp_df.index = pd.to_datetime(temp_df["时间"])
|
|
1890
|
+
temp_df.index = pd.to_datetime(temp_df["时间"], errors="coerce")
|
|
1862
1891
|
temp_df = temp_df[start_date:end_date]
|
|
1863
1892
|
temp_df.reset_index(drop=True, inplace=True)
|
|
1864
1893
|
temp_df["开盘"] = pd.to_numeric(temp_df["开盘"], errors="coerce")
|
|
@@ -1868,7 +1897,7 @@ def stock_us_hist_min_em(
|
|
|
1868
1897
|
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
|
|
1869
1898
|
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
|
|
1870
1899
|
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
|
|
1871
|
-
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
|
|
1900
|
+
temp_df["时间"] = pd.to_datetime(temp_df["时间"], errors="coerce").astype(str)
|
|
1872
1901
|
return temp_df
|
|
1873
1902
|
|
|
1874
1903
|
|
|
@@ -1910,8 +1939,8 @@ if __name__ == "__main__":
|
|
|
1910
1939
|
symbol="000001",
|
|
1911
1940
|
period="daily",
|
|
1912
1941
|
start_date="20170301",
|
|
1913
|
-
end_date="
|
|
1914
|
-
adjust="",
|
|
1942
|
+
end_date="20240528",
|
|
1943
|
+
adjust="hfq",
|
|
1915
1944
|
)
|
|
1916
1945
|
print(stock_zh_a_hist_df)
|
|
1917
1946
|
|
|
@@ -1955,7 +1984,7 @@ if __name__ == "__main__":
|
|
|
1955
1984
|
symbol="106.TTE",
|
|
1956
1985
|
period="daily",
|
|
1957
1986
|
start_date="20200101",
|
|
1958
|
-
end_date="
|
|
1987
|
+
end_date="20240414",
|
|
1959
1988
|
adjust="qfq",
|
|
1960
1989
|
)
|
|
1961
1990
|
print(stock_us_hist_df)
|
|
@@ -1972,6 +2001,9 @@ if __name__ == "__main__":
|
|
|
1972
2001
|
stock_us_hist_min_em_df = stock_us_hist_min_em(symbol="106.TTE")
|
|
1973
2002
|
print(stock_us_hist_min_em_df)
|
|
1974
2003
|
|
|
2004
|
+
stock_us_hist_min_em_df = stock_us_hist_min_em(symbol="105.ATER")
|
|
2005
|
+
print(stock_us_hist_min_em_df)
|
|
2006
|
+
|
|
1975
2007
|
stock_zh_a_hist_min_em_df = stock_zh_a_hist_min_em(
|
|
1976
2008
|
symbol="000001",
|
|
1977
2009
|
start_date="2024-03-20 09:30:00",
|
|
@@ -1985,7 +2017,7 @@ if __name__ == "__main__":
|
|
|
1985
2017
|
symbol="833454",
|
|
1986
2018
|
period="daily",
|
|
1987
2019
|
start_date="20170301",
|
|
1988
|
-
end_date="
|
|
2020
|
+
end_date="20241115",
|
|
1989
2021
|
adjust="hfq",
|
|
1990
2022
|
)
|
|
1991
2023
|
print(stock_zh_a_hist_df)
|
|
@@ -1994,8 +2026,8 @@ if __name__ == "__main__":
|
|
|
1994
2026
|
symbol="01611",
|
|
1995
2027
|
period="1",
|
|
1996
2028
|
adjust="",
|
|
1997
|
-
start_date="2024-
|
|
1998
|
-
end_date="2024-
|
|
2029
|
+
start_date="2024-04-12 09:30:00",
|
|
2030
|
+
end_date="2024-04-12 18:32:00",
|
|
1999
2031
|
)
|
|
2000
2032
|
print(stock_hk_hist_min_em_df)
|
|
2001
2033
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/11/21 18:26
|
|
5
5
|
Desc: 百度股市通-港股-财务报表-估值数据
|
|
6
6
|
https://gushitong.baidu.com/stock/hk-06969
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
import http.client
|
|
9
10
|
import json
|
|
10
11
|
import urllib
|
|
@@ -22,25 +23,36 @@ def stock_hk_valuation_baidu(
|
|
|
22
23
|
:type symbol: str
|
|
23
24
|
:param indicator: choice of {"总市值", "市盈率(TTM)", "市盈率(静)", "市净率", "市现率"}
|
|
24
25
|
:type indicator: str
|
|
25
|
-
:param period: choice of {"近一年", "近三年", "
|
|
26
|
+
:param period: choice of {"近一年", "近三年", "全部"}
|
|
26
27
|
:type period: str
|
|
27
28
|
:return: 估值数据
|
|
28
29
|
:rtype: pandas.DataFrame
|
|
29
30
|
"""
|
|
30
31
|
params = {
|
|
31
|
-
"
|
|
32
|
+
"openapi": "1",
|
|
33
|
+
"dspName": "iphone",
|
|
34
|
+
"tn": "tangram",
|
|
35
|
+
"client": "app",
|
|
36
|
+
"query": indicator,
|
|
32
37
|
"code": symbol,
|
|
38
|
+
"word": "",
|
|
39
|
+
"resource_id": "51171",
|
|
33
40
|
"market": "hk",
|
|
34
41
|
"tag": indicator,
|
|
35
42
|
"chart_select": period,
|
|
36
|
-
"
|
|
43
|
+
"industry_select": "",
|
|
44
|
+
"skip_industry": "1",
|
|
37
45
|
"finClientType": "pc",
|
|
38
46
|
}
|
|
39
|
-
conn = http.client.HTTPSConnection("
|
|
40
|
-
conn.request("GET", f"/
|
|
47
|
+
conn = http.client.HTTPSConnection("gushitong.baidu.com")
|
|
48
|
+
conn.request(method="GET", url=f"/opendata?{urllib.parse.urlencode(params)}")
|
|
41
49
|
r = conn.getresponse()
|
|
42
50
|
data_json = json.loads(r.read())
|
|
43
|
-
temp_df = pd.DataFrame(
|
|
51
|
+
temp_df = pd.DataFrame(
|
|
52
|
+
data_json["Result"][0]["DisplayData"]["resultData"]["tplData"]["result"][
|
|
53
|
+
"chartInfo"
|
|
54
|
+
][0]["body"]
|
|
55
|
+
)
|
|
44
56
|
temp_df.columns = ["date", "value"]
|
|
45
57
|
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
|
|
46
58
|
temp_df["value"] = pd.to_numeric(temp_df["value"])
|
|
@@ -49,6 +61,6 @@ def stock_hk_valuation_baidu(
|
|
|
49
61
|
|
|
50
62
|
if __name__ == "__main__":
|
|
51
63
|
stock_hk_valuation_baidu_df = stock_hk_valuation_baidu(
|
|
52
|
-
symbol="
|
|
64
|
+
symbol="06969", indicator="总市值", period="近三年"
|
|
53
65
|
)
|
|
54
66
|
print(stock_hk_valuation_baidu_df)
|