From a1ecd205cc8ba08985a1ba88f9dbde3b124e5e0b Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 29 八月 2025 11:29:16 +0800
Subject: [PATCH] 丢撤单bug修复/想买单接口修改

---
 code_attribute/code_volumn_manager.py |   48 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/code_attribute/code_volumn_manager.py b/code_attribute/code_volumn_manager.py
index afeec39..5f624de 100644
--- a/code_attribute/code_volumn_manager.py
+++ b/code_attribute/code_volumn_manager.py
@@ -53,6 +53,16 @@
                     code = k.split("-")[1]
                     val = RedisUtils.get(redis, k, auto_free=False)
                     cls.__max_volume_info_in_5days[code] = json.loads(val)
+
+            keys = RedisUtils.keys(redis, "volumn_today-*", auto_free=False)
+            if keys is not None:
+                for k in keys:
+                    code = k.split("-")[-1]
+                    val = RedisUtils.get(redis, k, auto_free=False)
+                    if val:
+                        cls.__today_volumn_cache[code] = int(val)
+                        global_util.today_volumn[code] = int(val)
+
         finally:
             RedisUtils.realse(redis)
 
@@ -96,13 +106,13 @@
         @return:
         """
         # 60涓氦鏄撴棩鏈定鍋滃彇
-        k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code)
-        has_limit_up_in_60 = True
-        if k_format and not k_format[13]:
-            has_limit_up_in_60 = False
-        volume = self.get_max_volume_in_5days(code)
-        if volume and volume * limit_up_price >= 9e8 and has_limit_up_in_60:
-            return volume
+        # k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code)
+        # has_limit_up_in_60 = True
+        # if k_format and not k_format[13]:
+        #     has_limit_up_in_60 = False
+        # volume = self.get_max_volume_in_5days(code)
+        # if volume and volume * limit_up_price >= 9e8 and has_limit_up_in_60:
+        #     return volume
         return int(self.get_reference_volume_as_money_y(code) * 1e8 / limit_up_price)
 
     def get_radical_buy_refer_volume_info(self, code, limit_up_price):
@@ -116,14 +126,14 @@
         @return:
         """
         # 60涓氦鏄撴棩鏈定鍋滃彇
-        k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code)
-        has_limit_up_in_60 = True
-        if k_format and not k_format[13]:
-            has_limit_up_in_60 = False
+        # k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code)
+        # has_limit_up_in_60 = True
+        # if k_format and not k_format[13]:
+        #     has_limit_up_in_60 = False
         # (閲�, 鏃ユ湡)
-        volume_info = self.__max_volume_info_in_5days.get(code, None)
-        if volume_info and volume_info[0] * limit_up_price >= 9e8 and has_limit_up_in_60:
-            return volume_info
+        # volume_info = self.__max_volume_info_in_5days.get(code, None)
+        # if volume_info and volume_info[0] * limit_up_price >= 9e8 and has_limit_up_in_60:
+        #     return volume_info
         return self.get_reference_volume_info(code)
 
     def get_volume_rate_refer_in_5days(self, code, total_sell_volume=0):
@@ -136,7 +146,7 @@
         max_volume = self.get_max_volume_in_5days(code)
         if not max_volume:
             return 0
-        today_volume = self.get_today_volumn(code)
+        today_volume = self.get_today_volumn_cache(code)
         return round((today_volume + total_sell_volume) / max_volume, 2)
 
     # 鑾峰彇鍘嗗彶閲�
@@ -184,16 +194,20 @@
         _volumn = global_util.today_volumn.get(code)
         if _volumn is None:
             _volumn = RedisUtils.get(self.__redis_manager.getRedis(), "volumn_today-{}".format(code))
+        if not _volumn:
+            _volumn = 0
         return int(_volumn)
 
     # 鑾峰彇浠婃棩閲�
     def get_today_volumn_cache(self, code):
-        return global_util.today_volumn.get(code)
+        if code in global_util.today_volumn:
+            return global_util.today_volumn.get(code)
+        return 0
 
     # 鑾峰彇閲忔瘮锛堜粖鏃ラ噺/max(60澶╂渶澶ч噺,鏄ㄦ棩閲�)锛�
     # 灏嗘�诲崠閲忚绠楀湪鍐�
     def get_volume_rate(self, code, total_sell_volume=0, with_info=False):
-        today = self.get_today_volumn(code)
+        today = self.get_today_volumn_cache(code)
         max60, yesterday = self.get_histry_volumn(code)
         if today is None:
             today = 0

--
Gitblit v1.8.0