From d2247ed8af382dd202f23a03a572db2cb65c444f Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 04 七月 2025 15:29:15 +0800
Subject: [PATCH] bug修复

---
 code_attribute/code_volumn_manager.py |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/code_attribute/code_volumn_manager.py b/code_attribute/code_volumn_manager.py
index 613d97f..11764d2 100644
--- a/code_attribute/code_volumn_manager.py
+++ b/code_attribute/code_volumn_manager.py
@@ -7,7 +7,7 @@
 # yesterday 鏄ㄥぉ鐨勯噺
 import json
 
-from code_attribute import gpcode_manager
+from code_attribute import gpcode_manager, code_nature_analyse
 from db.redis_manager_delegate import RedisUtils
 from log_module import async_log_util
 from utils import global_util, tool
@@ -77,7 +77,44 @@
                                auto_free=False)
 
     def get_max_volume_in_5days(self, code):
+        """
+        5鏃ユ渶澶ч噺
+        @param code:
+        @return:
+        """
         return self.__max_volume_in_5days.get(code)
+
+    def get_radical_buy_refer_volume(self, code, limit_up_price):
+        """
+        鑾峰彇鎵叆鐨勫弬鑰冮噺:
+        鍙傝�冮灏忎簬3.14浜垮氨鍙�90澶╁弬鑰冮噺
+        鍚﹀垯灏卞彇鏈�杩�5澶╃殑鍙傝�冮噺
+        @param code:
+        @param limit_up_price:
+        @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 * 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_volume_rate_refer_in_5days(self, code, total_sell_volume=0):
+        """
+        鑾峰彇浠婃棩閲忎笌5鏃ユ渶澶ч噺鐨勫弬鑰冨��
+        @param total_sell_volume: 褰撳墠鎬诲崠閲�
+        @param code:
+        @return: 5鏃ラ噺姣�
+        """
+        max_volume = self.get_max_volume_in_5days(code)
+        if not max_volume:
+            return 0
+        today_volume = self.get_today_volumn(code)
+        return round((today_volume + total_sell_volume) / max_volume, 2)
 
     # 鑾峰彇鍘嗗彶閲�
     def get_histry_volumn(self, code):
@@ -124,7 +161,7 @@
         _volumn = global_util.today_volumn.get(code)
         if _volumn is None:
             _volumn = RedisUtils.get(self.__redis_manager.getRedis(), "volumn_today-{}".format(code))
-        return _volumn
+        return int(_volumn)
 
     # 鑾峰彇浠婃棩閲�
     def get_today_volumn_cache(self, code):

--
Gitblit v1.8.0