From 9039563a3c2e1349b0f71003f8a3f0b793924e82 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 22 十二月 2023 16:54:27 +0800
Subject: [PATCH] bug修复

---
 code_attribute/code_nature_analyse.py |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/code_attribute/code_nature_analyse.py b/code_attribute/code_nature_analyse.py
index 5845e72..90d5ff4 100644
--- a/code_attribute/code_nature_analyse.py
+++ b/code_attribute/code_nature_analyse.py
@@ -338,6 +338,32 @@
         return False
 
 
+# 鏆傛椂涓嶄娇鐢�
+# 浠庢渶杩戜竴娆℃定鍋滃紑濮嬶紝鏄惁娑ㄥ箙杩囬珮
+def is_up_too_high_from_latest_limit_up(record_datas):
+    datas = copy.deepcopy(record_datas)
+    datas.sort(key=lambda x: x["bob"])
+    datas = datas[-20:]
+    datas.reverse()
+    today_limit_up_price = round(float(gpcode_manager.get_limit_up_price_by_preprice(datas[0]["close"])), 2)
+    max_price = 0
+    limit_up_price = None
+    for i in range(0, len(datas)):
+        item = datas[i]
+        if item['high'] > max_price:
+            max_price = item['high']
+        if __is_limited_up(item):
+            limit_up_price = item['high']
+            break
+    if not limit_up_price:
+        return False
+    if today_limit_up_price < max_price:
+        return False
+    if (today_limit_up_price - limit_up_price) / limit_up_price > 0.25:
+        return True
+    return False
+
+
 # 鏈�杩戝嚑澶╂槸鍚︽湁鏈�澶ч噺
 def is_have_latest_max_volume(record_datas, day_count):
     datas = copy.deepcopy(record_datas)
@@ -481,7 +507,7 @@
 def __is_latest_open_limit_up_or_limit_down(datas, day_count):
     datas = copy.deepcopy(datas)
     datas.sort(key=lambda x: x["bob"])
-    items = datas[0-day_count:]
+    items = datas[0 - day_count:]
     for item in items:
         limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"]))
         if abs(limit_up_price - item["high"]) < 0.001 and abs(limit_up_price - item["close"]) > 0.001:

--
Gitblit v1.8.0