mns-common 1.3.9.2__tar.gz → 1.3.9.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.

Potentially problematic release.


This version of mns-common might be problematic. Click here for more details.

Files changed (163) hide show
  1. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/PKG-INFO +1 -1
  2. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/akshare/k_line_api.py +1 -80
  3. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/xueqiu/xue_qiu_k_line_api.py +19 -22
  4. mns_common-1.3.9.9/mns_common/component/exception/ExceptionMonitor.py +86 -0
  5. mns_common-1.3.9.9/mns_common/component/proxies/proxy_common_api.py +192 -0
  6. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/extra_income_db_name.py +9 -0
  7. mns_common-1.3.9.9/mns_common/db/v2/__init__.py +7 -0
  8. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common.egg-info/PKG-INFO +1 -1
  9. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common.egg-info/SOURCES.txt +2 -0
  10. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/setup.py +1 -1
  11. mns_common-1.3.9.2/mns_common/component/proxies/proxy_common_api.py +0 -84
  12. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/README.md +0 -0
  13. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/__init__.py +0 -0
  14. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/__init__.py +0 -0
  15. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/akshare/__init__.py +0 -0
  16. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/akshare/stock_bid_ask_api.py +0 -0
  17. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/akshare/stock_dt_pool.py +0 -0
  18. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/akshare/stock_zb_pool.py +0 -0
  19. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/akshare/stock_zt_pool_api.py +0 -0
  20. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/akshare/yjyg_sync_api.py +0 -0
  21. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/__init__.py +0 -0
  22. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/concept/__init__.py +0 -0
  23. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/concept/em_concept_index_api.py +0 -0
  24. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/gd/__init__.py +0 -0
  25. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py +0 -0
  26. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/real_time/__init__.py +0 -0
  27. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/real_time/east_money_debt_api.py +0 -0
  28. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/real_time/east_money_etf_api.py +0 -0
  29. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/real_time/east_money_stock_a_api.py +0 -0
  30. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/real_time/east_money_stock_a_v2_api.py +0 -0
  31. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/real_time/east_money_stock_hk_api.py +0 -0
  32. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/em/real_time/east_money_stock_us_api.py +0 -0
  33. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/hk/__init__.py +0 -0
  34. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/hk/ths_hk_company_info_api.py +0 -0
  35. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/k_line/__init__.py +0 -0
  36. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/k_line/stock_k_line_data_api.py +0 -0
  37. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/k_line/stock_minute_data_api.py +0 -0
  38. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/__init__.py +0 -0
  39. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/common/__init__.py +0 -0
  40. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/common/kpl_common_api.py +0 -0
  41. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/common/kpl_common_field_constant.py +0 -0
  42. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/concept/__init__.py +0 -0
  43. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/concept/kpl_concept_api.py +0 -0
  44. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/constant/__init__.py +0 -0
  45. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/constant/kpl_constant.py +0 -0
  46. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/industry/__init__.py +0 -0
  47. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/industry/kpl_industry_api.py +0 -0
  48. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/selection/__init__.py +0 -0
  49. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/selection/kpl_selection_plate_api.py +0 -0
  50. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/symbol/__init__.py +0 -0
  51. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/symbol/kpl_real_time_quotes_api.py +0 -0
  52. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/symbol/kpl_symbol_common_field_constant.py +0 -0
  53. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/kpl/symbol/symbol_his_quotes_api.py +0 -0
  54. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/msg/__init__.py +0 -0
  55. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/msg/push_msg_api.py +0 -0
  56. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/proxies/__init__.py +0 -0
  57. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/proxies/liu_guan_proxy_api.py +0 -0
  58. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/qmt/__init__.py +0 -0
  59. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/qmt/qmt_minunte_tick_data.py +0 -0
  60. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/__init__.py +0 -0
  61. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/big_deal/__init__.py +0 -0
  62. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/big_deal/ths_big_deal_api.py +0 -0
  63. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/company/__init__.py +0 -0
  64. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/company/ths_company_announce_api.py +0 -0
  65. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/company/ths_company_info_api.py +0 -0
  66. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/__init__.py +0 -0
  67. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/app/__init__.py +0 -0
  68. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/app/ths_concept_detail_app.py +0 -0
  69. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/app/ths_concept_index_app.py +0 -0
  70. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/web/__init__.py +0 -0
  71. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/web/ths_common_js_api.py +0 -0
  72. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/web/ths_company_info_web.py +0 -0
  73. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/web/ths_concept_detail_web.py +0 -0
  74. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/concept/web/ths_concept_index_web.py +0 -0
  75. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/self_choose/__init__.py +0 -0
  76. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/self_choose/ths_self_choose_api.py +0 -0
  77. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/wen_cai/__init__.py +0 -0
  78. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/wen_cai/ths_wen_cai_api.py +0 -0
  79. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/zt/__init__.py +0 -0
  80. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/zt/ths_stock_zt_pool_api.py +0 -0
  81. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +0 -0
  82. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/us/__init__.py +0 -0
  83. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/us/ths_us_company_info_api.py +0 -0
  84. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/api/xueqiu/__init__.py +0 -0
  85. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/__init__.py +0 -0
  86. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/cache/__init__.py +0 -0
  87. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/cache/cache_service.py +0 -0
  88. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/classify/__init__.py +0 -0
  89. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/classify/symbol_classify_api.py +0 -0
  90. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/classify/symbol_classify_param.py +0 -0
  91. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/common_service_fun_api.py +0 -0
  92. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/company/__init__.py +0 -0
  93. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/company/company_common_service_api.py +0 -0
  94. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/company/company_common_service_new_api.py +0 -0
  95. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/concept/__init__.py +0 -0
  96. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/concept/kpl_concept_common_service_api.py +0 -0
  97. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/concept/ths_concept_common_service_api.py +0 -0
  98. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/cookie/__init__.py +0 -0
  99. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/cookie/cookie_info_service.py +0 -0
  100. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/data/__init__.py +0 -0
  101. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/data/data_init_api.py +0 -0
  102. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/deal/__init__.py +0 -0
  103. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/deal/deal_service_api.py +0 -0
  104. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/deal/terminal_enum.py +0 -0
  105. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/em/__init__.py +0 -0
  106. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/em/em_real_time_quotes_api.py +0 -0
  107. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/em/em_stock_info_api.py +0 -0
  108. {mns_common-1.3.9.2/mns_common/component/hk → mns_common-1.3.9.9/mns_common/component/exception}/__init__.py +0 -0
  109. {mns_common-1.3.9.2/mns_common/component/price → mns_common-1.3.9.9/mns_common/component/hk}/__init__.py +0 -0
  110. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/hk/company_hk_service_api.py +0 -0
  111. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/industry/__init__.py +0 -0
  112. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/industry/ths_industry_index_api.py +0 -0
  113. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/__init__.py +0 -0
  114. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/clean/__init__.py +0 -0
  115. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/clean/k_line_param.py +0 -0
  116. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/clean/sh_small_normal_zt_k_line_check_api.py +0 -0
  117. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/common/__init__.py +0 -0
  118. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/common/k_line_common_service_api.py +0 -0
  119. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/patterns/__init__.py +0 -0
  120. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/patterns/k_line_patterns_service_api.py +0 -0
  121. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/k_line/patterns/pattern_Enum.py +0 -0
  122. {mns_common-1.3.9.2/mns_common/component/proxies → mns_common-1.3.9.9/mns_common/component/price}/__init__.py +0 -0
  123. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/price/trade_price_service_api.py +0 -0
  124. {mns_common-1.3.9.2/mns_common/component/qmt → mns_common-1.3.9.9/mns_common/component/proxies}/__init__.py +0 -0
  125. {mns_common-1.3.9.2/mns_common/component/redis_msg → mns_common-1.3.9.9/mns_common/component/qmt}/__init__.py +0 -0
  126. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/qmt/qmt_buy_service.py +0 -0
  127. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/real_time/__init__.py +0 -0
  128. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/real_time/real_time_common_service_api.py +0 -0
  129. {mns_common-1.3.9.2/mns_common/component/task → mns_common-1.3.9.9/mns_common/component/redis_msg}/__init__.py +0 -0
  130. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/redis_msg/redis_msg_publish_service.py +0 -0
  131. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/self_choose/__init__.py +0 -0
  132. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/self_choose/black_list_service_api.py +0 -0
  133. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/self_choose/self_choose_service_api.py +0 -0
  134. {mns_common-1.3.9.2/mns_common/component/tfp → mns_common-1.3.9.9/mns_common/component/task}/__init__.py +0 -0
  135. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/task/real_time_data_sync_check.py +0 -0
  136. {mns_common-1.3.9.2/mns_common/db/v2 → mns_common-1.3.9.9/mns_common/component/tfp}/__init__.py +0 -0
  137. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/tfp/stock_tfp_api.py +0 -0
  138. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/trade_date/__init__.py +0 -0
  139. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/trade_date/trade_date_common_service_api.py +0 -0
  140. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/zt/__init__.py +0 -0
  141. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/component/zt/zt_common_service_api.py +0 -0
  142. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/__init__.py +0 -0
  143. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/black_list_classify_enum.py +0 -0
  144. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/db_name_constant.py +0 -0
  145. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/east_money_stock_api.py +0 -0
  146. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/price_enum.py +0 -0
  147. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/redis_msg_constant.py +0 -0
  148. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/constant/self_choose_constant.py +0 -0
  149. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/db/MongodbUtil.py +0 -0
  150. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/db/MongodbUtilLocal.py +0 -0
  151. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/db/__init__.py +0 -0
  152. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/db/v2/MongodbUtilV2.py +0 -0
  153. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/__init__.py +0 -0
  154. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/async_fun.py +0 -0
  155. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/cmd_util.py +0 -0
  156. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/data_frame_util.py +0 -0
  157. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/date_handle_util.py +0 -0
  158. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/db_util.py +0 -0
  159. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/file_util.py +0 -0
  160. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common/utils/ip_util.py +0 -0
  161. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common.egg-info/dependency_links.txt +0 -0
  162. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/mns_common.egg-info/top_level.txt +0 -0
  163. {mns_common-1.3.9.2 → mns_common-1.3.9.9}/setup.cfg +0 -0
