mns-common 1.3.8.0__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.

Files changed (179) hide show
  1. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/PKG-INFO +1 -1
  2. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/akshare/k_line_api.py +20 -82
  3. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_bid_ask_api.py +21 -14
  4. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_zt_pool_api.py +1 -1
  5. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py +62 -7
  6. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_debt_api.py +144 -19
  7. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_etf_api.py +140 -10
  8. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_a_api.py +37 -38
  9. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_a_v2_api.py +106 -10
  10. mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_common_rename.py +109 -0
  11. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_hk_api.py +11 -105
  12. mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py +260 -0
  13. mns_common-1.5.2.8/mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py +146 -0
  14. mns_common-1.5.2.8/mns_common/api/em/real_time/real_time_quotes_repeat_api.py +428 -0
  15. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/k_line/stock_k_line_data_api.py +11 -1
  16. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/common/kpl_common_api.py +35 -0
  17. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/symbol_his_quotes_api.py +1 -1
  18. mns_common-1.5.2.8/mns_common/api/proxies/liu_guan_proxy_api.py +115 -0
  19. mns_common-1.5.2.8/mns_common/api/ths/company/company_product_area_industry_index_query.py +46 -0
  20. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/company/ths_company_info_api.py +12 -9
  21. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/concept/app/ths_concept_index_app.py +3 -1
  22. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/wen_cai/ths_wen_cai_api.py +10 -7
  23. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/zt/ths_stock_zt_pool_api.py +14 -1
  24. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +94 -29
  25. mns_common-1.5.2.8/mns_common/api/xueqiu/xue_qiu_k_line_api.py +83 -0
  26. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/common_service_fun_api.py +57 -2
  27. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/company/company_common_service_new_api.py +2 -0
  28. mns_common-1.5.2.8/mns_common/component/cookie/cookie_enum.py +15 -0
  29. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/cookie/cookie_info_service.py +9 -4
  30. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/data/data_init_api.py +13 -8
  31. mns_common-1.5.2.8/mns_common/component/deal/deal_service_v2_api.py +167 -0
  32. mns_common-1.5.2.8/mns_common/component/em/em_stock_info_api.py +48 -0
  33. mns_common-1.5.2.8/mns_common/component/exception/ExceptionMonitor.py +86 -0
  34. mns_common-1.5.2.8/mns_common/component/proxies/proxy_common_api.py +252 -0
  35. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/task/real_time_data_sync_check.py +55 -12
  36. mns_common-1.5.2.8/mns_common/component/tfp/stock_tfp_api.py +132 -0
  37. mns_common-1.5.2.8/mns_common/component/us/__init__.py +7 -0
  38. mns_common-1.5.2.8/mns_common/component/us/us_stock_etf_info_api.py +125 -0
  39. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/constant/db_name_constant.py +13 -0
  40. mns_common-1.5.2.8/mns_common/constant/extra_income_db_name.py +105 -0
  41. mns_common-1.5.2.8/mns_common/constant/strategy_classify.py +72 -0
  42. mns_common-1.5.2.8/mns_common/db/__init__.py +7 -0
  43. mns_common-1.5.2.8/mns_common/db/v2/__init__.py +7 -0
  44. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common.egg-info/PKG-INFO +1 -1
  45. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common.egg-info/SOURCES.txt +12 -0
  46. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/setup.py +1 -1
  47. mns_common-1.3.8.0/mns_common/api/proxies/liu_guan_proxy_api.py +0 -65
  48. mns_common-1.3.8.0/mns_common/api/xueqiu/xue_qiu_k_line_api.py +0 -70
  49. mns_common-1.3.8.0/mns_common/component/em/em_stock_info_api.py +0 -37
  50. mns_common-1.3.8.0/mns_common/component/proxies/proxy_common_api.py +0 -84
  51. mns_common-1.3.8.0/mns_common/component/tfp/stock_tfp_api.py +0 -62
  52. mns_common-1.3.8.0/mns_common/constant/extra_income_db_name.py +0 -53
  53. mns_common-1.3.8.0/mns_common/utils/__init__.py +0 -8
  54. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/README.md +0 -0
  55. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/__init__.py +0 -0
  56. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/__init__.py +0 -0
  57. {mns_common-1.3.8.0/mns_common/api/em → mns_common-1.5.2.8/mns_common/api/akshare}/__init__.py +0 -0
  58. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_dt_pool.py +0 -0
  59. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/akshare/stock_zb_pool.py +0 -0
  60. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/akshare/yjyg_sync_api.py +0 -0
  61. {mns_common-1.3.8.0/mns_common/api/kpl → mns_common-1.5.2.8/mns_common/api/em}/__init__.py +0 -0
  62. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/concept/__init__.py +0 -0
  63. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/concept/em_concept_index_api.py +0 -0
  64. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/gd/__init__.py +0 -0
  65. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/real_time/__init__.py +0 -0
  66. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/em/real_time/east_money_stock_us_api.py +0 -0
  67. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/hk/__init__.py +0 -0
  68. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/hk/ths_hk_company_info_api.py +0 -0
  69. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/k_line/__init__.py +0 -0
  70. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/k_line/stock_minute_data_api.py +0 -0
  71. {mns_common-1.3.8.0/mns_common/api/kpl/constant → mns_common-1.5.2.8/mns_common/api/kpl}/__init__.py +0 -0
  72. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/common/__init__.py +0 -0
  73. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/common/kpl_common_field_constant.py +0 -0
  74. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/concept/__init__.py +0 -0
  75. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/concept/kpl_concept_api.py +0 -0
  76. {mns_common-1.3.8.0/mns_common/api/kpl/selection → mns_common-1.5.2.8/mns_common/api/kpl/constant}/__init__.py +0 -0
  77. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/constant/kpl_constant.py +0 -0
  78. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/industry/__init__.py +0 -0
  79. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/industry/kpl_industry_api.py +0 -0
  80. {mns_common-1.3.8.0/mns_common/api/msg → mns_common-1.5.2.8/mns_common/api/kpl/selection}/__init__.py +0 -0
  81. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/selection/kpl_selection_plate_api.py +0 -0
  82. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/__init__.py +0 -0
  83. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/kpl_real_time_quotes_api.py +0 -0
  84. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/kpl/symbol/kpl_symbol_common_field_constant.py +0 -0
  85. {mns_common-1.3.8.0/mns_common/api/ths → mns_common-1.5.2.8/mns_common/api/msg}/__init__.py +0 -0
  86. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/msg/push_msg_api.py +0 -0
  87. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/proxies/__init__.py +0 -0
  88. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/qmt/__init__.py +0 -0
  89. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/qmt/qmt_minunte_tick_data.py +0 -0
  90. {mns_common-1.3.8.0/mns_common/api/ths/big_deal → mns_common-1.5.2.8/mns_common/api/ths}/__init__.py +0 -0
  91. {mns_common-1.3.8.0/mns_common/api/ths/concept → mns_common-1.5.2.8/mns_common/api/ths/big_deal}/__init__.py +0 -0
  92. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/big_deal/ths_big_deal_api.py +0 -0
  93. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/company/__init__.py +0 -0
  94. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/company/ths_company_announce_api.py +0 -0
  95. {mns_common-1.3.8.0/mns_common/api/ths/concept/app → mns_common-1.5.2.8/mns_common/api/ths/concept}/__init__.py +0 -0
  96. {mns_common-1.3.8.0/mns_common/api/ths/concept/web → mns_common-1.5.2.8/mns_common/api/ths/concept/app}/__init__.py +0 -0
  97. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/concept/app/ths_concept_detail_app.py +0 -0
  98. {mns_common-1.3.8.0/mns_common/api/ths/self_choose → mns_common-1.5.2.8/mns_common/api/ths/concept/web}/__init__.py +0 -0
  99. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_common_js_api.py +0 -0
  100. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_company_info_web.py +0 -0
  101. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_concept_detail_web.py +0 -0
  102. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/concept/web/ths_concept_index_web.py +0 -0
  103. {mns_common-1.3.8.0/mns_common/api/ths/wen_cai → mns_common-1.5.2.8/mns_common/api/ths/self_choose}/__init__.py +0 -0
  104. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/self_choose/ths_self_choose_api.py +0 -0
  105. {mns_common-1.3.8.0/mns_common/component → mns_common-1.5.2.8/mns_common/api/ths/wen_cai}/__init__.py +0 -0
  106. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/ths/zt/__init__.py +0 -0
  107. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/us/__init__.py +0 -0
  108. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/us/ths_us_company_info_api.py +0 -0
  109. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/api/xueqiu/__init__.py +0 -0
  110. {mns_common-1.3.8.0/mns_common/component/cache → mns_common-1.5.2.8/mns_common/component}/__init__.py +0 -0
  111. {mns_common-1.3.8.0/mns_common/component/company → mns_common-1.5.2.8/mns_common/component/cache}/__init__.py +0 -0
  112. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/cache/cache_service.py +0 -0
  113. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/classify/__init__.py +0 -0
  114. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/classify/symbol_classify_api.py +0 -0
  115. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/classify/symbol_classify_param.py +0 -0
  116. {mns_common-1.3.8.0/mns_common/component/concept → mns_common-1.5.2.8/mns_common/component/company}/__init__.py +0 -0
  117. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/company/company_common_service_api.py +0 -0
  118. {mns_common-1.3.8.0/mns_common/component/data → mns_common-1.5.2.8/mns_common/component/concept}/__init__.py +0 -0
  119. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/concept/kpl_concept_common_service_api.py +0 -0
  120. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/concept/ths_concept_common_service_api.py +0 -0
  121. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/cookie/__init__.py +0 -0
  122. {mns_common-1.3.8.0/mns_common/component/industry → mns_common-1.5.2.8/mns_common/component/data}/__init__.py +0 -0
  123. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/deal/__init__.py +0 -0
  124. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/deal/deal_service_api.py +0 -0
  125. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/deal/terminal_enum.py +0 -0
  126. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/em/__init__.py +0 -0
  127. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/em/em_real_time_quotes_api.py +0 -0
  128. {mns_common-1.3.8.0/mns_common/component/hk → mns_common-1.5.2.8/mns_common/component/exception}/__init__.py +0 -0
  129. {mns_common-1.3.8.0/mns_common/component/price → mns_common-1.5.2.8/mns_common/component/hk}/__init__.py +0 -0
  130. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/hk/company_hk_service_api.py +0 -0
  131. {mns_common-1.3.8.0/mns_common/component/k_line → mns_common-1.5.2.8/mns_common/component/industry}/__init__.py +0 -0
  132. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/industry/ths_industry_index_api.py +0 -0
  133. {mns_common-1.3.8.0/mns_common/component/k_line/clean → mns_common-1.5.2.8/mns_common/component/k_line}/__init__.py +0 -0
  134. {mns_common-1.3.8.0/mns_common/component/k_line/common → mns_common-1.5.2.8/mns_common/component/k_line/clean}/__init__.py +0 -0
  135. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/k_line/clean/k_line_param.py +0 -0
  136. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/k_line/clean/sh_small_normal_zt_k_line_check_api.py +0 -0
  137. {mns_common-1.3.8.0/mns_common/component/k_line/patterns → mns_common-1.5.2.8/mns_common/component/k_line/common}/__init__.py +0 -0
  138. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/k_line/common/k_line_common_service_api.py +0 -0
  139. {mns_common-1.3.8.0/mns_common/component/real_time → mns_common-1.5.2.8/mns_common/component/k_line/patterns}/__init__.py +0 -0
  140. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/k_line/patterns/k_line_patterns_service_api.py +0 -0
  141. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/k_line/patterns/pattern_Enum.py +0 -0
  142. {mns_common-1.3.8.0/mns_common/component/proxies → mns_common-1.5.2.8/mns_common/component/price}/__init__.py +0 -0
  143. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/price/trade_price_service_api.py +0 -0
  144. {mns_common-1.3.8.0/mns_common/component/qmt → mns_common-1.5.2.8/mns_common/component/proxies}/__init__.py +0 -0
  145. {mns_common-1.3.8.0/mns_common/component/redis_msg → mns_common-1.5.2.8/mns_common/component/qmt}/__init__.py +0 -0
  146. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/qmt/qmt_buy_service.py +0 -0
  147. {mns_common-1.3.8.0/mns_common/component/trade_date → mns_common-1.5.2.8/mns_common/component/real_time}/__init__.py +0 -0
  148. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/real_time/real_time_common_service_api.py +0 -0
  149. {mns_common-1.3.8.0/mns_common/component/task → mns_common-1.5.2.8/mns_common/component/redis_msg}/__init__.py +0 -0
  150. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/redis_msg/redis_msg_publish_service.py +0 -0
  151. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/self_choose/__init__.py +0 -0
  152. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/self_choose/black_list_service_api.py +0 -0
  153. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/self_choose/self_choose_service_api.py +0 -0
  154. {mns_common-1.3.8.0/mns_common/component/tfp → mns_common-1.5.2.8/mns_common/component/task}/__init__.py +0 -0
  155. {mns_common-1.3.8.0/mns_common/db/v2 → mns_common-1.5.2.8/mns_common/component/tfp}/__init__.py +0 -0
  156. {mns_common-1.3.8.0/mns_common/component/zt → mns_common-1.5.2.8/mns_common/component/trade_date}/__init__.py +0 -0
  157. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/trade_date/trade_date_common_service_api.py +0 -0
  158. {mns_common-1.3.8.0/mns_common/db → mns_common-1.5.2.8/mns_common/component/zt}/__init__.py +0 -0
  159. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/component/zt/zt_common_service_api.py +0 -0
  160. {mns_common-1.3.8.0/mns_common/api/akshare → mns_common-1.5.2.8/mns_common/constant}/__init__.py +0 -0
  161. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/constant/black_list_classify_enum.py +0 -0
  162. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/constant/east_money_stock_api.py +0 -0
  163. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/constant/price_enum.py +0 -0
  164. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/constant/redis_msg_constant.py +0 -0
  165. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/constant/self_choose_constant.py +0 -0
  166. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/db/MongodbUtil.py +0 -0
  167. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/db/MongodbUtilLocal.py +0 -0
  168. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/db/v2/MongodbUtilV2.py +0 -0
  169. {mns_common-1.3.8.0/mns_common/constant → mns_common-1.5.2.8/mns_common/utils}/__init__.py +0 -0
  170. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/utils/async_fun.py +0 -0
  171. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/utils/cmd_util.py +0 -0
  172. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/utils/data_frame_util.py +0 -0
  173. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/utils/date_handle_util.py +0 -0
  174. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/utils/db_util.py +0 -0
  175. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/utils/file_util.py +0 -0
  176. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common/utils/ip_util.py +0 -0
  177. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common.egg-info/dependency_links.txt +0 -0
  178. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/mns_common.egg-info/top_level.txt +0 -0
  179. {mns_common-1.3.8.0 → mns_common-1.5.2.8}/setup.cfg +0 -0
