| | |
| | | import constant |
| | | from db import redis_manager_delegate as redis_manager |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from log_module import log_export |
| | | from log_module.log import logger_pre_close_price |
| | | from utils import tool |
| | | import decimal |
| | | |
| | |
| | | # 获取收盘价 |
| | | @classmethod |
| | | def get_price_pre(cls, code): |
| | | result = RedisUtils.get(cls.__redisManager.getRedis(), "price-pre-{}".format(code)) |
| | | if result is not None: |
| | | return float(result) |
| | | fdatas = log_export.load_pre_close_price() |
| | | if code in fdatas: |
| | | return round(float(fdatas.get(code)), 2) |
| | | return None |
| | | |
| | | # 获取缓存 |
| | |
| | | codes = get_gp_list() |
| | | if code not in codes and not FirstCodeManager().is_in_first_record_cache(code) and not force: |
| | | return |
| | | RedisUtils.setex(cls.__redisManager.getRedis(), "price-pre-{}".format(code), tool.get_expire(), str(price)) |
| | | cls.__price_pre_cache[code] = float(price) |
| | | price = round(float(price), 2) |
| | | logger_pre_close_price.info(f"{code}-{price}") |
| | | cls.__price_pre_cache[code] = price |
| | | |
| | | |
| | | __limit_up_price_dict = {} |