From dad46b192e8fc3dcc657877b7189a8d0fe5f4aa7 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期一, 30 十二月 2024 12:36:05 +0800
Subject: [PATCH] 大于200亿的流出不算作净流出

---
 third_data/code_plate_key_manager.py |   67 +++++++++++++++++++++++++++++----
 1 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/third_data/code_plate_key_manager.py b/third_data/code_plate_key_manager.py
index 688648e..6d41e73 100644
--- a/third_data/code_plate_key_manager.py
+++ b/third_data/code_plate_key_manager.py
@@ -352,6 +352,22 @@
     __top_jx_out_blocks = []
     # 绮鹃�夋澘鍧楁祦鍏ラ噾棰�
     __jx_blocks_in_money_dict = {}
+    # 甯傚満琛屾儏鐑害锛岄粯璁や负60
+    __market_strong = 60
+
+    @classmethod
+    def get_jingxuan_in_block_threshold_count(cls):
+        """
+        鑾峰彇涔扮簿閫夋祦鍏ュ墠鍑�
+        @return:
+        """
+        score = 60
+        if cls.__market_strong is not None:
+            score = int(cls.__market_strong)
+        for info in constant.RADICAL_BUY_TOP_IN_COUNT_BY_MARKET_STRONG:
+            if info[0] <= score < info[1]:
+                return info[2]
+        return 10
 
     @classmethod
     def set_market_jingxuan_blocks(cls, datas):
@@ -361,10 +377,13 @@
         @return:
         """
         # 娴佸叆闃堝��
-        THRESHOLD_MONEY = 100 * (tool.trade_time_sub(tool.get_now_time_str(), "09:30:00") // 60) + 1000
-        THRESHOLD_MONEY = min(THRESHOLD_MONEY, 10000)
-        THRESHOLD_MONEY = max(THRESHOLD_MONEY, 1000)
-        THRESHOLD_MONEY = THRESHOLD_MONEY * 10000
+        # THRESHOLD_MONEY = 50 * (tool.trade_time_sub(tool.get_now_time_str(), "09:30:00") // 60) + 1000
+        # THRESHOLD_MONEY = min(THRESHOLD_MONEY, 10000)
+        # THRESHOLD_MONEY = max(THRESHOLD_MONEY, 1000)
+        # THRESHOLD_MONEY = THRESHOLD_MONEY * 10000
+        THRESHOLD_MONEY = 0
+        # 鏈�澶ф暟閲�
+        # MAX_COUNT = cls.get_jingxuan_in_block_threshold_count()
 
         cls.top_in_list_cache = datas
         blocks = set()
@@ -393,11 +412,15 @@
                     break
             if has_code:
                 count += 1
-
-            if count >= 10:
-                break
+                if count == 10:
+                    strong = cls.get_market_strong()
+                    if strong is None:
+                        strong = 60
+                    THRESHOLD_MONEY = int((1 - strong/200) * data[3])
+            # if count >= MAX_COUNT:
+            #     break
         # 璁板綍绮鹃�夋祦鍑烘棩蹇�
-        async_log_util.info(logger_kpl_jx_in, f"鍘熸暟鎹細{datas[:20]} 鏉垮潡锛歿blocks}")
+        async_log_util.info(logger_kpl_jx_in, f"鍘熸暟鎹細{datas[:50]} 鏉垮潡锛歿blocks}")
         blocks = list(blocks)
         blocks.sort(key=lambda x: fblock_money.get(x), reverse=True)
         cls.__top_jx_blocks = blocks
@@ -432,12 +455,37 @@
         cls.__top_jx_out_blocks = list(blocks)
 
     @classmethod
+    def set_market_strong(cls, strong):
+        """
+        璁剧疆甯傚満琛屾儏寮哄害
+        @param strong:
+        @return:
+        """
+        cls.__market_strong = strong
+
+    @classmethod
+    def get_market_strong(cls):
+        return cls.__market_strong
+
+    @classmethod
     def get_top_market_jingxuan_blocks(cls):
         return cls.__top_jx_blocks
 
     @classmethod
     def get_top_market_jingxuan_out_blocks(cls):
         return cls.__top_jx_out_blocks
+
+    @classmethod
+    def get_block_info_at_block_in(cls, b):
+        """
+        鑾峰彇鏉垮潡鐨勫噣娴佸叆鎯呭喌
+        @param b:
+        @return: (鏉垮潡鍚嶇О,韬綅,娴佸叆閲戦)
+        """
+        for i in range(0, len(cls.top_in_list_cache)):
+            if cls.top_in_list_cache[i][1] == b:
+                return b, i, cls.top_in_list_cache[i][3]
+        return b, -1, 0
 
     @classmethod
     def set_top_5_industry(cls, datas):
@@ -1146,4 +1194,5 @@
 
 
 if __name__ == "__main__":
-    pass
+    RealTimeKplMarketData.set_market_strong(120)
+    print(RealTimeKplMarketData.get_jingxuan_in_block_threshold_count())

--
Gitblit v1.8.0