@@ -1,3 +1,3 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mns_common
3
- Version: 1.3.8.0
3
+ Version: 1.5.2.8
@@ -9,93 +9,16 @@ import requests
9
9
  import pandas as pd
10
10
  import mns_common.component.common_service_fun_api as common_service_fun_api
11
11
  from datetime import datetime
12
- from functools import lru_cache
13
12
  import numpy as np
14
13
 
15
14
 
16
- @lru_cache(maxsize=None)
17
- def code_id_map_em() -> dict:
18
- """
19
- 东方财富-股票和市场代码
20
- http://quote.eastmoney.com/center/gridlist.html#hs_a_board
21
- :return: 股票和市场代码
22
- :rtype: dict
23
- """
24
- url = "http://80.push2.eastmoney.com/api/qt/clist/get"
25
- params = {
26
- "pn": "1",
27
- "pz": "5000",
28
- "po": "1",
29
- "np": "3",
30
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
31
- "fltt": "2",
32
- "invt": "2",
33
- "fid": "f3",
34
- "fs": "m:1 t:2,m:1 t:23",
35
- "fields": "f12",
36
- "_": "1623833739532",
37
- }
38
- r = requests.get(url, params=params)
39
- data_json = r.json()
40
- if not data_json["data"]["diff"]:
41
- return pd.DataFrame()
42
- temp_df = pd.DataFrame(data_json["data"]["diff"])
43
- temp_df["market_id"] = 1
44
- temp_df.columns = ["sh_code", "sh_id"]
45
- code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"]))
46
- params = {
47
- "pn": "1",
48
- "pz": "5000",
49
- "po": "1",
50
- "np": "3",
51
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
52
- "fltt": "2",
53
- "invt": "2",
54
- "fid": "f3",
55
- "fs": "m:0 t:6,m:0 t:80",
56
- "fields": "f12",
57
- "_": "1623833739532",
58
- }
59
- r = requests.get(url, params=params)
60
- data_json = r.json()
61
- if not data_json["data"]["diff"]:
62
- return pd.DataFrame()
63
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
64
- temp_df_sz["sz_id"] = 0
65
- code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"])))
66
- now_date = datetime.now()
67
- now_time = int(now_date.timestamp() * 1000)
68
- now_time = str(now_time)
69
-
70
- params = {
71
- "pn": "1",
72
- "pz": "5000",
73
- "po": "1",
74
- "np": "3",
75
- "ut": "bd1d9ddb04089700cf9c27f6f7426281",
76
- "fltt": "2",
77
- "invt": "2",
78
- "fid": "f3",
79
- "fs": "m:0 t:81 s:2048",
80
- "fields": "f12",
81
- "_": now_time,
82
- }
83
- r = requests.get(url, params=params)
84
- data_json = r.json()
85
- if not data_json["data"]["diff"]:
86
- return pd.DataFrame()
87
- temp_df_sz = pd.DataFrame(data_json["data"]["diff"])
88
- temp_df_sz["bj_id"] = 0
89
- code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["bj_id"])))
90
- return code_id_dict
91
-
92
-
93
15
  def stock_zh_a_hist(
94
- symbol: str = "000001",
16
+ symbol: str = "0.000001",
95
17
  period: str = 'daily',
96
18
  start_date: str = "19700101",
97
19
  end_date: str = "22220101",
98
20
  adjust: str = "",
21
+ proxies: str = None
99
22
  ) -> pd.DataFrame:
