Administrator
2024-11-06 0bc0d21140904ad09cae456ea83b62cfbc4063ac
bug修复
6个文件已修改
59 ■■■■ 已修改文件
code_attribute/code_l1_data_manager.py 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
output/code_info_output.py 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_constant.py 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/code_l1_data_manager.py
@@ -4,13 +4,30 @@
class L1DataManager:
    # 现价
    __current_price_dict = {}
    # 开盘价
    __open_price_dict = {}
    @classmethod
    def set_l1_current_price(cls, code, price):
        cls.__current_price_dict[code] = price
    @classmethod
    def set_open_price(cls, code, price):
        """
        设置开盘价
        @param code:
        @param price:
        @return:
        """
        cls.__open_price_dict[code] = price
    # 获取L1现价
    @classmethod
    def get_l1_current_price(cls, code):
        return cls.__current_price_dict.get(code)
    @classmethod
    def get_open_price(cls, code):
        return cls.__open_price_dict.get(code)
output/code_info_output.py
@@ -15,6 +15,7 @@
from l2.l2_data_manager import OrderBeginPosInfo
from l2.l2_data_util import L2DataUtil
from third_data.code_plate_key_manager import KPLCodeJXBlockManager
from third_data.kpl_data_constant import LimitUpCodesBlockRecordManager
from utils import global_util, tool
from log_module import log, log_export
from l2 import l2_data_manager, l2_data_util, transaction_progress, l2_data_manager_new, code_price_manager
@@ -114,7 +115,8 @@
        # 获取量参考日期
        try:
            volume_refer_date, volume_refer_date_distance = code_volumn_manager.CodeVolumeManager().get_volume_refer_date(code)
            volume_refer_date, volume_refer_date_distance = code_volumn_manager.CodeVolumeManager().get_volume_refer_date(
                code)
            params["trade_data"]["volume_refer_date"] = volume_refer_date
        except:
            pass
@@ -296,10 +298,17 @@
    __start_time = time.time()
    # 获取代码的历史涨停数据,(涨停原因,日期,板块)
    code_records = KPLLimitUpDataRecordManager.get_latest_infos(code, 4, False)[:2]
    # code_records = KPLLimitUpDataRecordManager.get_latest_infos(code, 4, False)[:2]
    # if code_records:
    #     code_records = [(format_plate_output(k[0]), k[1], [format_plate_output(k1) for k1 in k[2].split("、")]) for k in
    #                     code_records]
    # 修改历史
    code_records = LimitUpCodesBlockRecordManager().get_radical_buy_blocks_origin_data(code)
    if code_records:
        code_records = [(format_plate_output(k[0]), k[1], [format_plate_output(k1) for k1 in k[2].split("、")]) for k in
                        code_records]
        code_records = [(f"{x[0]}x{x[1]}", x[2], '') for x in code_records]
    else:
        code_records = []
    params["kpl_code_info"]["code_records"] = code_records
    if not KPLLimitUpDataRecordManager.total_datas:
@@ -495,10 +504,6 @@
    records_new.reverse()
    records_new_data.reverse()
    return break_time, records_new, records_new_data
# 返回内容[(类型,buy_single_index,indexes)]
servers/huaxin_trade_server.py
@@ -348,11 +348,15 @@
    # 保存现价
    @classmethod
    def __save_l1_current_price(cls, datas):
        before_trade = int(tool.get_now_time_str().replace(":", "")) < int("092900")
        for d in datas:
            code = d[0]
            # 格式 (代码,现价,涨幅,量,更新时间,买1价格,买1量)
            price = d[1]
            L1DataManager.set_l1_current_price(code, price)
            if before_trade:
                # 开盘前保存开盘价
                L1DataManager.set_open_price(code, price)
            huaxin_l1_data_manager.set_buy1_data(code, d[5], d[6])
    @classmethod
third_data/code_plate_key_manager.py
@@ -1553,7 +1553,7 @@
        # 新版本
        before_fblocks = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code)
        if before_fblocks:
        if not before_fblocks:
            before_fblocks = set()
        fblocks = BlockMapManager().filter_blocks(before_fblocks)
        if fblocks:
third_data/kpl_data_constant.py
@@ -20,6 +20,8 @@
    __limit_up_recommend_reasons_dict = {}
    # 激进买的原因
    __radical_buy_reasons_dict = {}
    # 原始数据
    __radical_buy_reasons_origin_data_dict = {}
    __instance = None
@@ -72,13 +74,12 @@
            temp_list = [(k, temp_dict[k][0], temp_dict[k][1]) for k in temp_dict]
            # 按照涨停次数与最近涨停时间排序
            temp_list.sort(key=lambda x: (x[1], x[2]), reverse=True)
            cls.__radical_buy_reasons_origin_data_dict[code] = temp_list
            blocks = {temp_list[0][0]}
            if len(temp_list) > 1:
                if temp_list[1][1] >= 2:
                    blocks.add(temp_list[1][0])
            cls.__radical_buy_reasons_dict[code] = blocks
    def get_limit_up_reasons(self, code):
        """
@@ -103,6 +104,14 @@
            blocks |= self.__limit_up_recommend_reasons_dict[code]
        return blocks
    def get_radical_buy_blocks_origin_data(self, code):
        """
        获取涨停买判断的板块的原始数据
        @param code:
        @return:
        """
        return self.__radical_buy_reasons_origin_data_dict.get(code)
    def get_radical_buy_blocks(self, code):
        """
        获取涨停买判断的板块
third_data/kpl_data_manager.py
@@ -495,7 +495,7 @@
        log.close_print()
        while True:
            try:
                if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")):
                if (tool.is_trade_time() and int(tool.get_now_time_str().replace(':', '')) > int("092530")) or True:
                    results = kpl_api.getLimitUpInfoNew()
                    result = json.loads(results)
                    start_time = time.time()