@@ -1,3 +1,3 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mns_common
3
- Version: 1.3.9.2
3
+ Version: 1.3.9.9
@@ -9,89 +9,11 @@ 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",
@@ -113,7 +35,6 @@ def stock_zh_a_hist(
113
35
  :return: 每日行情
114
36
  :rtype: pandas.DataFrame
115
37
  """
116
- code_id_dict = code_id_map_em()
117
38
  adjust_dict = {"qfq": "1", "hfq": "2", "": "0"}
118
39
  period_dict = {'daily': '101', 'weekly': '102', 'monthly': '103'}
119
40
  url = "http://push2his.eastmoney.com/api/qt/stock/kline/get"
@@ -5,7 +5,6 @@ file_path = os.path.abspath(__file__)
5
5
  end = file_path.index('mns') + 16
6
6
  project_path = file_path[0:end]
7
7
  sys.path.append(project_path)
8
- from loguru import logger
9
8
  import requests
10
9
  import pandas as pd
11
10
 
@@ -42,28 +41,26 @@ def get_xue_qiu_k_line(symbol, period, cookie, end_time, hq):
42
41
  "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
43
42
  "cookie": cookie
44
43
  }
45
- try:
46
- response = requests.get(
47
- url=url,
48
- params=params,
49
- headers=headers
50
- )
51
44
 
52
- if response.status_code == 200:
53
- response_data = response.json()
54
- df = pd.DataFrame(
55
- data=response_data['data']['item'],
56
- columns=response_data['data']['column']
57
- )
58
- # 处理DataFrame列(秒级时间戳)
59
- df['str_day'] = pd.to_datetime(df['timestamp'], unit='ms').dt.normalize()
60
- df["str_day"] = df["str_day"].dt.strftime("%Y-%m-%d")
61
- return df
62
- else:
63
- return pd.DataFrame()
64
- except BaseException as e:
65
- logger.error("同步股票年度数据出现异常:{},{}", symbol, e)
66
- return pd.DataFrame()
45
+ response = requests.get(
46
+ url=url,
47
+ params=params,
48
+ headers=headers
49
+ )
50
+
51
+ if response.status_code == 200:
52
+ response_data = response.json()
53
+ df = pd.DataFrame(
54
+ data=response_data['data']['item'],
55
+ columns=response_data['data']['column']
56
+ )
57
+ # 处理DataFrame列(秒级时间戳)
58
+ df['str_day'] = pd.to_datetime(df['timestamp'], unit='ms').dt.normalize()
59
+ df["str_day"] = df["str_day"].dt.strftime("%Y-%m-%d")
60
+ return df
61
+ else:
62
+ # 直接抛出带有明确信息的异常
63
+ raise ValueError("调用雪球接口失败")
67
64
 
68
65
 
69
66
  if __name__ == '__main__':
@@ -0,0 +1,86 @@
1
+ import threading
2
+ from functools import wraps
3
+ from typing import Optional, Callable
4
+
5
+ class ExceptionMonitor:
6
+ """支持动态配置的异常监控器"""
7
+ def __init__(
8
+ self,
9
+ threshold: int = 1000,
10
+ alert_handler: Optional[Callable[[int, int], None]] = None,
11
+ auto_reset: bool = True
12
+ ):
13
+ """
14
+ :param threshold: 报警阈值,默认1000次
15
+ :param alert_handler: 自定义报警函数,格式 func(current_count, threshold)
16
+ :param auto_reset: 触发报警后是否自动重置计数器
17
+ """
18
+ self.counter = 0
19
+ self._threshold = threshold
20
+ self.alert_handler = alert_handler
21
+ self.auto_reset = auto_reset
22
+ self.lock = threading.Lock()
23
+
24
+ @property
25
+ def threshold(self) -> int:
26
+ """当前报警阈值"""
27
+ return self._threshold
28
+
29
+ @threshold.setter
30
+ def threshold(self, value: int):
31
+ """动态设置报警阈值"""
32
+ with self.lock:
33
+ self._threshold = value
34
+
35
+ def increment(self):
36
+ """线程安全的计数器递增"""
37
+ with self.lock:
38
+ self.counter += 1
39
+ if self.counter >= self.threshold:
40
+ self.trigger_alert()
41
+ if self.auto_reset:
42
+ self.reset_counter()
43
+
44
+ def reset_counter(self):
45
+ """手动重置计数器"""
46
+ with self.lock:
47
+ self.counter = 0
48
+
49
+ def trigger_alert(self):
50
+ """触发报警(支持自定义处理逻辑)"""
51
+ if self.alert_handler:
52
+ self.alert_handler(self.counter, self.threshold)
53
+ else:
54
+ print(f"[ALERT] Exception count {self.counter} exceeded threshold {self.threshold}")
55
+
56
+ def exception_counter(
57
+ threshold: int = 1000,
58
+ alert_handler: Optional[Callable[[int, int], None]] = None,
59
+ auto_reset: bool = True
60
+ ):
61
+ """
62
+ 异常计数装饰器工厂
63
+ :param threshold: 报警阈值
64
+ :param alert_handler: 自定义报警处理函数
65
+ :param auto_reset: 是否自动重置计数器
66
+ """
67
+ def decorator(func):
68
+ # 为每个被装饰函数创建独立监控实例
69
+ monitor = ExceptionMonitor(
70
+ threshold=threshold,
71
+ alert_handler=alert_handler,
72
+ auto_reset=auto_reset
73
+ )
74
+
75
+ @wraps(func)
76
+ def wrapper(*args, **kwargs):
77
+ try:
78
+ return func(*args, **kwargs)
79
+ except Exception as e:
80
+ monitor.increment()
81
+ raise # 保持原始异常栈
82
+
83
+ # 暴露监控器以便外部访问
84
+ wrapper.monitor = monitor
85
+ return wrapper
86
+ return decorator
@@ -0,0 +1,192 @@
1
+ import sys
2
+ import os
3
+
4
+ file_path = os.path.abspath(__file__)
5
+ end = file_path.index('mns') + 16
6
+ project_path = file_path[0:end]
7
+ sys.path.append(project_path)
8
+
9
+ import mns_common.api.proxies.liu_guan_proxy_api as liu_guan_proxy_api
10
+ import pandas as pd
11
+ import mns_common.utils.data_frame_util as data_frame_util
12
+ from mns_common.db.MongodbUtil import MongodbUtil
13
+ import mns_common.constant.db_name_constant as db_name_constant
14
+ import datetime
15
+ import requests
16
+ import time
17
+ from loguru import logger
18
+ from functools import lru_cache
19
+
20
+ mongodb_util = MongodbUtil('27017')
21
+
22
+
23
+ def query_liu_guan_proxy_ip():
24
+ ip_proxy_pool = mongodb_util.find_all_data(db_name_constant.IP_PROXY_POOL)
25
+ return ip_proxy_pool
26
+
27
+
28
+ def remove_proxy_ip():
29
+ mongodb_util.remove_data({}, db_name_constant.IP_PROXY_POOL)
30
+
31
+
32
+ def check_valid(ip_proxy_pool):
33
+ effect_time = list(ip_proxy_pool['effect_time'])[0]
34
+
35
+ now_date = datetime.datetime.now()
36
+
37
+ str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
38
+
39
+ if effect_time > str_now_date:
40
+ return True
41
+ else:
42
+ remove_proxy_ip()
43
+ return False
44
+
45
+
46
+ @lru_cache(maxsize=None)
47
+ def get_account_cache():
48
+ query = {"type": "liu_guan_proxy", }
49
+ return mongodb_util.find_query_data(db_name_constant.STOCK_ACCOUNT_INFO, query)
50
+
51
+
52
+ def generate_proxy_ip_api(minutes):
53
+ stock_account_info = get_account_cache()
54
+ order_id = list(stock_account_info['password'])[0]
55
+ secret = list(stock_account_info['account'])[0]
56
+ # 获取10分钟动态ip
57
+ ip = liu_guan_proxy_api.get_proxy_api(order_id, secret, str(60 * minutes))
58
+ return ip
59
+
60
+
61
+ def generate_proxy_ip(minutes):
62
+ ip_proxy_pool = mongodb_util.find_all_data(db_name_constant.IP_PROXY_POOL)
63
+ if data_frame_util.is_not_empty(ip_proxy_pool):
64
+ return list(ip_proxy_pool['ip'])[0]
65
+ else:
66
+ remove_proxy_ip()
67
+ now_date = datetime.datetime.now()
68
+ # 加上分钟
69
+ time_to_add = datetime.timedelta(minutes=minutes)
70
+ new_date = now_date + time_to_add
71
+ str_now_date = new_date.strftime('%Y-%m-%d %H:%M:%S')
72
+
73
+ # 获取10分钟动态ip
74
+ while True:
75
+ ip = generate_proxy_ip_api(minutes)
76
+ if check_proxy(ip, timeout=2):
77
+ break
78
+ else:
79
+ time.sleep(0.5)
80
+ result_dict = {"_id": ip,
81
+ 'effect_time': str_now_date,
82
+ 'ip': ip}
83
+ result_df = pd.DataFrame(result_dict, index=[1])
84
+
85
+ mongodb_util.insert_mongo(result_df, db_name_constant.IP_PROXY_POOL)
86
+
87
+ return ip
88
+
89
+
90
+ def get_proxy_ip(minutes):
91
+ ip_proxy_pool = query_liu_guan_proxy_ip()
92
+ if data_frame_util.is_empty(ip_proxy_pool):
93
+ return generate_proxy_ip(minutes)
94
+ else:
95
+ if check_valid(ip_proxy_pool):
96
+ return list(ip_proxy_pool['ip'])[0]
97
+ else:
98
+ return generate_proxy_ip(minutes)
99
+
100
+
101
+ def check_baidu_proxy(proxy_ip, timeout=2):
102
+ """
103
+ 检测代理IP是否能访问百度
104
+ :param proxy_ip: 代理IP地址
105
+ :param proxy_port: 代理端口
106
+ :param timeout: 超时时间(秒)
107
+ :return: (是否可用, 响应时间, 检测结果信息)
108
+ """
109
+ # 构造代理地址
110
+
111
+ # 设置代理参数
112
+ proxies = {
113
+ "http": proxy_ip,
114
+ "https": proxy_ip
115
+ }
116
+
117
+ # 模拟浏览器请求头
118
+ headers = {
119
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
120
+ "Accept-Language": "zh-CN,zh;q=0.9",
121
+ "Connection": "keep-alive"
122
+ }
123
+
124
+ try:
125
+ # 记录开始时间
126
+ start_time = time.time()
127
+
128
+ # 发送请求到百度
129
+ response = requests.get(
130
+ url="https://www.baidu.com",
131
+ proxies=proxies,
132
+ headers=headers,
133
+ timeout=timeout,
134
+ allow_redirects=True # 允许重定向
135
+ )
136
+
137
+ # 计算响应时间
138
+ response_time = round((time.time() - start_time) * 1000) # 毫秒
139
+ # 检查响应状态和内容
140
+ if response.status_code == 200:
141
+ # 验证是否返回百度页面
142
+ if "百度一下" in response.text and "baidu.com" in response.text:
143
+ logger.info("代理ip可用:{},响应时间:{}", proxy_ip, response_time)
144
+ return True
145
+ else:
146
+ logger.error("代理ip不可用:{},响应时间:{}", proxy_ip, response_time)
147
+ return False
148
+ else:
149
+ logger.error("代理ip不可用:{},响应时间:{},HTTP状态码异常:{}", proxy_ip, response_time, response.status_code)
150
+ return False
151
+ except requests.exceptions.ConnectTimeout:
152
+ logger.error("代理ip不可用:{},连接超时", proxy_ip, response_time)
153
+ return False
154
+ except requests.exceptions.ProxyError:
155
+ logger.error("代理ip不可用:{},代理拒绝连接", proxy_ip, response_time)
156
+ return False
157
+ except requests.exceptions.SSLError:
158
+ logger.error("代理ip不可用:{},SSL证书错误", proxy_ip, response_time)
159
+ return False
160
+ except requests.exceptions.RequestException as e:
161
+ logger.error("代理ip不可用:{},网络错误:{}", proxy_ip, str(e))
162
+ return False
163
+
164
+
165
+ def check_proxy(proxy_ip, timeout=2):
166
+ proxies = {
167
+ "http": proxy_ip,
168
+ "https": proxy_ip
169
+ }
170
+ try:
171
+ # 测试请求(httpbin.org 返回请求的IP)
172
+ response = requests.get(
173
+ "http://httpbin.org/ip",
174
+ proxies=proxies,
175
+ timeout=timeout # 超时时间
176
+ )
177
+ if response.status_code == 200:
178
+ return True
179
+ else:
180
+ logger.error("代理ip不可用:{}", proxy_ip)
181
+ return False
182
+ except Exception as e:
183
+ logger.error("代理ip不可用:{},{}", proxy_ip, e)
184
+ return False
185
+
186
+
187
+ if __name__ == "__main__":
188
+ target_ip = "112.28.228.67:35528" # Google DNS
189
+ if check_proxy(target_ip, 2):
190
+ print(f"{target_ip} 可以访问")
191
+ else:
192
+ print(f"{target_ip} 无法访问")
@@ -80,3 +80,12 @@ HK_STOCK_MINUTE_K_LINE_BFQ = 'hk_stock_one_minute_k_line_bfq'
80
80
 
81
81
  # hk etf 1分钟集合数据
82
82
  HK_ETF_MINUTE_K_LINE_BFQ = 'hk_etf_one_minute_k_line_bfq'
83
+
84
+ # 雪球利润表
85
+ XUE_QIU_LRB_INCOME = 'xue_qiu_lrb_income'
86
+
87
+ # 雪球资产负债表
88
+ XUE_QIU_ASSET_DEBT = 'xue_qiu_asset_debt'
89
+
90
+ # 雪球资产现金流量表
91
+ XUE_QIU_CASH_FLOW = 'xue_qiu_cash_flow'
@@ -0,0 +1,7 @@
1
+ import sys
2
+ import os
3
+
4
+ file_path = os.path.abspath(__file__)
5
+ end = file_path.index('mns') + 16
6
+ project_path = file_path[0:end]
7
+ sys.path.append(project_path)
@@ -1,3 +1,3 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mns-common
3
- Version: 1.3.9.2
3
+ Version: 1.3.9.9
@@ -101,6 +101,8 @@ mns_common/component/deal/terminal_enum.py
101
101
  mns_common/component/em/__init__.py
102
102
  mns_common/component/em/em_real_time_quotes_api.py
103
103
  mns_common/component/em/em_stock_info_api.py
104
+ mns_common/component/exception/ExceptionMonitor.py
105
+ mns_common/component/exception/__init__.py
104
106
  mns_common/component/hk/__init__.py
105
107
  mns_common/component/hk/company_hk_service_api.py
106
108
  mns_common/component/industry/__init__.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='mns_common',
5
- version='1.3.9.2',
5
+ version='1.3.9.9',
6
6
  # packages=["mns_common", "mns_common.api",
7
7
  # "mns_common.api.akshare",
8
8
  # "mns_common.api.em",
@@ -1,84 +0,0 @@
1
- import sys
2
- import os
3
-
4
- file_path = os.path.abspath(__file__)
5
- end = file_path.index('mns') + 16
6
- project_path = file_path[0:end]
7
- sys.path.append(project_path)
8
-
9
- import mns_common.api.proxies.liu_guan_proxy_api as liu_guan_proxy_api
10
- from functools import lru_cache
11
- import pandas as pd
12
- import mns_common.utils.data_frame_util as data_frame_util
13
- from mns_common.db.MongodbUtil import MongodbUtil
14
- import mns_common.constant.db_name_constant as db_name_constant
15
- import datetime
16
-
17
- mongodb_util = MongodbUtil('27017')
18
-
19
-
20
- @lru_cache(maxsize=None)
21
- def query_liu_guan_proxy_ip():
22
- ip_proxy_pool = mongodb_util.find_all_data(db_name_constant.IP_PROXY_POOL)
23
- return ip_proxy_pool
24
-
25
-
26
- def clear_proxy_ip_cache():
27
- query_liu_guan_proxy_ip.cache_clear()
28
- mongodb_util.remove_data({}, db_name_constant.IP_PROXY_POOL)
29
-
30
-
31
- def check_valid(str_now_date, ip_proxy_pool):
32
- effect_time = list(ip_proxy_pool['effect_time'])[0]
33
- if effect_time > str_now_date:
34
- return True
35
- else:
36
- clear_proxy_ip_cache()
37
- return False
38
-
39
-
40
- def generate_proxy_ip(minutes):
41
- ip_proxy_pool = mongodb_util.find_all_data(db_name_constant.IP_PROXY_POOL)
42
- if data_frame_util.is_not_empty(ip_proxy_pool):
43
- return list(ip_proxy_pool['ip'])[0]
44
- else:
45
- query = {"type": "liu_guan_proxy", }
46
- stock_account_info = mongodb_util.find_query_data(db_name_constant.STOCK_ACCOUNT_INFO, query)
47
- order_id = list(stock_account_info['password'])[0]
48
- secret = list(stock_account_info['account'])[0]
49
-
50
- now_date = datetime.datetime.now()
51
- time_to_add = datetime.timedelta(minutes=minutes - 1, seconds=50)
52
- new_date = now_date + time_to_add
53
- str_now_date = new_date.strftime('%Y-%m-%d %H:%M:%S')
54
-
55
- # 获取10分钟动态ip
56
- ip = liu_guan_proxy_api.get_proxy_api(order_id, secret, str(60 * minutes))
57
-
58
- result_dict = {"_id": ip,
59
- 'effect_time': str_now_date,
60
- 'ip': ip}
61
- result_df = pd.DataFrame(result_dict, index=[1])
62
-
63
- mongodb_util.insert_mongo(result_df, db_name_constant.IP_PROXY_POOL)
64
-
65
- return ip
66
-
67
-
68
- def get_proxy_ip(str_now_date, minutes):
69
- ip_proxy_pool = query_liu_guan_proxy_ip()
70
- if data_frame_util.is_empty(ip_proxy_pool):
71
- return generate_proxy_ip(minutes)
72
- else:
73
- if check_valid(str_now_date, ip_proxy_pool):
74
- return list(ip_proxy_pool['ip'])[0]
75
- else:
76
- return generate_proxy_ip(minutes)
77
-
78
-
79
- if __name__ == '__main__':
80
- while True:
81
- now_date = datetime.datetime.now()
82
- str_now_date_test = now_date.strftime('%Y-%m-%d %H:%M:%S')
83
- ip_test = get_proxy_ip(str_now_date_test)
84
- print(ip_test)
File without changes
File without changes