Administrator
7 天以前 fbac2e1e6ae16a4fff90a1ec8e7ac680c8bd459b
昨日收盘价修改
12个文件已修改
71 ■■■■ 已修改文件
api/outside_api_command_callback.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/code_data_util.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/first_target_code_data_processor.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/gpcode_manager.py 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/code_price_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
log_module/log_export.py 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/data_server.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/history_k_data_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_strategy.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/current_price_process_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/init_data_util.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/outside_api_command_callback.py
@@ -806,7 +806,7 @@
            current_price = L1DataManager.get_l1_current_price(code)
            if current_price:
                fdata["cost_price"] = current_price
                pre_close_price = CodePrePriceManager.get_price_pre_cache(code)
                pre_close_price = CodePrePriceManager().get_price_pre_cache(code)
                if current_price and pre_close_price:
                    rate = round((float(current_price) - float(pre_close_price)) / float(pre_close_price), 4)
                    fdata["cost_price_rate"] = rate
@@ -1615,7 +1615,7 @@
                    result = {"code": 1, "msg": "拉取K线失败"}
                else:
                    # 更新昨日收盘价数据
                    CodePrePriceManager.set_price_pre(code, volumes_data[0]['close'], force=True)
                    CodePrePriceManager().set_price_pre(code, volumes_data[0]['close'], force=True)
                    gpcode_manager.clear_limit_up_price_cache(code)
                    limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
                    # 更新K线特征数据
code_attribute/code_data_util.py
@@ -18,7 +18,7 @@
# 代码对应的价格是否正确
def is_same_code_with_price(code, price):
    # 昨日收盘价
    price_close = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code)
    price_close = gpcode_manager.CodePrePriceManager().get_price_pre_cache(code)
    max_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal(tool.get_limit_up_rate(code)))
    min_price = tool.to_price(decimal.Decimal(str(price_close)) * decimal.Decimal(tool.get_limit_down_rate(code)))
    if min_price <= decimal.Decimal(str(price)) <= max_price:
code_attribute/first_target_code_data_processor.py
@@ -257,7 +257,7 @@
        # 纠正数据
        if is_limit_up and limit_up_time is None:
            limit_up_time = tool.get_now_time_str()
        pricePre = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code)
        pricePre = gpcode_manager.CodePrePriceManager().get_price_pre_cache(code)
        if pricePre is None:
            history_k_data_manager.re_set_price_pres([code])
code_attribute/gpcode_manager.py
@@ -285,7 +285,6 @@
        return code in self.__codes_cache
# 暂停下单代码管理
# 与黑名单的区别是暂停交易代码只是不交易,不能移除L2监控位
class PauseBuyCodesManager:
@@ -470,7 +469,6 @@
        """
        if code in self.__human_remove_codes:
            self.__human_remove_codes.discard(code)
class BlackListCodeManager:
@@ -769,39 +767,42 @@
    return list
@tool.singleton
class CodePrePriceManager:
    __price_pre_cache = {}
    __redisManager = redis_manager.RedisManager(0)
    def __init__(self):
        fdatas = log_export.load_pre_close_price()
        for code, v in fdatas.items():
            self.__price_pre_cache[code] = round(float(v), 2)
    # 获取收盘价
    @classmethod
    def get_price_pre(cls, code):
    def get_price_pre(self, code):
        fdatas = log_export.load_pre_close_price()
        if code in fdatas:
            return round(float(fdatas.get(code)), 2)
        return None
    # 获取缓存
    @classmethod
    def get_price_pre_cache(cls, code):
        if code in cls.__price_pre_cache:
            return float(cls.__price_pre_cache[code])
        val = cls.get_price_pre(code)
    def get_price_pre_cache(self, code):
        if code in self.__price_pre_cache:
            return float(self.__price_pre_cache[code])
        val = self.get_price_pre(code)
        if val:
            cls.__price_pre_cache[code] = val
            self.__price_pre_cache[code] = val
        return val
    # 设置收盘价
    @classmethod
    def set_price_pre(cls, code, price, force=False):
    def set_price_pre(self, code, price, force=False):
        if float(price) > 1000:
            async_log_util.info(logger_debug, f"获取昨日收盘价异常:{code}-{price}")
            return
        if code in cls.__price_pre_cache and not force:
        if code in self.__price_pre_cache and not force:
            return
        price = round(float(price), 2)
        logger_pre_close_price.info(f"{code}-{price}")
        cls.__price_pre_cache[code] = price
        self.__price_pre_cache[code] = price
__limit_up_price_dict = {}
@@ -812,12 +813,13 @@
    # 读取内存中的值
    if code in __limit_up_price_dict:
        return __limit_up_price_dict[code]
    price = CodePrePriceManager.get_price_pre_cache(code)
    price = CodePrePriceManager().get_price_pre_cache(code)
    if price is None:
        return None
    limit_up_price = tool.to_price(decimal.Decimal(str(price)) * decimal.Decimal(tool.get_limit_up_rate(code)))
    __limit_up_price_dict[code] = limit_up_price
    return limit_up_price
def clear_limit_up_price_cache(code):
    if code in __limit_up_price_dict:
@@ -851,7 +853,7 @@
# 获取跌停价
def get_limit_down_price(code):
    price = CodePrePriceManager.get_price_pre_cache(code)
    price = CodePrePriceManager().get_price_pre_cache(code)
    if price is None:
        return None
    return tool.to_price(decimal.Decimal(str(price)) * decimal.Decimal(f"{tool.get_limit_down_rate(code)}"))
@@ -978,4 +980,4 @@
        RedisUtils.delete(redis_instance, "first_code_record", auto_free=False)
        RedisUtils.delete(redis_instance, "first_code_limited_up_record", auto_free=False)
    finally:
        RedisUtils.realse(redis_instance)
        RedisUtils.realse(redis_instance)
l2/code_price_manager.py
@@ -222,7 +222,7 @@
        @return:
        """
        cls.__current_price_dict[code] = price
        pre_close_price = CodePrePriceManager.get_price_pre_cache(code)
        pre_close_price = CodePrePriceManager().get_price_pre_cache(code)
        if pre_close_price:
            rate = round((price - pre_close_price) * 100 / pre_close_price, 2)
            cls.__current_rate_dict[code] = rate