100
23
  """
101
24
  东方财富网-行情首页-沪深京 A 股-每日行情
@@ -110,10 +33,12 @@ def stock_zh_a_hist(
110
33
  :type end_date: str
111
34
  :param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"}
112
35
  :type adjust: str
36
+ :param proxies: 代理ip
37
+ :type proxies: str
38
+
113
39
  :return: 每日行情
114
40
  :rtype: pandas.DataFrame
115
41
  """
116
- code_id_dict = code_id_map_em()
117
42
  adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
118
43
  period_dict = {'daily': '101', 'weekly': '102', 'monthly': '103'}
119
44
  url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
@@ -132,7 +57,12 @@ def stock_zh_a_hist(
132
57
  "end": "20500000",
133
58
  "_": now_time,
134
59
  }
135
- r = requests.get(url, params=params)
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
+
136
66
  data_json = r.json()
137
67
  temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]])
138
68
  temp_df.columns = [
@@ -179,7 +109,15 @@ def stock_zh_a_hist(
179
109
  return temp_df
180
110
 
181
111
 
112
+ import mns_common.component.proxies.proxy_common_api as proxy_common_api
113
+
182
114
  if __name__ == '__main__':
183
115
  while True:
184
- df = stock_zh_a_hist()
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)
185
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") -> dict:
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": "f43,f51,f52,f191,f120,f121,f122,f174,f175,f59,f163,f43,f57,f58,f169,f170,f46,f44,f51,f168,f47,f164,f116,f60,f45,f52,f50,f48,f167,f117,f71,f161,f49,f530,f135,f136,f137,f138,f139,f141,f142,f144,f145,f147,f148,f140,f143,f146,f149,f55,f62,f162,f92,f173,f104,f105,f84,f85,f183,f184,f185,f186,f187,f188,f189,f190,f191,f192,f107,f111,f86,f177,f78,f110,f262,f263,f264,f267,f268,f255,f256,f257,f258,f127,f199,f128,f198,f259,f260,f261,f171,f277,f278,f279,f288,f152,f250,f251,f252,f253,f254,f269,f270,f271,f272,f273,f274,f275,f276,f265,f266,f289,f290,f286,f285,f292,f293,f294,f295",
26
- # "fields" :fields_02,
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)
@@ -57,25 +64,25 @@ def stock_bid_ask_em(symbol: str = "000001") -> dict:
57
64
  temp_df = pd.DataFrame(tick_dict, index=[1])
