mns-common 1.4.3.4__tar.gz → 1.5.2.8__tar.gz
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 mns-common might be problematic. Click here for more details.
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/PKG-INFO +1 -1
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/akshare/k_line_api.py +19 -2
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_bid_ask_api.py +10 -3
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_zt_pool_api.py +1 -1
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py +62 -7
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_debt_api.py +144 -19
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_etf_api.py +140 -10
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_a_api.py +24 -28
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_a_v2_api.py +103 -7
- mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_common_rename.py +109 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_hk_api.py +11 -109
- mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py +260 -0
- mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py +146 -0
- mns_common-1.5.2.8/mns_common/api/em/real_time/real_time_quotes_repeat_api.py +428 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/k_line/stock_k_line_data_api.py +11 -1
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/common/kpl_common_api.py +35 -0
- mns_common-1.5.2.8/mns_common/api/proxies/liu_guan_proxy_api.py +115 -0
- mns_common-1.5.2.8/mns_common/api/ths/company/company_product_area_industry_index_query.py +46 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/wen_cai/ths_wen_cai_api.py +1 -1
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/zt/ths_stock_zt_pool_api.py +14 -1
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +94 -29
- mns_common-1.5.2.8/mns_common/api/xueqiu/xue_qiu_k_line_api.py +83 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/common_service_fun_api.py +5 -0
- mns_common-1.5.2.8/mns_common/component/deal/deal_service_v2_api.py +167 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/em/em_stock_info_api.py +7 -1
- mns_common-1.5.2.8/mns_common/component/proxies/proxy_common_api.py +252 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/db_name_constant.py +6 -0
- mns_common-1.5.2.8/mns_common/db/__init__.py +7 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common.egg-info/PKG-INFO +1 -1
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common.egg-info/SOURCES.txt +6 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/setup.py +1 -1
- mns_common-1.4.3.4/mns_common/api/proxies/liu_guan_proxy_api.py +0 -65
- mns_common-1.4.3.4/mns_common/api/xueqiu/xue_qiu_k_line_api.py +0 -83
- mns_common-1.4.3.4/mns_common/component/proxies/proxy_common_api.py +0 -156
- mns_common-1.4.3.4/mns_common/utils/__init__.py +0 -8
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/README.md +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/__init__.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/em → mns_common-1.5.2.8/mns_common/api/akshare}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_dt_pool.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_zb_pool.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/akshare/yjyg_sync_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/kpl → mns_common-1.5.2.8/mns_common/api/em}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/concept/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/concept/em_concept_index_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/gd/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_us_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/hk/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/hk/ths_hk_company_info_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/k_line/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/k_line/stock_minute_data_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/kpl/constant → mns_common-1.5.2.8/mns_common/api/kpl}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/common/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/common/kpl_common_field_constant.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/concept/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/concept/kpl_concept_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/kpl/selection → mns_common-1.5.2.8/mns_common/api/kpl/constant}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/constant/kpl_constant.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/industry/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/industry/kpl_industry_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/msg → mns_common-1.5.2.8/mns_common/api/kpl/selection}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/selection/kpl_selection_plate_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/kpl_real_time_quotes_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/kpl_symbol_common_field_constant.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/symbol_his_quotes_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/ths → mns_common-1.5.2.8/mns_common/api/msg}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/msg/push_msg_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/proxies/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/qmt/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/qmt/qmt_minunte_tick_data.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/ths/big_deal → mns_common-1.5.2.8/mns_common/api/ths}/__init__.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/ths/concept → mns_common-1.5.2.8/mns_common/api/ths/big_deal}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/big_deal/ths_big_deal_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/company/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/company/ths_company_announce_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/company/ths_company_info_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/ths/concept/app → mns_common-1.5.2.8/mns_common/api/ths/concept}/__init__.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/ths/concept/web → mns_common-1.5.2.8/mns_common/api/ths/concept/app}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/concept/app/ths_concept_detail_app.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/concept/app/ths_concept_index_app.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/ths/self_choose → mns_common-1.5.2.8/mns_common/api/ths/concept/web}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_common_js_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_company_info_web.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_concept_detail_web.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_concept_index_web.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/ths/wen_cai → mns_common-1.5.2.8/mns_common/api/ths/self_choose}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/self_choose/ths_self_choose_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/component → mns_common-1.5.2.8/mns_common/api/ths/wen_cai}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/ths/zt/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/us/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/us/ths_us_company_info_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/xueqiu/__init__.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/cache → mns_common-1.5.2.8/mns_common/component}/__init__.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/company → mns_common-1.5.2.8/mns_common/component/cache}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/cache/cache_service.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/classify/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/classify/symbol_classify_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/classify/symbol_classify_param.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/concept → mns_common-1.5.2.8/mns_common/component/company}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/company/company_common_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/company/company_common_service_new_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/data → mns_common-1.5.2.8/mns_common/component/concept}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/concept/kpl_concept_common_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/concept/ths_concept_common_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/cookie/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/cookie/cookie_enum.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/cookie/cookie_info_service.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/industry → mns_common-1.5.2.8/mns_common/component/data}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/data/data_init_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/deal/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/deal/deal_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/deal/terminal_enum.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/em/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/em/em_real_time_quotes_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/exception/ExceptionMonitor.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/exception/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/hk/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/hk/company_hk_service_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/k_line → mns_common-1.5.2.8/mns_common/component/industry}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/industry/ths_industry_index_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/k_line/clean → mns_common-1.5.2.8/mns_common/component/k_line}/__init__.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/k_line/common → mns_common-1.5.2.8/mns_common/component/k_line/clean}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/k_line/clean/k_line_param.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/k_line/clean/sh_small_normal_zt_k_line_check_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/k_line/patterns → mns_common-1.5.2.8/mns_common/component/k_line/common}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/k_line/common/k_line_common_service_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/real_time → mns_common-1.5.2.8/mns_common/component/k_line/patterns}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/k_line/patterns/k_line_patterns_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/k_line/patterns/pattern_Enum.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/price/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/price/trade_price_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/proxies/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/qmt/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/qmt/qmt_buy_service.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/trade_date → mns_common-1.5.2.8/mns_common/component/real_time}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/real_time/real_time_common_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/redis_msg/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/redis_msg/redis_msg_publish_service.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/self_choose/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/self_choose/black_list_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/self_choose/self_choose_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/task/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/task/real_time_data_sync_check.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/tfp/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/tfp/stock_tfp_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/component/zt → mns_common-1.5.2.8/mns_common/component/trade_date}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/trade_date/trade_date_common_service_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/us/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/us/us_stock_etf_info_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/db → mns_common-1.5.2.8/mns_common/component/zt}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/component/zt/zt_common_service_api.py +0 -0
- {mns_common-1.4.3.4/mns_common/api/akshare → mns_common-1.5.2.8/mns_common/constant}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/black_list_classify_enum.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/east_money_stock_api.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/extra_income_db_name.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/price_enum.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/redis_msg_constant.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/self_choose_constant.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/constant/strategy_classify.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/db/MongodbUtil.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/db/MongodbUtilLocal.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/db/v2/MongodbUtilV2.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/db/v2/__init__.py +0 -0
- {mns_common-1.4.3.4/mns_common/constant → mns_common-1.5.2.8/mns_common/utils}/__init__.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/utils/async_fun.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/utils/cmd_util.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/utils/data_frame_util.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/utils/date_handle_util.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/utils/db_util.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/utils/file_util.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/utils/ip_util.py +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common.egg-info/dependency_links.txt +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common.egg-info/top_level.txt +0 -0
- {mns_common-1.4.3.4 → mns_common-1.5.2.8}/setup.cfg +0 -0
|
@@ -18,6 +18,7 @@ def stock_zh_a_hist(
|
|
|
18
18
|
start_date: str = "19700101",
|
|
19
19
|
end_date: str = "22220101",
|
|
20
20
|
adjust: str = "",
|
|
21
|
+
proxies: str = None
|
|
21
22
|
) -> pd.DataFrame:
|
|
22
23
|
"""
|
|
23
24
|
东方财富网-行情首页-沪深京 A 股-每日行情
|
|
@@ -32,6 +33,9 @@ def stock_zh_a_hist(
|
|
|
32
33
|
:type end_date: str
|
|
33
34
|
:param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
|
|
34
35
|
:type adjust: str
|
|
36
|
+
:param proxies: 代理ip
|
|
37
|
+
:type proxies: str
|
|
38
|
+
|
|
35
39
|
:return: 每日行情
|
|
36
40
|
:rtype: pandas.DataFrame
|
|
37
41
|
"""
|
|
@@ -53,7 +57,12 @@ def stock_zh_a_hist(
|
|
|
53
57
|
"end": "20500000",
|
|
54
58
|
"_": now_time,
|
|
55
59
|
}
|
|
56
|
-
|
|
60
|
+
|
|
61
|
+
if proxies is None:
|
|
62
|
+
r = requests.get(url, params=params)
|
|
63
|
+
else:
|
|
64
|
+
r = requests.get(url, params=params, proxies=proxies)
|
|
65
|
+
|
|
57
66
|
data_json = r.json()
|
|
58
67
|
temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
|
|
59
68
|
temp_df.columns = [
|
|
@@ -100,7 +109,15 @@ def stock_zh_a_hist(
|
|
|
100
109
|
return temp_df
|
|
101
110
|
|
|
102
111
|
|
|
112
|
+
import mns_common.component.proxies.proxy_common_api as proxy_common_api
|
|
113
|
+
|
|
103
114
|
if __name__ == '__main__':
|
|
104
115
|
while True:
|
|
105
|
-
|
|
116
|
+
proxy_ip = proxy_common_api.get_proxy_ip(5)
|
|
117
|
+
df = stock_zh_a_hist("0.000001",
|
|
118
|
+
'daily',
|
|
119
|
+
"19700101",
|
|
120
|
+
"22220101",
|
|
121
|
+
"",
|
|
122
|
+
proxy_ip)
|
|
106
123
|
print(df)
|
|
@@ -9,7 +9,7 @@ import pandas as pd
|
|
|
9
9
|
import requests
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def stock_bid_ask_em(symbol: str = "000001") ->
|
|
12
|
+
def stock_bid_ask_em(symbol: str = "000001") -> pd.DataFrame:
|
|
13
13
|
"""
|
|
14
14
|
东方财富-行情报价
|
|
15
15
|
https://quote.eastmoney.com/sz000001.html
|
|
@@ -22,8 +22,15 @@ def stock_bid_ask_em(symbol: str = "000001") -> dict:
|
|
|
22
22
|
params = {
|
|
23
23
|
"fltt": "2",
|
|
24
24
|
"invt": "2",
|
|
25
|
-
"fields": "
|
|
26
|
-
|
|
25
|
+
"fields": "f120,f121,f122,f174,f175,f59,f163,f43,f57,f58,f169,f170,f46,f44,f51,"
|
|
26
|
+
"f168,f47,f164,f116,f60,f45,f52,f50,f48,f167,f117,f71,f161,f49,f530,"
|
|
27
|
+
"f135,f136,f137,f138,f139,f141,f142,f144,f145,f147,f148,f140,f143,f146,"
|
|
28
|
+
"f149,f55,f62,f162,f92,f173,f104,f105,f84,f85,f183,f184,f185,f186,f187,"
|
|
29
|
+
"f188,f189,f190,f191,f192,f107,f111,f86,f177,f78,f110,f262,f263,f264,f267,"
|
|
30
|
+
"f268,f255,f256,f257,f258,f127,f199,f128,f198,f259,f260,f261,f171,f277,f278,"
|
|
31
|
+
"f279,f288,f152,f250,f251,f252,f253,f254,f269,f270,f271,f272,f273,f274,f275,"
|
|
32
|
+
"f276,f265,f266,f289,f290,f286,f285,f292,f293,f294,f295",
|
|
33
|
+
|
|
27
34
|
"secid": symbol,
|
|
28
35
|
}
|
|
29
36
|
r = requests.get(url, params=params)
|
|
@@ -13,6 +13,7 @@ import mns_common.component.em.em_stock_info_api as em_stock_info_api
|
|
|
13
13
|
from mns_common.db.MongodbUtil import MongodbUtil
|
|
14
14
|
import mns_common.constant.db_name_constant as db_name_constant
|
|
15
15
|
import mns_common.component.company.company_common_service_new_api as company_common_service_new_api
|
|
16
|
+
from datetime import datetime
|
|
16
17
|
|
|
17
18
|
mongodb_util = MongodbUtil('27017')
|
|
18
19
|
|
|
@@ -38,6 +39,8 @@ def get_stock_gdfx_free_top_10_em_api(str_day, symbol):
|
|
|
38
39
|
return None
|
|
39
40
|
stock_gdfx_free_top_10_em_df = stock_gdfx_free_top_10_em_df.fillna(0)
|
|
40
41
|
stock_gdfx_free_top_10_em_df.index = stock_gdfx_free_top_10_em_df.index.astype(str)
|
|
42
|
+
stock_gdfx_free_top_10_em_df.drop_duplicates('shareholder_name', keep='last', inplace=True)
|
|
43
|
+
|
|
41
44
|
return stock_gdfx_free_top_10_em_df
|
|
42
45
|
|
|
43
46
|
|
|
@@ -58,6 +61,7 @@ def get_stock_gdfx_top_10_em_api(str_day, symbol):
|
|
|
58
61
|
return None
|
|
59
62
|
stock_gdfx_top_10_em_df = stock_gdfx_top_10_em_df.fillna(0)
|
|
60
63
|
stock_gdfx_top_10_em_df.index = stock_gdfx_top_10_em_df.index.astype(str)
|
|
64
|
+
stock_gdfx_top_10_em_df.drop_duplicates('shareholder_name', keep='last', inplace=True)
|
|
61
65
|
return stock_gdfx_top_10_em_df
|
|
62
66
|
|
|
63
67
|
|
|
@@ -159,10 +163,34 @@ def get_stock_gdfx_free_top_10_em(str_day, symbol):
|
|
|
159
163
|
# 保存10大流通股东
|
|
160
164
|
def sync_stock_gdfx_free_top_10(stock_gdfx_free_top_10_em_df, period, symbol, str_day):
|
|
161
165
|
if stock_gdfx_free_top_10_em_df is not None and stock_gdfx_free_top_10_em_df.shape[0] > 0:
|
|
166
|
+
# 更新日期
|
|
162
167
|
stock_gdfx_free_top_10_em_df['str_day'] = str_day
|
|
168
|
+
|
|
163
169
|
stock_gdfx_free_top_10_em_df['symbol'] = symbol
|
|
164
|
-
|
|
170
|
+
|
|
171
|
+
stock_gdfx_free_top_10_em_df['shares_number_str'] = stock_gdfx_free_top_10_em_df['shares_number'].astype(str)
|
|
172
|
+
|
|
173
|
+
stock_gdfx_free_top_10_em_df[
|
|
174
|
+
'_id'] = symbol + '_' + period + '_' + stock_gdfx_free_top_10_em_df.shares_number_str
|
|
165
175
|
stock_gdfx_free_top_10_em_df['period'] = period
|
|
176
|
+
|
|
177
|
+
query_exist = {'symbol': symbol, 'period': period}
|
|
178
|
+
exist_df = mongodb_util.find_query_data(db_name_constant.STOCK_GDFX_FREE_TOP_10, query_exist)
|
|
179
|
+
now_date = datetime.now()
|
|
180
|
+
str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
181
|
+
# 不存在的时候更新创建时间
|
|
182
|
+
if exist_df.shape[0] == 0:
|
|
183
|
+
stock_gdfx_free_top_10_em_df['create_day'] = str_day
|
|
184
|
+
stock_gdfx_free_top_10_em_df['sync_time'] = str_now_date
|
|
185
|
+
else:
|
|
186
|
+
if 'create_day' in exist_df.columns:
|
|
187
|
+
stock_gdfx_free_top_10_em_df['create_day'] = list(exist_df['create_day'])[0]
|
|
188
|
+
else:
|
|
189
|
+
stock_gdfx_free_top_10_em_df['create_day'] = str_day
|
|
190
|
+
if 'sync_time' in exist_df.columns:
|
|
191
|
+
stock_gdfx_free_top_10_em_df['sync_time'] = list(exist_df['sync_time'])[0]
|
|
192
|
+
else:
|
|
193
|
+
stock_gdfx_free_top_10_em_df['sync_time'] = str_now_date
|
|
166
194
|
mongodb_util.save_mongo(stock_gdfx_free_top_10_em_df, db_name_constant.STOCK_GDFX_FREE_TOP_10)
|
|
167
195
|
|
|
168
196
|
|
|
@@ -171,8 +199,34 @@ def sync_stock_gdfx_top_10(stock_gdfx_top_10_em_df, period, symbol, str_day):
|
|
|
171
199
|
if stock_gdfx_top_10_em_df is not None and stock_gdfx_top_10_em_df.shape[0] > 0:
|
|
172
200
|
stock_gdfx_top_10_em_df['str_day'] = str_day
|
|
173
201
|
stock_gdfx_top_10_em_df['symbol'] = symbol
|
|
174
|
-
|
|
202
|
+
|
|
203
|
+
stock_gdfx_top_10_em_df['shares_number_str'] = stock_gdfx_top_10_em_df['shares_number'].astype(str)
|
|
204
|
+
|
|
205
|
+
stock_gdfx_top_10_em_df['_id'] = symbol + '_' + period + '_' + stock_gdfx_top_10_em_df.shares_number_str
|
|
175
206
|
stock_gdfx_top_10_em_df['period'] = period
|
|
207
|
+
|
|
208
|
+
query_exist = {'symbol': symbol, 'period': period}
|
|
209
|
+
exist_df = mongodb_util.find_query_data(db_name_constant.STOCK_GDFX_TOP_10, query_exist)
|
|
210
|
+
now_date = datetime.now()
|
|
211
|
+
str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
212
|
+
|
|
213
|
+
# 不存在的时候更新创建时间
|
|
214
|
+
if exist_df.shape[0] == 0:
|
|
215
|
+
stock_gdfx_top_10_em_df['create_day'] = str_day
|
|
216
|
+
stock_gdfx_top_10_em_df['sync_time'] = str_now_date
|
|
217
|
+
else:
|
|
218
|
+
if 'create_day' in exist_df.columns:
|
|
219
|
+
stock_gdfx_top_10_em_df['create_day'] = list(exist_df['create_day'])[0]
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
else:
|
|
223
|
+
stock_gdfx_top_10_em_df['create_day'] = str_day
|
|
224
|
+
|
|
225
|
+
if 'sync_time' in exist_df.columns:
|
|
226
|
+
stock_gdfx_top_10_em_df['sync_time'] = list(exist_df['sync_time'])[0]
|
|
227
|
+
else:
|
|
228
|
+
stock_gdfx_top_10_em_df['sync_time'] = str_now_date
|
|
229
|
+
|
|
176
230
|
mongodb_util.save_mongo(stock_gdfx_top_10_em_df, db_name_constant.STOCK_GDFX_TOP_10)
|
|
177
231
|
|
|
178
232
|
|
|
@@ -184,14 +238,15 @@ def sync_stock_gdfx_free_top_10_one_day(str_day):
|
|
|
184
238
|
for real_time_one in real_time_quotes.itertuples():
|
|
185
239
|
try:
|
|
186
240
|
get_stock_gdfx_free_top_10_em(str_day, real_time_one.symbol)
|
|
241
|
+
logger.info('同步股票前十大流通东:{},{}', real_time_one.symbol, real_time_one.name)
|
|
187
242
|
except BaseException as e:
|
|
188
243
|
logger.error('同步所有股票前十大流通股本异常:{},{}', real_time_one.symbol, e)
|
|
244
|
+
logger.info('同步所有股票股东列表完成:{}', str_day)
|
|
189
245
|
|
|
190
246
|
|
|
191
|
-
from datetime import datetime
|
|
192
|
-
|
|
193
247
|
if __name__ == '__main__':
|
|
194
|
-
|
|
195
|
-
|
|
248
|
+
get_stock_gdfx_free_top_10_em('20250930', '300697')
|
|
249
|
+
now_date_test = datetime.now()
|
|
250
|
+
str_day_test = now_date_test.strftime('%Y-%m-%d')
|
|
196
251
|
logger.info('同步所有股票前十大流通股本')
|
|
197
|
-
|
|
252
|
+
sync_stock_gdfx_free_top_10_one_day(str_day_test)
|
{mns_common-1.4.3.4 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_debt_api.py
RENAMED
|
@@ -8,14 +8,19 @@ file_path = os.path.abspath(__file__)
|
|
|
8
8
|
end = file_path.index('mns') + 14
|
|
9
9
|
project_path = file_path[0:end]
|
|
10
10
|
sys.path.append(project_path)
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
import akshare as ak
|
|
12
14
|
import pandas as pd
|
|
13
15
|
from loguru import logger
|
|
14
|
-
import json
|
|
15
16
|
import requests
|
|
16
17
|
import time
|
|
17
|
-
import akshare as ak
|
|
18
18
|
import numpy as np
|
|
19
|
+
import mns_common.component.proxies.proxy_common_api as proxy_common_api
|
|
20
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
21
|
+
from threading import Lock
|
|
22
|
+
import concurrent.futures
|
|
23
|
+
import mns_common.utils.data_frame_util as data_frame_util
|
|
19
24
|
|
|
20
25
|
# 最大返回条数
|
|
21
26
|
max_number = 600
|
|
@@ -24,19 +29,58 @@ min_number = 500
|
|
|
24
29
|
# 分页条数
|
|
25
30
|
page_number = 100
|
|
26
31
|
|
|
32
|
+
fields = ("f352,f2,f3,f5,f6,f8,f10,f11,f22,f12,f14,f15,f16,f17,f18,f20,f21,f26,f33,f34,f35,f62,f66,f69,f72,f184,"
|
|
33
|
+
"f211,f212,f232,f233,f234")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_kzz_count(pn, proxies, page_size, time_out):
|
|
37
|
+
current_timestamp = str(int(round(time.time() * 1000, 0)))
|
|
38
|
+
url = "https://push2.eastmoney.com/api/qt/clist/get"
|
|
39
|
+
|
|
40
|
+
params = {
|
|
41
|
+
"cb": "jQuery34103608466964799838_" + current_timestamp,
|
|
42
|
+
"pn": str(pn),
|
|
43
|
+
"np": 3,
|
|
44
|
+
"ut": "8a086bfc3570bdde64a6a1c585cccb35",
|
|
45
|
+
"fltt": 1,
|
|
46
|
+
"invt": 1,
|
|
47
|
+
"fs": "m:0+e:11,m:1+e:11,m:1+e:11+s:4194304,m:0+e:11+s:8388608",
|
|
48
|
+
"dpt": "zqsc.zpg",
|
|
49
|
+
"fields": fields,
|
|
50
|
+
"wbp2u": "|0|0|0|wap",
|
|
51
|
+
"fid": "f12",
|
|
52
|
+
"po": 1,
|
|
53
|
+
"pz": str(page_size),
|
|
54
|
+
"_": current_timestamp
|
|
55
|
+
}
|
|
56
|
+
try:
|
|
57
|
+
if proxies is None:
|
|
58
|
+
r = requests.get(url, params, timeout=time_out)
|
|
59
|
+
else:
|
|
60
|
+
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
61
|
+
data_text = r.text
|
|
62
|
+
try:
|
|
63
|
+
begin_index_total = data_text.index('"total":')
|
|
64
|
+
|
|
65
|
+
end_index_total = data_text.index('"diff"')
|
|
66
|
+
global max_number
|
|
67
|
+
max_number = int(data_text[begin_index_total + 8:end_index_total - 1])
|
|
68
|
+
return max_number
|
|
69
|
+
except Exception as e:
|
|
70
|
+
logger.error(f"获取第{pn}页可转债列表异常: {e}")
|
|
71
|
+
return 0
|
|
72
|
+
|
|
73
|
+
except Exception as e:
|
|
74
|
+
logger.error("获取可转债列表,实时行情异常:{}", e)
|
|
75
|
+
return 0
|
|
27
76
|
|
|
28
|
-
# fields_02 = "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24,f25,f26,f27,f28,f29,f30,f31,f32,f33,f34,f35,f36,f37,f38,f39,f40,f41,f42,f43,f44,f45,f46,f47,f48,f49,f50,f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65,f66,f67,f68,f69,f70,f71,f72,f73,f74,f75,f76,f77,f78,f79,f80,f81,f82,f83,f84,f85,f86,f87,f88,f89,f90,f91,f92,f93,f94,f95,f96,f97,f98,f99,f100,f101,f102,f103,f104,f105,f106,f107,f108" \
|
|
29
|
-
# ",f109,f110,f111,f112,f113,f114,f115,f116,f117,f118,f119,f120,f121,f122,f123,f124,f125,f126,f127,f128,f129,f130,f131,f132,f133,f134,f135,f136,f137,f138,f139,f140,f141,f142,f143,f144,f145,f146,f147,f148,f149,f150,f151,f152,f153,f154,f155,f156,f157,f158,f159,f160,f161,f162,f163,f164,f165,f166,f167,f168,f169,f170,f171,f172,f173,f174,f175,f176,f177,f178,f179,f180,f181,f182,f183,f184,f185,f186,f187,f188,f189,f190,f191,f192,f193,f194,f195,f196,f197,f198,f199,f200" \
|
|
30
|
-
# ",f209,f210,f211,f212,f213,f214,f215,f216,f217,f218,f219,f220,f221,f222,f223,f224,f225,f226,f227,f228,f229,f230,f231,f232,f233,f234,f235,f236,f237,f238,f239,f240,f241,f242,f243,f244,f245,f246,f247,f248,f249,f250,f251,f252,f253,f254,f255,f256,f257,f258,f259,f260,f261,f262,f263,f264,f265,f266,f267,f268,f269,f270,f271,f272,f273,f274,f275,f276,f277,f278,f279,f280,f281,f282,f283,f284,f285,f286,f287,f288,f289,f290,f291,f292,f293,f294,f295,f296,f297,f298,f299,f300" \
|
|
31
|
-
# ",f309,f310,f312,f313,f314,f315,f316,f317,f318,f319,f320,f321,f322,f323,f324,f325,f326,f327,f328,f329,f330,f331,f332,f333,f334,f335,f336,f337,f338,f339,f340,f341,f342,f343,f344,f345,f346,f347,f348,f349,f350,f351,f352,f353,f354,f355,f356,f357,f358,f359,f360,f361,f362,f363,f364,f365,f366,f367,f368,f369,f370,f371,f372,f373,f374,f375,f376,f377,f378,f379,f380,f381,f382,f383,f384,f385,f386,f387,f388,f389,f390,f391,f392,f393,f394,f395,f396,f397,f398,f399,f401"
|
|
32
|
-
#
|
|
33
77
|
|
|
34
78
|
#
|
|
35
79
|
# url = https://push2.eastmoney.com/api/qt/clist/get?cb=jQuery34103608466964799838_1718163189869&pn=1&np=1&ut
|
|
36
80
|
# =8a086bfc3570bdde64a6a1c585cccb35&fltt=1&invt=1&fs=m:0+e:11,m:1+e:11,m:1+e:11+s:4194304,
|
|
37
81
|
# m:0+e:11+s:8388608&dpt=zqsc.zpg&fields=f1,f2,f3,f4,f5,f6,f8,f10,f12,f13,f14,f18,f22,f152,
|
|
38
82
|
# f237&wbp2u=|0|0|0|wap&fid=f3&po=1&pz=2000&_=1718163189870
|
|
39
|
-
def get_debt_page_data(
|
|
83
|
+
def get_debt_page_data(pn, proxies, page_size, time_out) -> pd.DataFrame:
|
|
40
84
|
current_timestamp = str(int(round(time.time() * 1000, 0)))
|
|
41
85
|
url = "https://push2.eastmoney.com/api/qt/clist/get"
|
|
42
86
|
|
|
@@ -53,14 +97,14 @@ def get_debt_page_data(fields, pn, proxies) -> pd.DataFrame:
|
|
|
53
97
|
"wbp2u": "|0|0|0|wap",
|
|
54
98
|
"fid": "f12",
|
|
55
99
|
"po": 1,
|
|
56
|
-
"pz":
|
|
100
|
+
"pz": str(page_size),
|
|
57
101
|
"_": current_timestamp
|
|
58
102
|
}
|
|
59
103
|
try:
|
|
60
104
|
if proxies is None:
|
|
61
|
-
r = requests.get(url, params)
|
|
105
|
+
r = requests.get(url, params, timeout=time_out)
|
|
62
106
|
else:
|
|
63
|
-
r = requests.get(url, params, proxies=proxies)
|
|
107
|
+
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
64
108
|
data_text = r.text
|
|
65
109
|
|
|
66
110
|
if pn == 1:
|
|
@@ -117,8 +161,6 @@ def all_debt_ticker_data(fields, proxies) -> pd.DataFrame:
|
|
|
117
161
|
|
|
118
162
|
|
|
119
163
|
def get_debt_real_time_quotes(proxies):
|
|
120
|
-
fields = ("f352,f2,f3,f5,f6,f8,f10,f11,f22,f12,f14,f15,f16,f17,f18,f20,f21,f26,f33,f34,f35,f62,f66,f69,f72,f184,"
|
|
121
|
-
"f211,f212,f232,f233,f234")
|
|
122
164
|
# 获取第一页数据
|
|
123
165
|
page_one_df = get_debt_page_data(fields, 1, proxies)
|
|
124
166
|
# 数据接口正常返回5600以上的数量
|
|
@@ -298,9 +340,92 @@ def get_kzz_bond_info():
|
|
|
298
340
|
logger.error("获取可转债信息异常:{}", e)
|
|
299
341
|
|
|
300
342
|
|
|
343
|
+
def repeated_acquisition_ask_etf_async(time_out, max_number, num_threads, pages_per_thread):
|
|
344
|
+
per_page = page_number
|
|
345
|
+
total_pages = (max_number + per_page - 1) // per_page # 向上取整
|
|
346
|
+
result_df = pd.DataFrame()
|
|
347
|
+
|
|
348
|
+
# 创建线程锁以确保线程安全
|
|
349
|
+
df_lock = Lock()
|
|
350
|
+
|
|
351
|
+
# 计算每个线程处理的页数范围
|
|
352
|
+
def process_page_range(start_page, end_page, thread_id):
|
|
353
|
+
nonlocal result_df
|
|
354
|
+
local_df = pd.DataFrame()
|
|
355
|
+
current_page = start_page
|
|
356
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
357
|
+
|
|
358
|
+
while current_page <= end_page and current_page <= total_pages:
|
|
359
|
+
proxies = {"https": proxy_ip, "http": proxy_ip}
|
|
360
|
+
try:
|
|
361
|
+
page_df = get_debt_page_data(current_page, proxies, page_number, time_out)
|
|
362
|
+
if data_frame_util.is_not_empty(page_df):
|
|
363
|
+
local_df = pd.concat([local_df, page_df])
|
|
364
|
+
logger.info("线程{}获取页面数据成功: {}", thread_id, current_page)
|
|
365
|
+
current_page += 1
|
|
366
|
+
else:
|
|
367
|
+
time.sleep(0.2)
|
|
368
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
369
|
+
logger.info("线程{}获取页面数据失败: {}", thread_id, current_page)
|
|
370
|
+
except BaseException as e:
|
|
371
|
+
time.sleep(1)
|
|
372
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
373
|
+
logger.error("线程{}处理页面{}时发生错误: {}", thread_id, current_page, e)
|
|
374
|
+
|
|
375
|
+
with df_lock:
|
|
376
|
+
result_df = pd.concat([result_df, local_df])
|
|
377
|
+
return len(local_df)
|
|
378
|
+
|
|
379
|
+
# 计算每个线程的页面范围
|
|
380
|
+
page_ranges = []
|
|
381
|
+
for i in range(num_threads):
|
|
382
|
+
start_page = i * pages_per_thread + 1
|
|
383
|
+
end_page = (i + 1) * pages_per_thread
|
|
384
|
+
if start_page > total_pages:
|
|
385
|
+
break
|
|
386
|
+
page_ranges.append((start_page, end_page, i + 1))
|
|
387
|
+
|
|
388
|
+
# 使用线程池执行任务
|
|
389
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
|
|
390
|
+
# 提交所有任务
|
|
391
|
+
futures = [
|
|
392
|
+
executor.submit(process_page_range, start, end, tid)
|
|
393
|
+
for start, end, tid in page_ranges
|
|
394
|
+
]
|
|
395
|
+
|
|
396
|
+
# 等待所有任务完成并获取结果
|
|
397
|
+
results = []
|
|
398
|
+
for future in concurrent.futures.as_completed(futures):
|
|
399
|
+
try:
|
|
400
|
+
result = future.result()
|
|
401
|
+
results.append(result)
|
|
402
|
+
except Exception as e:
|
|
403
|
+
logger.error("线程执行出错: {}", e)
|
|
404
|
+
|
|
405
|
+
return rename_real_time_quotes_df(result_df)
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
def get_kzz_real_time_quotes(time_out, pages_per_thread):
|
|
409
|
+
try_numer = 3
|
|
410
|
+
while try_numer > 0:
|
|
411
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
412
|
+
proxies = {"https": proxy_ip,
|
|
413
|
+
"http": proxy_ip}
|
|
414
|
+
|
|
415
|
+
max_number = get_kzz_count(1, proxies, 20, time_out)
|
|
416
|
+
if max_number > 0:
|
|
417
|
+
break
|
|
418
|
+
try_numer = try_numer - 1
|
|
419
|
+
if max_number == 0:
|
|
420
|
+
return pd.DataFrame()
|
|
421
|
+
|
|
422
|
+
total_pages = (max_number + page_number - 1) // page_number # 向上取整
|
|
423
|
+
|
|
424
|
+
num_threads = int((total_pages / pages_per_thread) + 1)
|
|
425
|
+
return repeated_acquisition_ask_etf_async(time_out, max_number, num_threads, pages_per_thread)
|
|
426
|
+
|
|
427
|
+
|
|
301
428
|
if __name__ == '__main__':
|
|
302
|
-
|
|
303
|
-
print(
|
|
304
|
-
|
|
305
|
-
df = get_debt_real_time_quotes(None)
|
|
306
|
-
logger.info(df)
|
|
429
|
+
test_df = get_kzz_real_time_quotes(30, 6)
|
|
430
|
+
print(test_df)
|
|
431
|
+
|
|
@@ -6,12 +6,16 @@ end = file_path.index('mns') + 16
|
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
|
|
9
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
10
9
|
import pandas as pd
|
|
11
10
|
from loguru import logger
|
|
12
11
|
import requests
|
|
13
12
|
import time
|
|
14
13
|
import numpy as np
|
|
14
|
+
import mns_common.component.proxies.proxy_common_api as proxy_common_api
|
|
15
|
+
import concurrent.futures
|
|
16
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
17
|
+
from threading import Lock
|
|
18
|
+
import mns_common.utils.data_frame_util as data_frame_util
|
|
15
19
|
|
|
16
20
|
# 最大返回条数
|
|
17
21
|
max_number = 1200
|
|
@@ -21,7 +25,7 @@ min_number = 1000
|
|
|
21
25
|
page_number = 100
|
|
22
26
|
|
|
23
27
|
|
|
24
|
-
def
|
|
28
|
+
def get_etf_count(pn, proxies, page_size, time_out):
|
|
25
29
|
"""
|
|
26
30
|
东方财富-ETF 实时行情
|
|
27
31
|
https://quote.eastmoney.com/center/gridlist.html#fund_etf
|
|
@@ -32,7 +36,7 @@ def get_fund_etf_page_df(pn, proxies) -> pd.DataFrame:
|
|
|
32
36
|
url = "https://88.push2.eastmoney.com/api/qt/clist/get"
|
|
33
37
|
params = {
|
|
34
38
|
"pn": str(pn),
|
|
35
|
-
"pz":
|
|
39
|
+
"pz": str(page_size),
|
|
36
40
|
"po": "1",
|
|
37
41
|
"np": "3",
|
|
38
42
|
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
|
|
@@ -53,16 +57,59 @@ def get_fund_etf_page_df(pn, proxies) -> pd.DataFrame:
|
|
|
53
57
|
}
|
|
54
58
|
try:
|
|
55
59
|
if proxies is None:
|
|
56
|
-
r = requests.get(url, params)
|
|
60
|
+
r = requests.get(url, params, timeout=time_out)
|
|
57
61
|
else:
|
|
58
|
-
r = requests.get(url, params, proxies=proxies)
|
|
62
|
+
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
63
|
+
data_json = r.json()
|
|
64
|
+
total_number = int(data_json['data']['total'])
|
|
65
|
+
return total_number
|
|
66
|
+
except Exception as e:
|
|
67
|
+
logger.error("获取ETF列表,实时行情异常:{}", e)
|
|
68
|
+
return pd.DataFrame()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def get_fund_etf_page_df(pn, proxies, page_size, time_out) -> pd.DataFrame:
|
|
72
|
+
"""
|
|
73
|
+
东方财富-ETF 实时行情
|
|
74
|
+
https://quote.eastmoney.com/center/gridlist.html#fund_etf
|
|
75
|
+
:return: ETF 实时行情
|
|
76
|
+
:rtype: pandas.DataFrame
|
|
77
|
+
"""
|
|
78
|
+
current_timestamp = str(int(round(time.time() * 1000, 0)))
|
|
79
|
+
url = "https://88.push2.eastmoney.com/api/qt/clist/get"
|
|
80
|
+
params = {
|
|
81
|
+
"pn": str(pn),
|
|
82
|
+
"pz": str(page_size),
|
|
83
|
+
"po": "1",
|
|
84
|
+
"np": "3",
|
|
85
|
+
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
|
|
86
|
+
"fltt": "2",
|
|
87
|
+
"invt": "2",
|
|
88
|
+
"wbp2u": "|0|0|0|web",
|
|
89
|
+
"fid": "f12",
|
|
90
|
+
"fs": "b:MK0021,b:MK0022,b:MK0023,b:MK0024",
|
|
91
|
+
"fields": (
|
|
92
|
+
"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,"
|
|
93
|
+
"f12,f13,f14,f15,f16,f17,f18,f20,f21,"
|
|
94
|
+
"f23,f24,f25,f26,f22,f11,f30,f31,f32,f33,"
|
|
95
|
+
"f34,f35,f38,f62,f63,f64,f65,f66,f69,"
|
|
96
|
+
"f72,f75,f78,f81,f84,f87,f115,f124,f128,"
|
|
97
|
+
"f136,f152,f184,f297,f402,f441"
|
|
98
|
+
),
|
|
99
|
+
"_": str(current_timestamp),
|
|
100
|
+
}
|
|
101
|
+
try:
|
|
102
|
+
if proxies is None:
|
|
103
|
+
r = requests.get(url, params, timeout=time_out)
|
|
104
|
+
else:
|
|
105
|
+
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
59
106
|
data_json = r.json()
|
|
60
107
|
if pn == 1:
|
|
61
108
|
try:
|
|
62
109
|
global max_number
|
|
63
110
|
max_number = int(data_json['data']['total'])
|
|
64
111
|
except Exception as e:
|
|
65
|
-
logger.error(
|
|
112
|
+
logger.error("获取第{}页ETF列表异常:{}", page_size, str(e))
|
|
66
113
|
return pd.DataFrame()
|
|
67
114
|
|
|
68
115
|
temp_df = pd.DataFrame(data_json["data"]["diff"])
|
|
@@ -367,8 +414,91 @@ def get_etf_real_time_quotes(proxies):
|
|
|
367
414
|
return page_df
|
|
368
415
|
|
|
369
416
|
|
|
417
|
+
def repeated_acquisition_ask_etf_async(time_out, max_number, num_threads, pages_per_thread):
|
|
418
|
+
per_page = page_number
|
|
419
|
+
total_pages = (max_number + per_page - 1) // per_page # 向上取整
|
|
420
|
+
result_df = pd.DataFrame()
|
|
421
|
+
|
|
422
|
+
# 创建线程锁以确保线程安全
|
|
423
|
+
df_lock = Lock()
|
|
424
|
+
|
|
425
|
+
# 计算每个线程处理的页数范围
|
|
426
|
+
def process_page_range(start_page, end_page, thread_id):
|
|
427
|
+
nonlocal result_df
|
|
428
|
+
local_df = pd.DataFrame()
|
|
429
|
+
current_page = start_page
|
|
430
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
431
|
+
|
|
432
|
+
while current_page <= end_page and current_page <= total_pages:
|
|
433
|
+
proxies = {"https": proxy_ip, "http": proxy_ip}
|
|
434
|
+
try:
|
|
435
|
+
page_df = get_fund_etf_page_df(current_page, proxies, page_number, time_out)
|
|
436
|
+
if data_frame_util.is_not_empty(page_df):
|
|
437
|
+
local_df = pd.concat([local_df, page_df])
|
|
438
|
+
logger.info("线程{}获取页面数据成功: {}", thread_id, current_page)
|
|
439
|
+
current_page += 1
|
|
440
|
+
else:
|
|
441
|
+
time.sleep(0.2)
|
|
442
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
443
|
+
logger.info("线程{}获取页面数据失败: {}", thread_id, current_page)
|
|
444
|
+
except BaseException as e:
|
|
445
|
+
time.sleep(1)
|
|
446
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
447
|
+
logger.error("线程{}处理页面{}时发生错误: {}", thread_id, current_page, e)
|
|
448
|
+
|
|
449
|
+
with df_lock:
|
|
450
|
+
result_df = pd.concat([result_df, local_df])
|
|
451
|
+
return len(local_df)
|
|
452
|
+
|
|
453
|
+
# 计算每个线程的页面范围
|
|
454
|
+
page_ranges = []
|
|
455
|
+
for i in range(num_threads):
|
|
456
|
+
start_page = i * pages_per_thread + 1
|
|
457
|
+
end_page = (i + 1) * pages_per_thread
|
|
458
|
+
if start_page > total_pages:
|
|
459
|
+
break
|
|
460
|
+
page_ranges.append((start_page, end_page, i + 1))
|
|
461
|
+
|
|
462
|
+
# 使用线程池执行任务
|
|
463
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
|
|
464
|
+
# 提交所有任务
|
|
465
|
+
futures = [
|
|
466
|
+
executor.submit(process_page_range, start, end, tid)
|
|
467
|
+
for start, end, tid in page_ranges
|
|
468
|
+
]
|
|
469
|
+
|
|
470
|
+
# 等待所有任务完成并获取结果
|
|
471
|
+
results = []
|
|
472
|
+
for future in concurrent.futures.as_completed(futures):
|
|
473
|
+
try:
|
|
474
|
+
result = future.result()
|
|
475
|
+
results.append(result)
|
|
476
|
+
except Exception as e:
|
|
477
|
+
logger.error("线程执行出错: {}", e)
|
|
478
|
+
|
|
479
|
+
return rename_etf(result_df)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
def get_etf_real_time_quotes(time_out, pages_per_thread):
|
|
483
|
+
try_numer = 3
|
|
484
|
+
while try_numer > 0:
|
|
485
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
486
|
+
proxies = {"https": proxy_ip,
|
|
487
|
+
"http": proxy_ip}
|
|
488
|
+
|
|
489
|
+
max_number = get_etf_count(1, proxies, 20, time_out)
|
|
490
|
+
if max_number>0:
|
|
491
|
+
break
|
|
492
|
+
try_numer = try_numer - 1
|
|
493
|
+
if max_number == 0:
|
|
494
|
+
return pd.DataFrame()
|
|
495
|
+
|
|
496
|
+
total_pages = (max_number + page_number - 1) // page_number # 向上取整
|
|
497
|
+
|
|
498
|
+
num_threads = int((total_pages / pages_per_thread) + 1)
|
|
499
|
+
return repeated_acquisition_ask_etf_async(time_out, max_number, num_threads, pages_per_thread)
|
|
500
|
+
|
|
501
|
+
|
|
370
502
|
if __name__ == '__main__':
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
fund_etf_df = fund_etf_df.fillna(0)
|
|
374
|
-
print(fund_etf_df)
|
|
503
|
+
test_df = get_etf_real_time_quotes(30, 6)
|
|
504
|
+
print(test_df)
|