Administrator
2023-10-30 fb47d36048e94b9a506d5c153e3dd19a01e37df1
code_attribute/code_nature_analyse.py
@@ -5,6 +5,8 @@
# 是否有涨停
import copy
import json
import random
import time
from code_attribute import gpcode_manager
@@ -188,14 +190,19 @@
    datas = datas[-10:]
    limit_ups = []
    limit_up_count = 0
    max_price = datas[0]["high"]
    for data in datas:
        limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(data["pre_close"]))
        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:
            limit_ups.append((date, True))
            limit_up_count += 1
        else:
            limit_ups.append((date, False))
    # 下降幅度
    limit_down_rate = round((max_price - datas[-1]["close"]) / max_price, 3)
    if limit_up_count < 3:
        return False
@@ -208,8 +215,10 @@
        for t in temp_datas:
            if t[1]:
                t_count += 1
        if t_count >= 3:
        if t_count >= 3 and limit_down_rate < 0.2:
            # 降幅小于20%
            return True
    return False