Administrator
2023-11-07 6a107545a82cceaff58b769690f410f25ef4de34
Bug修复
5个文件已修改
34 ■■■■■ 已修改文件
l2/l2_data_manager_new.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
log_module/log_export.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_block_util.py 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/data_export_util.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py
@@ -5,6 +5,7 @@
from code_attribute import big_money_num_manager, code_volumn_manager, code_data_util, industry_codes_sort, \
    limit_up_time_manager, global_data_loader, gpcode_manager, code_nature_analyse
import constant
from code_attribute.code_nature_analyse import HighIncreaseCodeManager
from db.redis_manager_delegate import RedisUtils
from l2.huaxin import l2_huaxin_util, huaxin_delegate_postion_manager
from l2.l2_sell_manager import L2MarketSellManager
@@ -288,6 +289,7 @@
        if order_begin_pos.mode == OrderBeginPosInfo.MODE_FAST:
            need_cancel = FastCancelBigNumComputer().set_real_order_index(code, index)
            if need_cancel:
                l2_log.debug(code, "触发撤单,撤单位置:{} ,撤单原因:{}", index, "F撤不够2笔触发撤单")
                cls.cancel_buy(code, msg="F撤不够2笔触发撤单")
                return
        cancel_buy_strategy.set_real_place_position(code, index, order_begin_pos.buy_single_index)
@@ -799,11 +801,13 @@
        limit_up_price = gpcode_manager.get_limit_up_price(code)
        if float(limit_up_price) >= constant.MAX_CODE_PRICE:
            HighIncreaseCodeManager().add_code(code)
            return False, True, f"股价大于{constant.MAX_CODE_PRICE}块"
        if code_nature_analyse.LatestMaxVolumeManager().is_latest_max_volume(code):
            # 最近几天有最大量,判断量比是否大于60%
            if cls.volume_rate_info[code][0] < 0.6:
                HighIncreaseCodeManager().add_code(code)
                return False, True, f"近日出现最大量,当日量比({cls.volume_rate_info[code][0]})小于0.6"
        if constant.L2_SOURCE_TYPE == constant.L2_SOURCE_TYPE_HUAXIN:
log_module/log_export.py
@@ -165,7 +165,7 @@
                index = str_[0:str_.find(" ")].strip()
                # print("买入执行位置:", index)
                pos_list.append((1, int(index), ""))
            elif line.find("触发撤单") > 0:
            elif line.find("触发撤单,撤单位置:") > 0:
                str_ = line.split("触发撤单,撤单位置:")[1].strip()
                index = str_[0:str_.find(" ")].strip()
                # print("撤单位置:", index)
third_data/code_plate_key_manager.py
@@ -467,24 +467,27 @@
        # msg_list.append(f"\n实时top10(涨停数量:{len(current_limit_up_datas)})")
        # msg_list.append(f"历史top20(涨停数量:{len(top_8_record)})")
        # 需要排除的代码
        exclude_codes = HighIncreaseCodeManager().list_all()
        # 需要排除的老大的代码
        exclude_first_codes = HighIncreaseCodeManager().list_all()
        # 获取主板历史身位
        open_limit_up_codes = kpl_block_util.get_shsz_open_limit_up_codes(code, block, limit_up_record_datas,
                                                                          code_limit_up_reason_dict)
        # 获取主板实时身位,剔除高位板
        current_shsz_rank, front_current_shsz_rank_codes = kpl_block_util.get_code_current_rank(code, block,
                                                                                                current_limit_up_datas,
                                                                                                code_limit_up_reason_dict,
                                                                                                yesterday_current_limit_up_codes,
                                                                                                exclude_codes,
                                                                                                exclude_first_codes,
                                                                                                len(open_limit_up_codes),
                                                                                                shsz=True)
        record_shsz_rank, record_shsz_rank_codes = kpl_block_util.get_code_record_rank(code, block,
                                                                                       limit_up_record_datas,
                                                                                       code_limit_up_reason_dict,
                                                                                       yesterday_current_limit_up_codes,
                                                                                       shsz=True)
        # 获取主板历史身位
        open_limit_up_codes = kpl_block_util.get_shsz_open_limit_up_codes(code, block, limit_up_record_datas,
                                                                          code_limit_up_reason_dict)
        if open_limit_up_codes:
            # 主板开1
            if current_shsz_rank < len(open_limit_up_codes) + 1 and record_shsz_rank < len(open_limit_up_codes) + 2:
third_data/kpl_block_util.py
@@ -155,7 +155,7 @@
# 获取当日实时身位
# before_blocks_dict格式位{"代码":set("板块")}
def get_code_current_rank(code, block, current_limit_up_datas, code_limit_up_reason_dict,
                          yesterday_current_limit_up_codes, exclude_codes, shsz=False):
                          yesterday_current_limit_up_codes, exclude_codes,open_limit_up_count, shsz=False):
    block_codes_infos = []
    limit_up_time = time.time()
    for k in current_limit_up_datas:
@@ -168,15 +168,20 @@
        if k[0] in yesterday_current_limit_up_codes:
            continue
        if code_limit_up_reason_dict.get(k[0]) == block:
            if k[0] != code and k[0] not in exclude_codes:
            if k[0] != code:
                # 代码.涨停时间
                block_codes_infos.append((k[0], int(k[2])))
    block_codes_infos.append((code, limit_up_time))
    block_codes_infos.sort(key=lambda x: x[1])
    front_codes = []
    first_count = 0
    for i in range(0, len(block_codes_infos)):
        if i == open_limit_up_count and exclude_codes and block_codes_infos[i][0] in exclude_codes:
            # 非开1老大被排除
            first_count += 1
            continue
        if block_codes_infos[i][0] == code:
            return i, front_codes
            return i - first_count, front_codes
        else:
            front_codes.append(block_codes_infos[i][0])
    return 0, []
utils/data_export_util.py
@@ -271,6 +271,6 @@
if __name__ == "__main__":
    try:
        export_l2_excel("000530")
        export_l2_excel("605218")
    except Exception as e:
        logging.exception(e)