From d3e52f9f71af4775f5e77988be4e63d3fec3b76f Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 26 九月 2024 09:40:58 +0800
Subject: [PATCH] bug修复

---
 utils/init_data_util.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/utils/init_data_util.py b/utils/init_data_util.py
index d1d61c6..3d6b0fe 100644
--- a/utils/init_data_util.py
+++ b/utils/init_data_util.py
@@ -12,6 +12,7 @@
 
 
 def re_set_price_pres(codes, force=False):
+    # 閫氳繃鍘嗗彶鏁版嵁缂撳瓨鑾峰彇
     result = HistoryKDatasUtils.get_gp_latest_info(codes)
     for item in result:
         symbol = item['symbol']
@@ -22,14 +23,16 @@
 
 # 鑾峰彇杩�90澶╃殑鏈�澶ч噺涓庢渶杩戠殑閲�
 # 鑾峰彇鏈�杩戜竴娆℃定鍋�/娑ㄥ仠涓嬩竴涓氦鏄撴棩鐨勬渶澶у��
-def get_volumns_by_code(code, count=60) -> object:
+def get_volumns_by_code(code, count=60):
     datas = HistoryKDatasUtils.get_history_tick_n(code, count, "open,high,low,close,volume,pre_close,bob,amount")
+    if not datas:
+        return None
     # 璁$畻
     datas.sort(key=lambda x: x["bob"], reverse=True)
     return datas
 
 
-def parse_max_volume(code,  datas, is_new_or_near_top=False):
+def parse_max_volume(code, datas, is_new_or_near_top=False):
     result = __parse_max_volume(code, datas, is_new_or_near_top)
     refer_index = result[3]
     # 璁$畻鏈�浣庝环
@@ -107,7 +110,7 @@
             # 鏄惁鏈夋定鍋�
             limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(code, item["pre_close"]))
             # 涓嶇湅瓒呰繃60澶╃殑娑ㄥ仠
-            if abs(limit_up_price - item["high"]) < 0.01 and i <= 59:
+            if abs(limit_up_price - item["high"]) < 0.001 and i <= 59:
                 # 娑ㄥ仠
                 next_volume = 0
                 if i > 0:

--
Gitblit v1.8.0