From a66b4a987444c655b5ab5f678dbfefc82b7785b2 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 27 八月 2024 15:12:06 +0800
Subject: [PATCH] 开盘啦精选板块调整

---
 code_attribute/code_nature_analyse.py |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/code_attribute/code_nature_analyse.py b/code_attribute/code_nature_analyse.py
index d85b42b..2cdbba8 100644
--- a/code_attribute/code_nature_analyse.py
+++ b/code_attribute/code_nature_analyse.py
@@ -218,8 +218,8 @@
     p10 = is_latest_10d_max_volume_at_latest_2d(code, record_datas)
     # 鏈�杩�5澶╂槸鍚︾偢鏉�
     p11 = __is_latest_open_limit_up(code, record_datas, 5)
-    # 30澶╁唴鏄惁鏈夋定鍋�
-    p12 = __has_limit_up(code, record_datas, 30)
+    # 90澶╁唴鏄惁鏈夋定鍋�
+    p12 = __has_limit_up(code, record_datas, 90)
     # 鏈�杩�5澶╂槸鍚﹁穼鍋�
     p13 = __is_latest_limit_down(code, record_datas, 5)
 
@@ -253,7 +253,7 @@
     datas = datas[-10:]
     for data in datas:
         limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(code, data["pre_close"]))
-        if abs(limit_up_price - data["high"]) < 0.01:
+        if abs(limit_up_price - data["high"]) < 0.001:
             date = data['bob'].strftime("%Y-%m-%d")
             return round((datas[-1]["close"] - data["close"]) / data["close"], 4), date
     return 0, ''
@@ -272,7 +272,7 @@
         date = data['bob'].strftime("%Y-%m-%d")
         if data["high"] > max_price:
             max_price = data["high"]
-        if abs(limit_up_price - data["high"]) < 0.01:
+        if abs(limit_up_price - data["high"]) < 0.001:
             limit_ups.append((date, True))
             limit_up_count += 1
         else:
@@ -400,7 +400,6 @@
     # if max_price > float(limit_up_price):
     #     return False
     rate = (float(limit_up_price) - min_price_info[1]["close"]) / min_price_info[1]["close"]
-    print(rate)
     if rate >= 0.319:
         return True, rate
     return False, rate
@@ -434,7 +433,6 @@
             max_limit_up_info = x
 
     if not max_limit_up_info or max_limit_up_info[0] < 3:
-        print("鏃�3杩炴澘")
         return False
     start_index = max_limit_up_info[1]
     max_price_info = [0, None]
@@ -447,7 +445,6 @@
     for i in range(max_price_info[1] + 1, len(datas)):
         item = datas[i]
         if item["low"] < lowest_price_threhhold:
-            print("鍥炶俯瓒冲")
             return False
     return True
 
@@ -538,7 +535,6 @@
         min_price = 1000000
         for i in range(len(datas) - 5, len(datas)):
             item = datas[i]
-            print(item)
             limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(code, item["pre_close"]))
             if abs(limit_up_price - item["high"]) < 0.001 and abs(
                     limit_up_price - datas[i - 1]["high"]) >= 0.001:
@@ -618,20 +614,21 @@
 # 鏄惁娑ㄥ仠
 def __is_limit_up(code, data):
     limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(code, data["pre_close"]))
-    return abs(limit_up_price - data["close"]) < 0.001
+    return abs(limit_up_price - data["close"]) < 0.009
 
 
 # 鏄惁娑ㄥ仠杩�
 def __is_limited_up(code, data):
     limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(code, data["pre_close"]))
-    return abs(limit_up_price - data["high"]) < 0.001
+    return abs(limit_up_price - data["high"]) < 0.009
 
 
 # 澶氬皯澶╁唴鏄惁鏈夋定鍋�/鏇炬定鍋�
 def __has_limit_up(code, datas, day_count):
     datas = copy.deepcopy(datas)
     datas.sort(key=lambda x: x["bob"])
-    datas = datas[0 - day_count:]
+    if len(datas) > day_count:
+        datas = datas[0 - day_count:]
     if len(datas) >= 1:
         for i in range(0, len(datas)):
             item = datas[i]

--
Gitblit v1.8.0