58
65
  temp_df.reset_index(inplace=True)
59
66
  temp_df.loc[temp_df['wei_bi'] == '-', 'wei_bi'] = 0
60
- temp_df.loc[temp_df['sell_5'] == '-', 'sell_5_vol'] = 0
67
+ temp_df.loc[temp_df['sell_5_vol'] == '-', 'sell_5_vol'] = 0
61
68
  temp_df.loc[temp_df['sell_5'] == '-', 'sell_5'] = 0
62
- temp_df.loc[temp_df['sell_4'] == '-', 'sell_4_vol'] = 0
69
+ temp_df.loc[temp_df['sell_4_vol'] == '-', 'sell_4_vol'] = 0
63
70
  temp_df.loc[temp_df['sell_4'] == '-', 'sell_4'] = 0
64
- temp_df.loc[temp_df['sell_3'] == '-', 'sell_3_vol'] = 0
71
+ temp_df.loc[temp_df['sell_3_vol'] == '-', 'sell_3_vol'] = 0
65
72
  temp_df.loc[temp_df['sell_3'] == '-', 'sell_3'] = 0
66
- temp_df.loc[temp_df['sell_2'] == '-', 'sell_2_vol'] = 0
73
+ temp_df.loc[temp_df['sell_2_vol'] == '-', 'sell_2_vol'] = 0
67
74
  temp_df.loc[temp_df['sell_2'] == '-', 'sell_2'] = 0
