mns-common 1.5.2.8__tar.gz → 1.5.8.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.5.2.8 → mns_common-1.5.8.8}/PKG-INFO +1 -1
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/akshare/stock_zb_pool.py +2 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_debt_api.py +6 -61
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_etf_api.py +2 -21
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_stock_a_v2_api.py +70 -122
- mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_common_rename.py → mns_common-1.5.8.8/mns_common/api/em/real_time/east_money_stock_common_api.py +66 -1
- mns_common-1.5.8.8/mns_common/api/em/real_time/east_money_stock_hk_api.py +288 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py +27 -19
- mns_common-1.5.8.8/mns_common/api/em/real_time/east_money_stock_us_api.py +361 -0
- mns_common-1.5.8.8/mns_common/api/em/real_time/real_time_quotes_repeat_api.py +195 -0
- mns_common-1.5.8.8/mns_common/api/k_line/__init__.py +7 -0
- mns_common-1.5.8.8/mns_common/api/kpl/common/__init__.py +8 -0
- mns_common-1.5.8.8/mns_common/api/kpl/theme/kpl_theme_api.py +67 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/company/ths_company_info_api.py +2 -1
- mns_common-1.5.8.8/mns_common/api/ths/company/ths_company_info_web.py +159 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/zt/ths_stock_zt_pool_api.py +10 -4
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +13 -2
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/deal/deal_service_api.py +70 -8
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/em/em_stock_info_api.py +5 -2
- mns_common-1.5.8.8/mns_common/component/main_line/main_line_zt_reason_service.py +237 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/us/us_stock_etf_info_api.py +9 -4
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/db_name_constant.py +55 -26
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/extra_income_db_name.py +75 -22
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/db/MongodbUtil.py +3 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/db/MongodbUtilLocal.py +3 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common.egg-info/PKG-INFO +1 -1
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common.egg-info/SOURCES.txt +6 -6
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/setup.py +1 -1
- mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_hk_api.py +0 -239
- mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_us_api.py +0 -234
- mns_common-1.5.2.8/mns_common/api/em/real_time/real_time_quotes_repeat_api.py +0 -428
- mns_common-1.5.2.8/mns_common/api/kpl/symbol/__init__.py +0 -7
- mns_common-1.5.2.8/mns_common/api/ths/concept/web/ths_company_info_web.py +0 -163
- mns_common-1.5.2.8/mns_common/component/qmt/qmt_buy_service.py +0 -172
- mns_common-1.5.2.8/mns_common/component/task/real_time_data_sync_check.py +0 -140
- mns_common-1.5.2.8/mns_common/db/v2/__init__.py +0 -7
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/README.md +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/akshare/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/akshare/k_line_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/akshare/stock_bid_ask_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/akshare/stock_dt_pool.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/akshare/stock_zt_pool_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/akshare/yjyg_sync_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/concept/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/concept/em_concept_index_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/gd/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py +0 -0
- {mns_common-1.5.2.8/mns_common/api/k_line → mns_common-1.5.8.8/mns_common/api/em/real_time}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_stock_a_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py +0 -0
- {mns_common-1.5.2.8/mns_common/api/em/real_time → mns_common-1.5.8.8/mns_common/api/hk}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/hk/ths_hk_company_info_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/k_line/stock_k_line_data_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/k_line/stock_minute_data_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/common/kpl_common_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/common/kpl_common_field_constant.py +0 -0
- {mns_common-1.5.2.8/mns_common/api/kpl/common → mns_common-1.5.8.8/mns_common/api/kpl/concept}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/concept/kpl_concept_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/constant/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/constant/kpl_constant.py +0 -0
- {mns_common-1.5.2.8/mns_common/api/kpl/concept → mns_common-1.5.8.8/mns_common/api/kpl/industry}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/industry/kpl_industry_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/selection/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/selection/kpl_selection_plate_api.py +0 -0
- {mns_common-1.5.2.8/mns_common/api/kpl/industry → mns_common-1.5.8.8/mns_common/api/kpl/symbol}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/symbol/kpl_real_time_quotes_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/symbol/kpl_symbol_common_field_constant.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/kpl/symbol/symbol_his_quotes_api.py +0 -0
- {mns_common-1.5.2.8/mns_common/api/hk → mns_common-1.5.8.8/mns_common/api/kpl/theme}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/msg/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/msg/push_msg_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/proxies/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/proxies/liu_guan_proxy_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/qmt/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/qmt/qmt_minunte_tick_data.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/big_deal/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/big_deal/ths_big_deal_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/company/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/company/company_product_area_industry_index_query.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/company/ths_company_announce_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/app/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/app/ths_concept_detail_app.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/app/ths_concept_index_app.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/web/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/web/ths_common_js_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/web/ths_concept_detail_web.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/concept/web/ths_concept_index_web.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/self_choose/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/self_choose/ths_self_choose_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/wen_cai/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/wen_cai/ths_wen_cai_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/ths/zt/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/us/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/us/ths_us_company_info_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/xueqiu/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/xueqiu/xue_qiu_k_line_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/cache/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/cache/cache_service.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/classify/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/classify/symbol_classify_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/classify/symbol_classify_param.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/common_service_fun_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/company/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/company/company_common_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/company/company_common_service_new_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/concept/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/concept/kpl_concept_common_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/concept/ths_concept_common_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/cookie/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/cookie/cookie_enum.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/cookie/cookie_info_service.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/data/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/data/data_init_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/deal/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/deal/deal_service_v2_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/deal/terminal_enum.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/em/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/em/em_real_time_quotes_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/exception/ExceptionMonitor.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/exception/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/hk/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/hk/company_hk_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/industry/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/industry/ths_industry_index_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/clean/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/clean/k_line_param.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/clean/sh_small_normal_zt_k_line_check_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/common/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/common/k_line_common_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/patterns/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/patterns/k_line_patterns_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/k_line/patterns/pattern_Enum.py +0 -0
- {mns_common-1.5.2.8/mns_common/component/price → mns_common-1.5.8.8/mns_common/component/main_line}/__init__.py +0 -0
- {mns_common-1.5.2.8/mns_common/component/proxies → mns_common-1.5.8.8/mns_common/component/price}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/price/trade_price_service_api.py +0 -0
- {mns_common-1.5.2.8/mns_common/component/qmt → mns_common-1.5.8.8/mns_common/component/proxies}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/proxies/proxy_common_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/real_time/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/real_time/real_time_common_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/redis_msg/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/redis_msg/redis_msg_publish_service.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/self_choose/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/self_choose/black_list_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/self_choose/self_choose_service_api.py +0 -0
- {mns_common-1.5.2.8/mns_common/component/task → mns_common-1.5.8.8/mns_common/component/tfp}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/tfp/stock_tfp_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/trade_date/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/trade_date/trade_date_common_service_api.py +0 -0
- {mns_common-1.5.2.8/mns_common/component/tfp → mns_common-1.5.8.8/mns_common/component/us}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/zt/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/component/zt/zt_common_service_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/black_list_classify_enum.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/east_money_stock_api.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/price_enum.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/redis_msg_constant.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/self_choose_constant.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/constant/strategy_classify.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/db/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/db/v2/MongodbUtilV2.py +0 -0
- {mns_common-1.5.2.8/mns_common/component/us → mns_common-1.5.8.8/mns_common/db/v2}/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/__init__.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/async_fun.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/cmd_util.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/data_frame_util.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/date_handle_util.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/db_util.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/file_util.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/utils/ip_util.py +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common.egg-info/dependency_links.txt +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common.egg-info/top_level.txt +0 -0
- {mns_common-1.5.2.8 → mns_common-1.5.8.8}/setup.cfg +0 -0
{mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_debt_api.py
RENAMED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
|
-
import sys
|
|
5
|
-
import os
|
|
6
|
-
|
|
7
4
|
file_path = os.path.abspath(__file__)
|
|
8
5
|
end = file_path.index('mns') + 14
|
|
9
6
|
project_path = file_path[0:end]
|
|
@@ -22,10 +19,6 @@ from threading import Lock
|
|
|
22
19
|
import concurrent.futures
|
|
23
20
|
import mns_common.utils.data_frame_util as data_frame_util
|
|
24
21
|
|
|
25
|
-
# 最大返回条数
|
|
26
|
-
max_number = 600
|
|
27
|
-
# 最小返回条数
|
|
28
|
-
min_number = 500
|
|
29
22
|
# 分页条数
|
|
30
23
|
page_number = 100
|
|
31
24
|
|
|
@@ -59,16 +52,13 @@ def get_kzz_count(pn, proxies, page_size, time_out):
|
|
|
59
52
|
else:
|
|
60
53
|
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
61
54
|
data_text = r.text
|
|
62
|
-
try:
|
|
63
|
-
begin_index_total = data_text.index('"total":')
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return 0
|
|
56
|
+
begin_index_total = data_text.index('"total":')
|
|
57
|
+
|
|
58
|
+
end_index_total = data_text.index('"diff"')
|
|
59
|
+
max_number = int(data_text[begin_index_total + 8:end_index_total - 1])
|
|
60
|
+
return max_number
|
|
61
|
+
|
|
72
62
|
|
|
73
63
|
except Exception as e:
|
|
74
64
|
logger.error("获取可转债列表,实时行情异常:{}", e)
|
|
@@ -131,50 +121,6 @@ def get_debt_page_data(pn, proxies, page_size, time_out) -> pd.DataFrame:
|
|
|
131
121
|
return pd.DataFrame()
|
|
132
122
|
|
|
133
123
|
|
|
134
|
-
def all_debt_ticker_data(fields, proxies) -> pd.DataFrame:
|
|
135
|
-
"""
|
|
136
|
-
使用多线程获取所有债券数据
|
|
137
|
-
"""
|
|
138
|
-
# 计算总页数,假设总共有1000条数据,每页200条
|
|
139
|
-
|
|
140
|
-
per_page = page_number
|
|
141
|
-
total_pages = (max_number + per_page - 1) // per_page # 向上取整
|
|
142
|
-
|
|
143
|
-
# 创建线程池
|
|
144
|
-
with ThreadPoolExecutor(max_workers=3) as executor:
|
|
145
|
-
# 提交任务,获取每页数据
|
|
146
|
-
futures = [executor.submit(get_debt_page_data, fields, pn, proxies)
|
|
147
|
-
for pn in range(1, total_pages + 1)]
|
|
148
|
-
|
|
149
|
-
# 收集结果
|
|
150
|
-
results = []
|
|
151
|
-
for future in futures:
|
|
152
|
-
result = future.result()
|
|
153
|
-
if not result.empty:
|
|
154
|
-
results.append(result)
|
|
155
|
-
|
|
156
|
-
# 合并所有页面的数据
|
|
157
|
-
if results:
|
|
158
|
-
return pd.concat(results, ignore_index=True)
|
|
159
|
-
else:
|
|
160
|
-
return pd.DataFrame()
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def get_debt_real_time_quotes(proxies):
|
|
164
|
-
# 获取第一页数据
|
|
165
|
-
page_one_df = get_debt_page_data(fields, 1, proxies)
|
|
166
|
-
# 数据接口正常返回5600以上的数量
|
|
167
|
-
if page_one_df.shape[0] > min_number:
|
|
168
|
-
page_one_df = rename_real_time_quotes_df(page_one_df)
|
|
169
|
-
page_one_df.drop_duplicates('symbol', keep='last', inplace=True)
|
|
170
|
-
return page_one_df
|
|
171
|
-
else:
|
|
172
|
-
page_df = all_debt_ticker_data(fields, proxies)
|
|
173
|
-
page_df = rename_real_time_quotes_df(page_df)
|
|
174
|
-
page_df.drop_duplicates('symbol', keep='last', inplace=True)
|
|
175
|
-
return page_df
|
|
176
|
-
|
|
177
|
-
|
|
178
124
|
def rename_real_time_quotes_df(temp_df):
|
|
179
125
|
temp_df = temp_df.rename(columns={
|
|
180
126
|
"f2": "now_price",
|
|
@@ -428,4 +374,3 @@ def get_kzz_real_time_quotes(time_out, pages_per_thread):
|
|
|
428
374
|
if __name__ == '__main__':
|
|
429
375
|
test_df = get_kzz_real_time_quotes(30, 6)
|
|
430
376
|
print(test_df)
|
|
431
|
-
|
|
@@ -17,10 +17,6 @@ from concurrent.futures import ThreadPoolExecutor
|
|
|
17
17
|
from threading import Lock
|
|
18
18
|
import mns_common.utils.data_frame_util as data_frame_util
|
|
19
19
|
|
|
20
|
-
# 最大返回条数
|
|
21
|
-
max_number = 1200
|
|
22
|
-
# 最小返回条数
|
|
23
|
-
min_number = 1000
|
|
24
20
|
# 分页条数
|
|
25
21
|
page_number = 100
|
|
26
22
|
|
|
@@ -65,7 +61,7 @@ def get_etf_count(pn, proxies, page_size, time_out):
|
|
|
65
61
|
return total_number
|
|
66
62
|
except Exception as e:
|
|
67
63
|
logger.error("获取ETF列表,实时行情异常:{}", e)
|
|
68
|
-
return
|
|
64
|
+
return 0
|
|
69
65
|
|
|
70
66
|
|
|
71
67
|
def get_fund_etf_page_df(pn, proxies, page_size, time_out) -> pd.DataFrame:
|
|
@@ -399,21 +395,6 @@ def rename_etf(fund_etf_spot_em_df):
|
|
|
399
395
|
return fund_etf_spot_em_df
|
|
400
396
|
|
|
401
397
|
|
|
402
|
-
def get_etf_real_time_quotes(proxies):
|
|
403
|
-
# 获取第一页数据
|
|
404
|
-
page_one_df = get_fund_etf_page_df(1, proxies)
|
|
405
|
-
# 数据接口正常返回5600以上的数量
|
|
406
|
-
if page_one_df.shape[0] > min_number:
|
|
407
|
-
page_one_df = rename_etf(page_one_df)
|
|
408
|
-
page_one_df.drop_duplicates('symbol', keep='last', inplace=True)
|
|
409
|
-
return page_one_df
|
|
410
|
-
else:
|
|
411
|
-
page_df = thread_pool_executor(proxies)
|
|
412
|
-
page_df = rename_etf(page_df)
|
|
413
|
-
page_df.drop_duplicates('symbol', keep='last', inplace=True)
|
|
414
|
-
return page_df
|
|
415
|
-
|
|
416
|
-
|
|
417
398
|
def repeated_acquisition_ask_etf_async(time_out, max_number, num_threads, pages_per_thread):
|
|
418
399
|
per_page = page_number
|
|
419
400
|
total_pages = (max_number + per_page - 1) // per_page # 向上取整
|
|
@@ -487,7 +468,7 @@ def get_etf_real_time_quotes(time_out, pages_per_thread):
|
|
|
487
468
|
"http": proxy_ip}
|
|
488
469
|
|
|
489
470
|
max_number = get_etf_count(1, proxies, 20, time_out)
|
|
490
|
-
if max_number>0:
|
|
471
|
+
if max_number > 0:
|
|
491
472
|
break
|
|
492
473
|
try_numer = try_numer - 1
|
|
493
474
|
if max_number == 0:
|
{mns_common-1.5.2.8 → mns_common-1.5.8.8}/mns_common/api/em/real_time/east_money_stock_a_v2_api.py
RENAMED
|
@@ -11,17 +11,16 @@ import requests
|
|
|
11
11
|
import mns_common.utils.data_frame_util as data_frame_util
|
|
12
12
|
import json
|
|
13
13
|
import datetime
|
|
14
|
-
|
|
15
|
-
import threading
|
|
16
14
|
from concurrent.futures import ThreadPoolExecutor
|
|
17
15
|
import mns_common.component.proxies.proxy_common_api as proxy_common_api
|
|
18
16
|
from loguru import logger
|
|
19
17
|
import concurrent.futures
|
|
20
18
|
import pandas as pd
|
|
21
19
|
import time
|
|
22
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
20
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
23
21
|
from threading import Lock
|
|
24
22
|
import mns_common.api.em.real_time.real_time_quotes_repeat_api as real_time_quotes_repeat_api
|
|
23
|
+
import mns_common.api.em.real_time.east_money_stock_common_api as east_money_stock_common_api
|
|
25
24
|
|
|
26
25
|
#
|
|
27
26
|
# 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" \
|
|
@@ -43,12 +42,8 @@ fields = ("f2,f3,f5,f6,f8,"
|
|
|
43
42
|
"f84,f102,f184,f100,f103,"
|
|
44
43
|
"f352,f191,f193,f24,f25")
|
|
45
44
|
|
|
46
|
-
# 最大返回条数
|
|
47
|
-
max_number = 5800
|
|
48
|
-
# 最小返回条数
|
|
49
|
-
min_number = 5600
|
|
50
45
|
# 分页条数
|
|
51
|
-
|
|
46
|
+
PAGE_SIZE = 100
|
|
52
47
|
|
|
53
48
|
|
|
54
49
|
def get_stock_page_data(pn, proxies, page_number, time_out):
|
|
@@ -92,51 +87,72 @@ def get_stock_page_data(pn, proxies, page_number, time_out):
|
|
|
92
87
|
else:
|
|
93
88
|
return pd.DataFrame(data_json)
|
|
94
89
|
except Exception as e:
|
|
95
|
-
logger.error(f"获取第{pn}页股票列表异常: {e}")
|
|
96
90
|
return pd.DataFrame()
|
|
97
91
|
|
|
98
92
|
|
|
99
|
-
def all_stock_ticker_data_new(
|
|
100
|
-
"""
|
|
101
|
-
使用多线程获取所有股票数据
|
|
93
|
+
def all_stock_ticker_data_new(initial_proxies, time_out, max_number) -> pd.DataFrame:
|
|
102
94
|
"""
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
#
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
95
|
+
使用多线程获取所有股票数据,失败页面会使用新IP重试,最多使用10个IP
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
total_pages = (max_number + PAGE_SIZE - 1) // PAGE_SIZE # 向上取整
|
|
99
|
+
all_pages = set(range(1, total_pages + 1)) # 所有需要获取的页码
|
|
100
|
+
success_pages = set() # 成功获取的页码
|
|
101
|
+
results = [] # 存储成功获取的数据
|
|
102
|
+
used_ip_count = 1 # 已使用IP计数器(初始IP算第一个)
|
|
103
|
+
MAX_IP_LIMIT = 10 # IP使用上限
|
|
104
|
+
|
|
105
|
+
# 循环处理直到所有页面成功或达到IP上限
|
|
106
|
+
while (all_pages - success_pages) and (used_ip_count < MAX_IP_LIMIT):
|
|
107
|
+
# 获取当前需要处理的失败页码
|
|
108
|
+
current_failed_pages = all_pages - success_pages
|
|
109
|
+
if used_ip_count > 1:
|
|
110
|
+
logger.info("当前需要处理的失败页码: {}, 已使用IP数量: {}/{}", current_failed_pages, used_ip_count,
|
|
111
|
+
MAX_IP_LIMIT)
|
|
112
|
+
|
|
113
|
+
# 首次使用初始代理,后续获取新代理
|
|
114
|
+
if len(success_pages) == 0:
|
|
115
|
+
proxies = initial_proxies
|
|
116
|
+
else:
|
|
117
|
+
# 每次重试前获取新代理并计数
|
|
118
|
+
# logger.info("获取新代理IP处理失败页面")
|
|
119
|
+
new_proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
120
|
+
proxies = {"https": new_proxy_ip}
|
|
121
|
+
# logger.info("新代理IP: {}, 已使用IP数量: {}/{}", new_proxy_ip, used_ip_count + 1, MAX_IP_LIMIT)
|
|
122
|
+
used_ip_count += 1 # 增加IP计数器
|
|
123
|
+
|
|
124
|
+
# 创建线程池处理当前失败的页码
|
|
125
|
+
with ThreadPoolExecutor(max_workers=10) as executor:
|
|
126
|
+
futures = {
|
|
127
|
+
executor.submit(get_stock_page_data, pn, proxies, PAGE_SIZE, time_out): pn
|
|
128
|
+
for pn in current_failed_pages
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# 收集结果并记录成功页码
|
|
132
|
+
for future, pn in futures.items():
|
|
133
|
+
try:
|
|
134
|
+
result = future.result()
|
|
135
|
+
if not result.empty:
|
|
136
|
+
results.append(result)
|
|
137
|
+
success_pages.add(pn)
|
|
138
|
+
# else:
|
|
139
|
+
# logger.warning("页码 {} 未返回有效数据", pn)
|
|
140
|
+
except Exception as e:
|
|
141
|
+
continue
|
|
142
|
+
# logger.error("页码 {} 处理异常: {}", pn, str(e))
|
|
143
|
+
|
|
144
|
+
# 检查是否达到IP上限
|
|
145
|
+
if used_ip_count >= MAX_IP_LIMIT and (all_pages - success_pages):
|
|
146
|
+
remaining_pages = all_pages - success_pages
|
|
147
|
+
logger.warning("已达到最大IP使用限制({}个),剩余未获取页码: {}, 返回现有数据", MAX_IP_LIMIT, remaining_pages)
|
|
148
|
+
|
|
149
|
+
# 合并所有成功获取的数据
|
|
121
150
|
if results:
|
|
122
151
|
return pd.concat(results, ignore_index=True)
|
|
123
152
|
else:
|
|
124
153
|
return pd.DataFrame()
|
|
125
154
|
|
|
126
155
|
|
|
127
|
-
def get_all_real_time_quotes(proxies):
|
|
128
|
-
# 获取第一页数据
|
|
129
|
-
page_one_df = get_stock_page_data(1, fields, fs, proxies)
|
|
130
|
-
# 数据接口正常返回5600以上的数量
|
|
131
|
-
if page_one_df.shape[0] > min_number:
|
|
132
|
-
page_one_df = rename_real_time_quotes_df(page_one_df)
|
|
133
|
-
return page_one_df
|
|
134
|
-
else:
|
|
135
|
-
page_df = all_stock_ticker_data_new(fields, fs, proxies)
|
|
136
|
-
page_df = rename_real_time_quotes_df(page_df)
|
|
137
|
-
return page_df
|
|
138
|
-
|
|
139
|
-
|
|
140
156
|
# 获取所有股票实时行情数据 f33,委比
|
|
141
157
|
def rename_real_time_quotes_df(temp_df):
|
|
142
158
|
temp_df = temp_df.rename(columns={
|
|
@@ -297,96 +313,28 @@ def rename_real_time_quotes_df(temp_df):
|
|
|
297
313
|
return temp_df
|
|
298
314
|
|
|
299
315
|
|
|
300
|
-
def
|
|
301
|
-
per_page = page_number
|
|
302
|
-
total_pages = (max_number + per_page - 1) // per_page # 向上取整
|
|
303
|
-
result_df = pd.DataFrame()
|
|
304
|
-
|
|
305
|
-
# 创建线程锁以确保线程安全
|
|
306
|
-
df_lock = Lock()
|
|
307
|
-
|
|
308
|
-
# 计算每个线程处理的页数范围
|
|
309
|
-
def process_page_range(start_page, end_page, thread_id):
|
|
310
|
-
nonlocal result_df
|
|
311
|
-
local_df = pd.DataFrame()
|
|
312
|
-
current_page = start_page
|
|
313
|
-
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
314
|
-
|
|
315
|
-
while current_page <= end_page and current_page <= total_pages:
|
|
316
|
-
proxies = {"https": proxy_ip, "http": proxy_ip}
|
|
317
|
-
try:
|
|
318
|
-
page_df = get_stock_page_data(current_page, proxies, page_number, time_out)
|
|
319
|
-
if data_frame_util.is_not_empty(page_df):
|
|
320
|
-
local_df = pd.concat([local_df, page_df])
|
|
321
|
-
logger.info("线程{}获取页面数据成功: {}", thread_id, current_page)
|
|
322
|
-
current_page += 1
|
|
323
|
-
else:
|
|
324
|
-
time.sleep(0.2)
|
|
325
|
-
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
326
|
-
logger.info("线程{}获取页面数据失败: {}", thread_id, current_page)
|
|
327
|
-
except BaseException as e:
|
|
328
|
-
time.sleep(1)
|
|
329
|
-
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
330
|
-
logger.error("线程{}处理页面{}时发生错误: {}", thread_id, current_page, e)
|
|
331
|
-
|
|
332
|
-
with df_lock:
|
|
333
|
-
result_df = pd.concat([result_df, local_df])
|
|
334
|
-
return len(local_df)
|
|
335
|
-
|
|
336
|
-
# 计算每个线程的页面范围
|
|
337
|
-
page_ranges = []
|
|
338
|
-
for i in range(num_threads):
|
|
339
|
-
start_page = i * pages_per_thread + 1
|
|
340
|
-
end_page = (i + 1) * pages_per_thread
|
|
341
|
-
if start_page > total_pages:
|
|
342
|
-
break
|
|
343
|
-
page_ranges.append((start_page, end_page, i + 1))
|
|
344
|
-
|
|
345
|
-
# 使用线程池执行任务
|
|
346
|
-
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
|
|
347
|
-
# 提交所有任务
|
|
348
|
-
futures = [
|
|
349
|
-
executor.submit(process_page_range, start, end, tid)
|
|
350
|
-
for start, end, tid in page_ranges
|
|
351
|
-
]
|
|
352
|
-
|
|
353
|
-
# 等待所有任务完成并获取结果
|
|
354
|
-
results = []
|
|
355
|
-
for future in concurrent.futures.as_completed(futures):
|
|
356
|
-
try:
|
|
357
|
-
result = future.result()
|
|
358
|
-
results.append(result)
|
|
359
|
-
except Exception as e:
|
|
360
|
-
logger.error("线程执行出错: {}", e)
|
|
361
|
-
|
|
362
|
-
return rename_real_time_quotes_df(result_df)
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
def get_stock_real_time_quotes(time_out, pages_per_thread):
|
|
316
|
+
def get_stock_real_time_quotes(time_out):
|
|
366
317
|
try_numer = 3
|
|
367
318
|
while try_numer > 0:
|
|
368
319
|
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
369
|
-
|
|
370
|
-
|
|
320
|
+
initial_proxies = {"https": proxy_ip,
|
|
321
|
+
"http": proxy_ip}
|
|
371
322
|
|
|
372
|
-
total_number =
|
|
323
|
+
total_number = east_money_stock_common_api.get_stocks_num(1, initial_proxies, 20, time_out)
|
|
373
324
|
if total_number > 0:
|
|
374
325
|
break
|
|
375
326
|
try_numer = try_numer - 1
|
|
376
327
|
if total_number == 0:
|
|
377
328
|
return pd.DataFrame()
|
|
378
329
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
return
|
|
330
|
+
page_df = all_stock_ticker_data_new(initial_proxies, time_out, total_number)
|
|
331
|
+
page_df = rename_real_time_quotes_df(page_df)
|
|
332
|
+
page_df.drop_duplicates('symbol', keep='last', inplace=True)
|
|
333
|
+
return page_df
|
|
383
334
|
|
|
384
335
|
|
|
385
336
|
# 示例调用
|
|
386
337
|
if __name__ == "__main__":
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
zt_df = df.loc[df['wei_bi'] == 100]
|
|
391
|
-
logger.info("同步次数,{}", number)
|
|
392
|
-
number = number + 1
|
|
338
|
+
df = get_stock_real_time_quotes(5)
|
|
339
|
+
zt_df = df.loc[df['wei_bi'] == 100]
|
|
340
|
+
logger.info("同步次数", zt_df.shape[0])
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
1
|
import pandas as pd
|
|
3
2
|
import mns_common.utils.data_frame_util as data_frame_util
|
|
3
|
+
import requests
|
|
4
|
+
from loguru import logger
|
|
5
|
+
import datetime
|
|
6
|
+
|
|
7
|
+
fs = "m:0 t:6,m:0 t:80,m:1 t:2,m:1 t:23,m:0 t:81 s:2048"
|
|
8
|
+
fields = ("f2,f3,f5,f6,f8,"
|
|
9
|
+
"f9,f10,f22,f12,f13,"
|
|
10
|
+
"f14,f15,f16,f17,f18,"
|
|
11
|
+
"f20,f21,f23,f26,f33,"
|
|
12
|
+
"f34,f35,f37,f38,f39,"
|
|
13
|
+
"f62,f64,f65,f67,f68,"
|
|
14
|
+
"f66,f69,f70,f71,f72,"
|
|
15
|
+
"f76,f77,f78,f82,f83,"
|
|
16
|
+
"f84,f102,f184,f100,f103,"
|
|
17
|
+
"f352,f191,f193,f24,f25")
|
|
18
|
+
|
|
4
19
|
|
|
5
20
|
# 获取所有股票实时行情数据 f33,委比
|
|
6
21
|
def rename_real_time_quotes_df(temp_df):
|
|
@@ -107,3 +122,53 @@ def rename_real_time_quotes_df(temp_df):
|
|
|
107
122
|
temp_df.loc[temp_df["inner_disk"] == 0, ['disk_ratio']] = 1688
|
|
108
123
|
temp_df = temp_df.sort_values(by=['chg'], ascending=False)
|
|
109
124
|
return temp_df
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def get_stocks_num(pn, proxies, page_number, time_out):
|
|
128
|
+
"""
|
|
129
|
+
获取单页股票数据
|
|
130
|
+
"""
|
|
131
|
+
# 获取当前日期和时间
|
|
132
|
+
current_time = datetime.datetime.now()
|
|
133
|
+
|
|
134
|
+
# 将当前时间转换为时间戳(以毫秒为单位)
|
|
135
|
+
current_timestamp_ms = int(current_time.timestamp() * 1000)
|
|
136
|
+
|
|
137
|
+
url = "https://13.push2.eastmoney.com/api/qt/clist/get"
|
|
138
|
+
params = {
|
|
139
|
+
"cb": "jQuery1124046660442520420653_" + str(current_timestamp_ms),
|
|
140
|
+
"pn": str(pn),
|
|
141
|
+
"pz": str(page_number), # 每页最大200条
|
|
142
|
+
"po": "1",
|
|
143
|
+
"np": "3",
|
|
144
|
+
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
|
|
145
|
+
"fltt": "2",
|
|
146
|
+
"invt": "2",
|
|
147
|
+
"wbp2u": "|0|0|0|web",
|
|
148
|
+
"fid": "f3",
|
|
149
|
+
"fs": fs,
|
|
150
|
+
"fields": fields,
|
|
151
|
+
"_": current_timestamp_ms
|
|
152
|
+
}
|
|
153
|
+
try:
|
|
154
|
+
if proxies is None:
|
|
155
|
+
r = requests.get(url, params, timeout=time_out)
|
|
156
|
+
else:
|
|
157
|
+
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
158
|
+
data_text = r.text
|
|
159
|
+
|
|
160
|
+
begin_index_total = data_text.index('"total":')
|
|
161
|
+
end_index_total = data_text.index('"diff"')
|
|
162
|
+
return int(data_text[begin_index_total + 8:end_index_total - 1])
|
|
163
|
+
|
|
164
|
+
except Exception as e:
|
|
165
|
+
logger.error("获取股票数量异常:{}", str(e))
|
|
166
|
+
return 0
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
import mns_common.component.proxies.proxy_common_api as proxy_common_api
|
|
170
|
+
|
|
171
|
+
if __name__ == '__main__':
|
|
172
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
173
|
+
proxies = {"https": proxy_ip}
|
|
174
|
+
get_stocks_num(1, proxies, 100, 30)
|