log_module/log_export.py
@@ -836,12 +836,13 @@
    """
    fdatas = {}
    path = f"{constant.get_path_prefix()}/logs/gp/code_attribute/pre_close_price.{date}.log"
    lines = __load_file_content(path)
    for line in lines:
        if line:
            data = line.split(" - ")[1]
            code, price = data.split("-")[0].strip(), data.split("-")[1].strip()
            fdatas[code] = price
    if os.path.exists(path):
        lines = __load_file_content(path)
        for line in lines:
            if line:
                data = line.split(" - ")[1]
                code, price = data.split("-")[0].strip(), data.split("-")[1].strip()
                fdatas[code] = price
    return fdatas
servers/data_server.py
@@ -1114,7 +1114,7 @@
                limit_up_time = LimitUpDataConstant.get_first_limit_up_time(code)
                limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
                data.append(limit_up_time)
                pre_close_price = CodePrePriceManager.get_price_pre_cache(code)
                pre_close_price = CodePrePriceManager().get_price_pre_cache(code)
                latest_transaction_data = HuaXinTransactionDatasProcessor.get_latest_transaction_data(code)
                zylt_volume = global_util.zylt_volume_map.get(code)
                zyltgb = zylt_volume * limit_up_price
servers/huaxin_trade_server.py
@@ -477,7 +477,7 @@
        except Exception as e:
            logger_debug.exception(e)
        pre_close_price = CodePrePriceManager.get_price_pre_cache(code)
        pre_close_price = CodePrePriceManager().get_price_pre_cache(code)
        if pre_close_price is not None:
            average_rate = None
            try:
third_data/history_k_data_manager.py
@@ -72,7 +72,7 @@
            continue
        pre_close = HistoryKDataManager().get_pre_close(code, day)
        if pre_close is not None:
            gpcode_manager.CodePrePriceManager.set_price_pre(code, pre_close, force)
            gpcode_manager.CodePrePriceManager().set_price_pre(code, pre_close, force)
        else:
            not_codes.append(code)
    if not_codes:
trade/buy_radical/radical_buy_strategy.py
@@ -233,7 +233,7 @@
    """
    if tool.get_now_time_as_int() < int("093500") and open_price:
        async_log_util.info(logger_l2_radical_buy, f"开盘价:{code}-{open_price}")
        pre_price = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code)
        pre_price = gpcode_manager.CodePrePriceManager().get_price_pre_cache(code)
        if pre_price:
            rate = round((open_price - pre_price) / pre_price, 4)
            async_log_util.info(logger_l2_radical_buy, f"开盘价涨幅:{code}-{rate}")
trade/current_price_process_manager.py
@@ -166,7 +166,7 @@
            code, price = d["code"], float(d["price"])
            temp_prices.append((code, price))
            # 获取收盘价
            pricePre = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code)
            pricePre = gpcode_manager.CodePrePriceManager().get_price_pre_cache(code)
            if pricePre is not None:
                # 是否是想买单
                order_index = compute_code_order(code, top_in_blocks, yesterday_limit_up_codes,
utils/init_data_util.py
@@ -20,7 +20,7 @@
            symbol = item['symbol']
            symbol = symbol.split(".")[1]
            pre_close = tool.to_price(decimal.Decimal(str(item['close'])))
            gpcode_manager.CodePrePriceManager.set_price_pre(symbol, pre_close, force)
            gpcode_manager.CodePrePriceManager().set_price_pre(symbol, pre_close, force)
# 获取近90天的最大量与最近的量