68
- temp_df.loc[temp_df['sell_1'] == '-', 'sell_1_vol'] = 0
75
+ temp_df.loc[temp_df['sell_1_vol'] == '-', 'sell_1_vol'] = 0
69
76
  temp_df.loc[temp_df['sell_1'] == '-', 'sell_1'] = 0
70
- temp_df.loc[temp_df['buy_1'] == '-', 'buy_1_vol'] = 0
77
+ temp_df.loc[temp_df['buy_1_vol'] == '-', 'buy_1_vol'] = 0
71
78
  temp_df.loc[temp_df['buy_1'] == '-', 'buy_1'] = 0
72
- temp_df.loc[temp_df['buy_2'] == '-', 'buy_2_vol'] = 0
79
+ temp_df.loc[temp_df['buy_2_vol'] == '-', 'buy_2_vol'] = 0
73
80
  temp_df.loc[temp_df['buy_2'] == '-', 'buy_2'] = 0
74
- temp_df.loc[temp_df['buy_3'] == '-', 'buy_3_vol'] = 0
81
+ temp_df.loc[temp_df['buy_3_vol'] == '-', 'buy_3_vol'] = 0
75
82
  temp_df.loc[temp_df['buy_3'] == '-', 'buy_3'] = 0
76
- temp_df.loc[temp_df['buy_4'] == '-', 'buy_4_vol'] = 0
83
+ temp_df.loc[temp_df['buy_4_vol'] == '-', 'buy_4_vol'] = 0
77
84
  temp_df.loc[temp_df['buy_4'] == '-', 'buy_4'] = 0
