Administrator
2023-08-02 caee9ee5f819c9b86fa8e2e0fd9d77a2ba79dc7f
code_attribute/code_nature_analyse.py
@@ -15,6 +15,8 @@
class CodeNatureRecordManager:
    __redisManager = RedisManager(0)
    __k_format_cache = {}
    __nature_cache = {}
    @classmethod
    def __get_redis(cls):
@@ -32,6 +34,18 @@
            return json.loads(val)
        return None
    @classmethod
    def get_k_format_cache(cls, code):
        val = None
        if code in cls.__k_format_cache:
            val = cls.__k_format_cache[code]
        if not val:
            val = cls.get_k_format(code)
            if val:
                cls.__k_format_cache[code] = val
        # 复制
        return copy.deepcopy(val) if val else None
    # 保存股性
    @classmethod
    def save_nature(cls, code, natures):
@@ -43,6 +57,15 @@
        if val:
            return json.loads(val)
        return None
    @classmethod
    def get_nature_cache(cls, code):
        if code in cls.__nature_cache:
            return cls.__nature_cache[code]
        val = cls.get_nature(code)
        if val:
            cls.__nature_cache[code] = val
        return val
# 设置历史K线
@@ -79,7 +102,8 @@
# 是否具有K线形态
def is_has_k_format(limit_up_price, record_datas):
    is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v, has_format, volume_info,is_special = get_k_format(float(limit_up_price),record_datas)
    is_too_high, is_new_top, is_lowest, is_near_new_top, is_n, is_v, has_format, volume_info, is_special = get_k_format(
        float(limit_up_price), record_datas)
    if not has_format:
        return False, "不满足K线形态"
    return True, "有形态"