mns-common 1.5.2.3__tar.gz → 1.5.5.9__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.
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/PKG-INFO +1 -1
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/akshare/stock_zb_pool.py +2 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/real_time/east_money_debt_api.py +6 -61
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/real_time/east_money_etf_api.py +2 -21
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/real_time/east_money_stock_a_api.py +24 -28
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/real_time/east_money_stock_a_v2_api.py +97 -53
- mns_common-1.5.5.9/mns_common/api/em/real_time/east_money_stock_common_api.py +174 -0
- mns_common-1.5.5.9/mns_common/api/em/real_time/east_money_stock_hk_api.py +287 -0
- mns_common-1.5.5.9/mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py +260 -0
- mns_common-1.5.5.9/mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py +154 -0
- mns_common-1.5.5.9/mns_common/api/em/real_time/real_time_quotes_repeat_api.py +195 -0
- mns_common-1.5.5.9/mns_common/api/k_line/__init__.py +7 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/proxies/liu_guan_proxy_api.py +1 -1
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/company/ths_company_info_api.py +2 -1
- mns_common-1.5.5.9/mns_common/api/ths/company/ths_company_info_web.py +159 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/wen_cai/ths_wen_cai_api.py +1 -1
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/zt/ths_stock_zt_pool_api.py +20 -1
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +13 -2
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/deal/deal_service_api.py +70 -8
- mns_common-1.5.5.9/mns_common/component/main_line/main_line_zt_reason_service.py +228 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/proxies/proxy_common_api.py +41 -37
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/db_name_constant.py +29 -16
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/extra_income_db_name.py +3 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/db/MongodbUtil.py +3 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/db/MongodbUtilLocal.py +3 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common.egg-info/PKG-INFO +1 -1
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common.egg-info/SOURCES.txt +6 -5
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/setup.py +1 -1
- mns_common-1.5.2.3/mns_common/api/em/real_time/east_money_stock_hk_api.py +0 -469
- mns_common-1.5.2.3/mns_common/api/em/real_time/real_time_quotes_repeat_api.py +0 -359
- mns_common-1.5.2.3/mns_common/api/ths/concept/web/ths_company_info_web.py +0 -163
- mns_common-1.5.2.3/mns_common/component/qmt/qmt_buy_service.py +0 -172
- mns_common-1.5.2.3/mns_common/component/task/real_time_data_sync_check.py +0 -140
- mns_common-1.5.2.3/mns_common/component/us/__init__.py +0 -7
- mns_common-1.5.2.3/mns_common/db/v2/__init__.py +0 -7
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/README.md +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/akshare/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/akshare/k_line_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/akshare/stock_bid_ask_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/akshare/stock_dt_pool.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/akshare/stock_zt_pool_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/akshare/yjyg_sync_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/concept/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/concept/em_concept_index_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/gd/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/k_line → mns_common-1.5.5.9/mns_common/api/em/real_time}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/real_time/east_money_stock_us_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/em/real_time → mns_common-1.5.5.9/mns_common/api/hk}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/hk/ths_hk_company_info_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/k_line/stock_k_line_data_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/k_line/stock_minute_data_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/common/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/common/kpl_common_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/common/kpl_common_field_constant.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/concept/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/concept/kpl_concept_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/constant/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/constant/kpl_constant.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/industry/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/industry/kpl_industry_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/selection/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/selection/kpl_selection_plate_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/symbol/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/symbol/kpl_real_time_quotes_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/symbol/kpl_symbol_common_field_constant.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/kpl/symbol/symbol_his_quotes_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/msg/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/msg/push_msg_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/hk → mns_common-1.5.5.9/mns_common/api/proxies}/__init__.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/proxies → mns_common-1.5.5.9/mns_common/api/qmt}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/qmt/qmt_minunte_tick_data.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/big_deal/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/big_deal/ths_big_deal_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/qmt → mns_common-1.5.5.9/mns_common/api/ths/company}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/company/company_product_area_industry_index_query.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/company/ths_company_announce_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/app/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/app/ths_concept_detail_app.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/app/ths_concept_index_app.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/web/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/web/ths_common_js_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/web/ths_concept_detail_web.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/concept/web/ths_concept_index_web.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/self_choose/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/self_choose/ths_self_choose_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/wen_cai/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/ths/zt/__init__.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/ths/company → mns_common-1.5.5.9/mns_common/api/us}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/us/ths_us_company_info_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/us → mns_common-1.5.5.9/mns_common/api/xueqiu}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/xueqiu/xue_qiu_k_line_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/cache/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/cache/cache_service.py +0 -0
- {mns_common-1.5.2.3/mns_common/api/xueqiu → mns_common-1.5.5.9/mns_common/component/classify}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/classify/symbol_classify_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/classify/symbol_classify_param.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/common_service_fun_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/company/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/company/company_common_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/company/company_common_service_new_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/concept/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/concept/kpl_concept_common_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/concept/ths_concept_common_service_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/classify → mns_common-1.5.5.9/mns_common/component/cookie}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/cookie/cookie_enum.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/cookie/cookie_info_service.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/data/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/data/data_init_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/cookie → mns_common-1.5.5.9/mns_common/component/deal}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/deal/deal_service_v2_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/deal/terminal_enum.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/deal → mns_common-1.5.5.9/mns_common/component/em}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/em/em_real_time_quotes_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/em/em_stock_info_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/exception/ExceptionMonitor.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/em → mns_common-1.5.5.9/mns_common/component/exception}/__init__.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/exception → mns_common-1.5.5.9/mns_common/component/hk}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/hk/company_hk_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/industry/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/industry/ths_industry_index_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/clean/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/clean/k_line_param.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/clean/sh_small_normal_zt_k_line_check_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/common/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/common/k_line_common_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/patterns/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/patterns/k_line_patterns_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/k_line/patterns/pattern_Enum.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/hk → mns_common-1.5.5.9/mns_common/component/main_line}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/price/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/price/trade_price_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/proxies/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/real_time/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/real_time/real_time_common_service_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/qmt → mns_common-1.5.5.9/mns_common/component/redis_msg}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/redis_msg/redis_msg_publish_service.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/self_choose/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/self_choose/black_list_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/self_choose/self_choose_service_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/redis_msg → mns_common-1.5.5.9/mns_common/component/tfp}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/tfp/stock_tfp_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/trade_date/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/trade_date/trade_date_common_service_api.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/task → mns_common-1.5.5.9/mns_common/component/us}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/us/us_stock_etf_info_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/zt/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/component/zt/zt_common_service_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/black_list_classify_enum.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/east_money_stock_api.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/price_enum.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/redis_msg_constant.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/self_choose_constant.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/constant/strategy_classify.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/db/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/db/v2/MongodbUtilV2.py +0 -0
- {mns_common-1.5.2.3/mns_common/component/tfp → mns_common-1.5.5.9/mns_common/db/v2}/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/__init__.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/async_fun.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/cmd_util.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/data_frame_util.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/date_handle_util.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/db_util.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/file_util.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/utils/ip_util.py +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common.egg-info/dependency_links.txt +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common.egg-info/top_level.txt +0 -0
- {mns_common-1.5.2.3 → mns_common-1.5.5.9}/setup.cfg +0 -0
{mns_common-1.5.2.3 → mns_common-1.5.5.9}/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.3 → mns_common-1.5.5.9}/mns_common/api/em/real_time/east_money_stock_a_api.py
RENAMED
|
@@ -28,7 +28,7 @@ min_number = 5600
|
|
|
28
28
|
PAGE_SIZE = 100
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
def get_stock_page_data(pn, proxies, page_size):
|
|
31
|
+
def get_stock_page_data(pn, proxies, page_size, time_out):
|
|
32
32
|
"""
|
|
33
33
|
获取单页股票数据
|
|
34
34
|
"""
|
|
@@ -56,21 +56,12 @@ def get_stock_page_data(pn, proxies, page_size):
|
|
|
56
56
|
}
|
|
57
57
|
try:
|
|
58
58
|
if proxies is None:
|
|
59
|
-
r = requests.get(url, params)
|
|
59
|
+
r = requests.get(url, params, timeout=time_out)
|
|
60
60
|
else:
|
|
61
|
-
r = requests.get(url, params, proxies=proxies)
|
|
61
|
+
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
62
62
|
|
|
63
63
|
data_text = r.text
|
|
64
|
-
if pn == 1:
|
|
65
|
-
try:
|
|
66
|
-
begin_index_total = data_text.index('"total":')
|
|
67
64
|
|
|
68
|
-
end_index_total = data_text.index('"diff"')
|
|
69
|
-
global max_number
|
|
70
|
-
max_number = int(data_text[begin_index_total + 8:end_index_total - 1])
|
|
71
|
-
except Exception as e:
|
|
72
|
-
logger.error(f"获取第{pn}页股票列表异常: {e}")
|
|
73
|
-
return pd.DataFrame()
|
|
74
65
|
|
|
75
66
|
begin_index = data_text.index('[')
|
|
76
67
|
end_index = data_text.index(']')
|
|
@@ -79,13 +70,15 @@ def get_stock_page_data(pn, proxies, page_size):
|
|
|
79
70
|
if data_json is None:
|
|
80
71
|
return pd.DataFrame()
|
|
81
72
|
else:
|
|
82
|
-
|
|
73
|
+
result_df = pd.DataFrame(data_json)
|
|
74
|
+
result_df['page_number'] = pn
|
|
75
|
+
return result_df
|
|
83
76
|
except Exception as e:
|
|
84
|
-
logger.error(
|
|
77
|
+
# logger.error("获取第{}页股票列表异常:{}", pn, str(e))
|
|
85
78
|
return pd.DataFrame()
|
|
86
79
|
|
|
87
80
|
|
|
88
|
-
def all_stock_ticker_data_new(proxies) -> pd.DataFrame:
|
|
81
|
+
def all_stock_ticker_data_new(proxies, time_out) -> pd.DataFrame:
|
|
89
82
|
"""
|
|
90
83
|
使用多线程获取所有股票数据
|
|
91
84
|
"""
|
|
@@ -96,7 +89,7 @@ def all_stock_ticker_data_new(proxies) -> pd.DataFrame:
|
|
|
96
89
|
# 创建线程池
|
|
97
90
|
with ThreadPoolExecutor(max_workers=10) as executor:
|
|
98
91
|
# 提交任务,获取每页数据
|
|
99
|
-
futures = [executor.submit(get_stock_page_data, pn, proxies, PAGE_SIZE)
|
|
92
|
+
futures = [executor.submit(get_stock_page_data, pn, proxies, PAGE_SIZE, time_out)
|
|
100
93
|
for pn in range(1, total_pages + 1)]
|
|
101
94
|
|
|
102
95
|
# 收集结果
|
|
@@ -113,8 +106,8 @@ def all_stock_ticker_data_new(proxies) -> pd.DataFrame:
|
|
|
113
106
|
return pd.DataFrame()
|
|
114
107
|
|
|
115
108
|
|
|
116
|
-
def get_real_time_quotes_all_stocks(proxies):
|
|
117
|
-
page_df = all_stock_ticker_data_new(proxies)
|
|
109
|
+
def get_real_time_quotes_all_stocks(proxies, time_out):
|
|
110
|
+
page_df = all_stock_ticker_data_new(proxies, time_out)
|
|
118
111
|
page_df = rename_real_time_quotes_df(page_df)
|
|
119
112
|
page_df.drop_duplicates('symbol', keep='last', inplace=True)
|
|
120
113
|
return page_df
|
|
@@ -290,16 +283,19 @@ def get_sum_north_south_net_buy_amt():
|
|
|
290
283
|
return df
|
|
291
284
|
|
|
292
285
|
|
|
286
|
+
import mns_common.component.proxies.proxy_common_api as proxy_common_api
|
|
287
|
+
|
|
293
288
|
# 示例调用
|
|
294
289
|
if __name__ == "__main__":
|
|
290
|
+
|
|
295
291
|
while True:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
292
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
293
|
+
proxy = {"https": proxy_ip}
|
|
294
|
+
logger.info(proxy_ip)
|
|
295
|
+
df = all_stock_ticker_data_new(proxy, 3)
|
|
296
|
+
logger.info("数据条数,{}", df.shape[0])
|
|
297
|
+
time.sleep(1)
|
|
298
|
+
|
|
299
|
+
else:
|
|
300
|
+
time.sleep(1)
|
|
301
|
+
logger.error("ip为空")
|
{mns_common-1.5.2.3 → mns_common-1.5.5.9}/mns_common/api/em/real_time/east_money_stock_a_v2_api.py
RENAMED
|
@@ -7,11 +7,20 @@ project_path = file_path[0:end]
|
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
|
|
9
9
|
import requests
|
|
10
|
+
|
|
11
|
+
import mns_common.utils.data_frame_util as data_frame_util
|
|
10
12
|
import json
|
|
11
|
-
import pandas as pd
|
|
12
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
13
13
|
import datetime
|
|
14
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
15
|
+
import mns_common.component.proxies.proxy_common_api as proxy_common_api
|
|
14
16
|
from loguru import logger
|
|
17
|
+
import concurrent.futures
|
|
18
|
+
import pandas as pd
|
|
19
|
+
import time
|
|
20
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
21
|
+
from threading import Lock
|
|
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
|
|
15
24
|
|
|
16
25
|
#
|
|
17
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" \
|
|
@@ -20,6 +29,8 @@ from loguru import logger
|
|
|
20
29
|
# ",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"
|
|
21
30
|
|
|
22
31
|
|
|
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
|
+
|
|
23
34
|
fields = ("f2,f3,f5,f6,f8,"
|
|
24
35
|
"f9,f10,f22,f12,f13,"
|
|
25
36
|
"f14,f15,f16,f17,f18,"
|
|
@@ -31,15 +42,11 @@ fields = ("f2,f3,f5,f6,f8,"
|
|
|
31
42
|
"f84,f102,f184,f100,f103,"
|
|
32
43
|
"f352,f191,f193,f24,f25")
|
|
33
44
|
|
|
34
|
-
# 最大返回条数
|
|
35
|
-
max_number = 5800
|
|
36
|
-
# 最小返回条数
|
|
37
|
-
min_number = 5600
|
|
38
45
|
# 分页条数
|
|
39
|
-
|
|
46
|
+
PAGE_SIZE = 100
|
|
40
47
|
|
|
41
48
|
|
|
42
|
-
def get_stock_page_data(pn,
|
|
49
|
+
def get_stock_page_data(pn, proxies, page_number, time_out):
|
|
43
50
|
"""
|
|
44
51
|
获取单页股票数据
|
|
45
52
|
"""
|
|
@@ -53,7 +60,7 @@ def get_stock_page_data(pn, fields, fs, proxies):
|
|
|
53
60
|
params = {
|
|
54
61
|
"cb": "jQuery1124046660442520420653_" + str(current_timestamp_ms),
|
|
55
62
|
"pn": str(pn),
|
|
56
|
-
"pz":
|
|
63
|
+
"pz": str(page_number), # 每页最大200条
|
|
57
64
|
"po": "1",
|
|
58
65
|
"np": "3",
|
|
59
66
|
"ut": "bd1d9ddb04089700cf9c27f6f7426281",
|
|
@@ -67,9 +74,9 @@ def get_stock_page_data(pn, fields, fs, proxies):
|
|
|
67
74
|
}
|
|
68
75
|
try:
|
|
69
76
|
if proxies is None:
|
|
70
|
-
r = requests.get(url, params)
|
|
77
|
+
r = requests.get(url, params, timeout=time_out)
|
|
71
78
|
else:
|
|
72
|
-
r = requests.get(url, params, proxies=proxies)
|
|
79
|
+
r = requests.get(url, params, proxies=proxies, timeout=time_out)
|
|
73
80
|
data_text = r.text
|
|
74
81
|
begin_index = data_text.index('[')
|
|
75
82
|
end_index = data_text.index(']')
|
|
@@ -80,52 +87,72 @@ def get_stock_page_data(pn, fields, fs, proxies):
|
|
|
80
87
|
else:
|
|
81
88
|
return pd.DataFrame(data_json)
|
|
82
89
|
except Exception as e:
|
|
83
|
-
logger.error(f"获取第{pn}页股票列表异常: {e}")
|
|
84
90
|
return pd.DataFrame()
|
|
85
91
|
|
|
86
92
|
|
|
87
|
-
def all_stock_ticker_data_new(
|
|
88
|
-
"""
|
|
89
|
-
使用多线程获取所有股票数据
|
|
93
|
+
def all_stock_ticker_data_new(initial_proxies, time_out, max_number) -> pd.DataFrame:
|
|
90
94
|
"""
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
# 合并所有成功获取的数据
|
|
109
150
|
if results:
|
|
110
151
|
return pd.concat(results, ignore_index=True)
|
|
111
152
|
else:
|
|
112
153
|
return pd.DataFrame()
|
|
113
154
|
|
|
114
155
|
|
|
115
|
-
def get_all_real_time_quotes(proxies):
|
|
116
|
-
fs = "m:0 t:6,m:0 t:80,m:1 t:2,m:1 t:23,m:0 t:81 s:2048"
|
|
117
|
-
# 获取第一页数据
|
|
118
|
-
page_one_df = get_stock_page_data(1, fields, fs, proxies)
|
|
119
|
-
# 数据接口正常返回5600以上的数量
|
|
120
|
-
if page_one_df.shape[0] > min_number:
|
|
121
|
-
page_one_df = rename_real_time_quotes_df(page_one_df)
|
|
122
|
-
return page_one_df
|
|
123
|
-
else:
|
|
124
|
-
page_df = all_stock_ticker_data_new(fields, fs, proxies)
|
|
125
|
-
page_df = rename_real_time_quotes_df(page_df)
|
|
126
|
-
return page_df
|
|
127
|
-
|
|
128
|
-
|
|
129
156
|
# 获取所有股票实时行情数据 f33,委比
|
|
130
157
|
def rename_real_time_quotes_df(temp_df):
|
|
131
158
|
temp_df = temp_df.rename(columns={
|
|
@@ -286,11 +313,28 @@ def rename_real_time_quotes_df(temp_df):
|
|
|
286
313
|
return temp_df
|
|
287
314
|
|
|
288
315
|
|
|
316
|
+
def get_stock_real_time_quotes(time_out):
|
|
317
|
+
try_numer = 3
|
|
318
|
+
while try_numer > 0:
|
|
319
|
+
proxy_ip = proxy_common_api.generate_proxy_ip_api(1)
|
|
320
|
+
initial_proxies = {"https": proxy_ip,
|
|
321
|
+
"http": proxy_ip}
|
|
322
|
+
|
|
323
|
+
total_number = east_money_stock_common_api.get_stocks_num(1, initial_proxies, 20, time_out)
|
|
324
|
+
if total_number > 0:
|
|
325
|
+
break
|
|
326
|
+
try_numer = try_numer - 1
|
|
327
|
+
if total_number == 0:
|
|
328
|
+
return pd.DataFrame()
|
|
329
|
+
|
|
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
|
|
334
|
+
|
|
335
|
+
|
|
289
336
|
# 示例调用
|
|
290
337
|
if __name__ == "__main__":
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
zt_df = df.loc[df['wei_bi'] == 100]
|
|
295
|
-
logger.info("同步次数,{}", number)
|
|
296
|
-
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])
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import pandas as pd
|
|
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
|
+
|
|
19
|
+
|
|
20
|
+
# 获取所有股票实时行情数据 f33,委比
|
|
21
|
+
def rename_real_time_quotes_df(temp_df):
|
|
22
|
+
temp_df = temp_df.rename(columns={
|
|
23
|
+
"f2": "now_price",
|
|
24
|
+
"f3": "chg",
|
|
25
|
+
"f5": "volume",
|
|
26
|
+
"f6": "amount",
|
|
27
|
+
"f8": "exchange",
|
|
28
|
+
"f10": "quantity_ratio",
|
|
29
|
+
"f22": "up_speed",
|
|
30
|
+
"f11": "up_speed_05",
|
|
31
|
+
"f12": "symbol",
|
|
32
|
+
"f14": "name",
|
|
33
|
+
"f15": "high",
|
|
34
|
+
"f16": "low",
|
|
35
|
+
"f17": "open",
|
|
36
|
+
"f18": "yesterday_price",
|
|
37
|
+
"f20": "total_mv",
|
|
38
|
+
"f21": "flow_mv",
|
|
39
|
+
"f26": "list_date",
|
|
40
|
+
"f33": "wei_bi",
|
|
41
|
+
"f34": "outer_disk",
|
|
42
|
+
"f35": "inner_disk",
|
|
43
|
+
"f62": "today_main_net_inflow",
|
|
44
|
+
"f66": "super_large_order_net_inflow",
|
|
45
|
+
"f69": "super_large_order_net_inflow_ratio",
|
|
46
|
+
"f72": "large_order_net_inflow",
|
|
47
|
+
# "f78": "medium_order_net_inflow",
|
|
48
|
+
# "f84": "small_order_net_inflow",
|
|
49
|
+
"f100": "industry",
|
|
50
|
+
# "f103": "concept",
|
|
51
|
+
"f184": "today_main_net_inflow_ratio",
|
|
52
|
+
"f352": "average_price",
|
|
53
|
+
"f211": "buy_1_num",
|
|
54
|
+
"f212": "sell_1_num"
|
|
55
|
+
})
|
|
56
|
+
if data_frame_util.is_empty(temp_df):
|
|
57
|
+
return pd.DataFrame()
|
|
58
|
+
else:
|
|
59
|
+
temp_df.loc[temp_df['buy_1_num'] == '-', 'buy_1_num'] = 0
|
|
60
|
+
temp_df.loc[temp_df['sell_1_num'] == '-', 'sell_1_num'] = 0
|
|
61
|
+
temp_df.loc[temp_df['up_speed_05'] == '-', 'up_speed_05'] = 0
|
|
62
|
+
temp_df.loc[temp_df['up_speed'] == '-', 'up_speed'] = 0
|
|
63
|
+
temp_df.loc[temp_df['average_price'] == '-', 'average_price'] = 0
|
|
64
|
+
temp_df.loc[temp_df['wei_bi'] == '-', 'wei_bi'] = 0
|
|
65
|
+
temp_df.loc[temp_df['yesterday_price'] == '-', 'yesterday_price'] = 0
|
|
66
|
+
temp_df.loc[temp_df['now_price'] == '-', 'now_price'] = 0
|
|
67
|
+
temp_df.loc[temp_df['chg'] == '-', 'chg'] = 0
|
|
68
|
+
temp_df.loc[temp_df['volume'] == '-', 'volume'] = 0
|
|
69
|
+
temp_df.loc[temp_df['amount'] == '-', 'amount'] = 0
|
|
70
|
+
temp_df.loc[temp_df['exchange'] == '-', 'exchange'] = 0
|
|
71
|
+
temp_df.loc[temp_df['quantity_ratio'] == '-', 'quantity_ratio'] = 0
|
|
72
|
+
temp_df.loc[temp_df['high'] == '-', 'high'] = 0
|
|
73
|
+
temp_df.loc[temp_df['low'] == '-', 'low'] = 0
|
|
74
|
+
temp_df.loc[temp_df['open'] == '-', 'open'] = 0
|
|
75
|
+
temp_df.loc[temp_df['total_mv'] == '-', 'total_mv'] = 0
|
|
76
|
+
temp_df.loc[temp_df['flow_mv'] == '-', 'flow_mv'] = 0
|
|
77
|
+
temp_df.loc[temp_df['inner_disk'] == '-', 'inner_disk'] = 0
|
|
78
|
+
temp_df.loc[temp_df['outer_disk'] == '-', 'outer_disk'] = 0
|
|
79
|
+
temp_df.loc[temp_df['today_main_net_inflow_ratio'] == '-', 'today_main_net_inflow_ratio'] = 0
|
|
80
|
+
temp_df.loc[temp_df['today_main_net_inflow'] == '-', 'today_main_net_inflow'] = 0
|
|
81
|
+
temp_df.loc[temp_df['super_large_order_net_inflow'] == '-', 'super_large_order_net_inflow'] = 0
|
|
82
|
+
temp_df.loc[temp_df['super_large_order_net_inflow_ratio'] == '-', 'super_large_order_net_inflow_ratio'] = 0
|
|
83
|
+
temp_df.loc[temp_df['large_order_net_inflow'] == '-', 'large_order_net_inflow'] = 0
|
|
84
|
+
# temp_df.loc[temp_df['medium_order_net_inflow'] == '-', 'medium_order_net_inflow'] = 0
|
|
85
|
+
# temp_df.loc[temp_df['small_order_net_inflow'] == '-', 'small_order_net_inflow'] = 0
|
|
86
|
+
|
|
87
|
+
temp_df["list_date"] = pd.to_numeric(temp_df["list_date"], errors="coerce")
|
|
88
|
+
temp_df["wei_bi"] = pd.to_numeric(temp_df["wei_bi"], errors="coerce")
|
|
89
|
+
temp_df["average_price"] = pd.to_numeric(temp_df["average_price"], errors="coerce")
|
|
90
|
+
temp_df["yesterday_price"] = pd.to_numeric(temp_df["yesterday_price"], errors="coerce")
|
|
91
|
+
temp_df["now_price"] = pd.to_numeric(temp_df["now_price"], errors="coerce")
|
|
92
|
+
temp_df["chg"] = pd.to_numeric(temp_df["chg"], errors="coerce")
|
|
93
|
+
temp_df["volume"] = pd.to_numeric(temp_df["volume"], errors="coerce")
|
|
94
|
+
temp_df["amount"] = pd.to_numeric(temp_df["amount"], errors="coerce")
|
|
95
|
+
temp_df["exchange"] = pd.to_numeric(temp_df["exchange"], errors="coerce")
|
|
96
|
+
temp_df["quantity_ratio"] = pd.to_numeric(temp_df["quantity_ratio"], errors="coerce")
|
|
97
|
+
temp_df["high"] = pd.to_numeric(temp_df["high"], errors="coerce")
|
|
98
|
+
temp_df["low"] = pd.to_numeric(temp_df["low"], errors="coerce")
|
|
99
|
+
temp_df["open"] = pd.to_numeric(temp_df["open"], errors="coerce")
|
|
100
|
+
temp_df["total_mv"] = pd.to_numeric(temp_df["total_mv"], errors="coerce")
|
|
101
|
+
temp_df["flow_mv"] = pd.to_numeric(temp_df["flow_mv"], errors="coerce")
|
|
102
|
+
temp_df["outer_disk"] = pd.to_numeric(temp_df["outer_disk"], errors="coerce")
|
|
103
|
+
temp_df["inner_disk"] = pd.to_numeric(temp_df["inner_disk"], errors="coerce")
|
|
104
|
+
temp_df["today_main_net_inflow"] = pd.to_numeric(temp_df["today_main_net_inflow"], errors="coerce")
|
|
105
|
+
temp_df["super_large_order_net_inflow"] = pd.to_numeric(temp_df["super_large_order_net_inflow"],
|
|
106
|
+
errors="coerce")
|
|
107
|
+
temp_df["super_large_order_net_inflow_ratio"] = pd.to_numeric(temp_df["super_large_order_net_inflow_ratio"],
|
|
108
|
+
errors="coerce")
|
|
109
|
+
temp_df["large_order_net_inflow"] = pd.to_numeric(temp_df["large_order_net_inflow"],
|
|
110
|
+
errors="coerce")
|
|
111
|
+
# temp_df["medium_order_net_inflow"] = pd.to_numeric(temp_df["medium_order_net_inflow"],
|
|
112
|
+
# errors="coerce")
|
|
113
|
+
# temp_df["small_order_net_inflow"] = pd.to_numeric(temp_df["small_order_net_inflow"], errors="coerce")
|
|
114
|
+
|
|
115
|
+
# 大单比例
|
|
116
|
+
temp_df['large_order_net_inflow_ratio'] = round((temp_df['large_order_net_inflow'] / temp_df['amount']) * 100,
|
|
117
|
+
2)
|
|
118
|
+
|
|
119
|
+
# 外盘是内盘倍数
|
|
120
|
+
temp_df['disk_ratio'] = round((temp_df['outer_disk'] - temp_df['inner_disk']) / temp_df['inner_disk'], 2)
|
|
121
|
+
# 只有外盘没有内盘
|
|
122
|
+
temp_df.loc[temp_df["inner_disk"] == 0, ['disk_ratio']] = 1688
|
|
123
|
+
temp_df = temp_df.sort_values(by=['chg'], ascending=False)
|
|
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)
|