78
- temp_df.loc[temp_df['buy_5'] == '-', 'buy_5_vol'] = 0
85
+ temp_df.loc[temp_df['buy_5_vol'] == '-', 'buy_5_vol'] = 0
79
86
  temp_df.loc[temp_df['buy_5'] == '-', 'buy_5'] = 0
80
87
  temp_df['symbol'] = symbol
81
88
  return temp_df
@@ -83,5 +90,5 @@ def stock_bid_ask_em(symbol: str = "000001") -> dict:
83
90
 
84
91
  if __name__ == '__main__':
85
92
  while True:
86
- df = stock_bid_ask_em('0.832110')
93
+ df = stock_bid_ask_em('0.000001')
87
94
  print(df)
@@ -43,5 +43,5 @@ def stock_em_zt_pool_df(date):
43
43
 
44
44
 
45
45
  if __name__ == '__main__':
46
- df = stock_em_zt_pool_df('2024-09-04')
46
+ df = stock_em_zt_pool_df('2025-10-24')
47
47
  print(df)
@@ -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
- stock_gdfx_free_top_10_em_df['_id'] = symbol + '_' + stock_gdfx_free_top_10_em_df.index + '_' + period
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
- stock_gdfx_top_10_em_df['_id'] = symbol + '_' + stock_gdfx_top_10_em_df.index + '_' + period
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
- now_date = datetime.now()
195
- str_day_test = now_date.strftime('%Y-%m-%d')
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
- get_stock_gdfx_free_top_10_em(str_day_test, '833580')
252
+ sync_stock_gdfx_free_top_10_one_day(str_day_test)
@@ -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
- from concurrent.futures import ThreadPoolExecutor
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(fields, pn, proxies) -> pd.DataFrame:
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": 2000,
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
- info_df = get_kzz_bond_info()
303
- print(info_df)
304
- while True:
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
+