| | |
| | | |
| | | class CodeNatureRecordManager: |
| | | __redisManager = RedisManager(0) |
| | | __k_format_cache={} |
| | | __nature_cache={} |
| | | __k_format_cache = {} |
| | | __nature_cache = {} |
| | | |
| | | @classmethod |
| | | def __get_redis(cls): |
| | |
| | | |
| | | @classmethod |
| | | def get_k_format_cache(cls, code): |
| | | val = None |
| | | if code in cls.__k_format_cache: |
| | | return cls.__k_format_cache[code] |
| | | val = cls.get_k_format(code) |
| | | if val: |
| | | cls.__k_format_cache[code] = val |
| | | return val |
| | | 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 |
| | |
| | | if val: |
| | | cls.__nature_cache[code] = val |
| | | return val |
| | | |
| | | |
| | | |
| | | # 设置历史K线 |
| | |
| | | |
| | | # 是否具有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, "有形态" |