Administrator
2023-07-27 e867939e133f207c782d4efb33c4f80f4649eff9
bug修复
4个文件已修改
43 ■■■■■ 已修改文件
l2/huaxin/huaxin_target_codes_manager.py 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_block_util.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/huaxin/huaxin_target_codes_manager.py
@@ -92,12 +92,15 @@
        addr, port = "127.0.0.1", 9001
        sk = socket.socket()  # 生成socket,连接server
        sk.connect((addr, port))
        sk.sendall(socket_util.load_header(json.dumps(fdata).encode('utf-8')))
        print("发送成功")
        result, header = socket_util.recv_data(sk)
        print("接受到数据", result)
        sk.close()
        if result:
            result = json.loads(result)
            if result["code"] != 0:
                raise Exception(result["msg"])
        try:
            sk.sendall(socket_util.load_header(json.dumps(fdata).encode('utf-8')))
            print("发送成功")
            result, header = socket_util.recv_data(sk)
            print("接受到数据", result)
            if result:
                result = json.loads(result)
                if result["code"] != 0:
                    raise Exception(result["msg"])
        finally:
            sk.close()
server.py
@@ -108,6 +108,7 @@
                try:
                    # 如果带有头
                    if _str.startswith("##"):
                        print("server接受到数据:",_str)
                        total_length = int(_str[2:10])
                        _str = _str[10:]
third_data/code_plate_key_manager.py
@@ -425,16 +425,16 @@
                                                                   code_limit_up_reason_dict, shsz=True)
            # 获取主板历史身位
            if is_top_4:
                is_open_limit_up, msg = kpl_block_util.is_shsz_open_limit_up(code, block, limit_up_record_datas,
                                                                             code_limit_up_reason_dict)
                if is_open_limit_up:
                pen_limit_up_codes = kpl_block_util.get_shsz_open_limit_up_codes(code, block, limit_up_record_datas,
                                                                                 code_limit_up_reason_dict)
                if pen_limit_up_codes:
                    # 主板开1
                    if current_shsz_rank < 2 and record_shsz_rank < 2:
                    if current_shsz_rank < len(pen_limit_up_codes) + 1 and record_shsz_rank < len(pen_limit_up_codes) + 1:
                        # 属于龙1,龙2
                        return block, f"{block}:top4涨停板块,主板开1,属于龙1/龙2(实时身位-{current_shsz_rank})"
                        return block, f"{block}:top4涨停板块,主板开1({pen_limit_up_codes}),属于主板前龙{len(pen_limit_up_codes) + 1}(实时身位-{current_shsz_rank})"
                    else:
                        msg_list.append(
                            f"板块-{block}: top4涨停板块,主板开1({msg}),不为主板龙1龙2(实时身位-{current_shsz_rank},历史身位-{record_shsz_rank})")
                            f"板块-{block}: top4涨停板块,主板开1({pen_limit_up_codes}),不为主板前龙{len(pen_limit_up_codes) + 1}(实时身位-{current_shsz_rank},历史身位-{record_shsz_rank})")
                        continue
                else:
                    if current_shsz_rank == 0 and record_shsz_rank < 2:
third_data/kpl_block_util.py
@@ -13,15 +13,16 @@
# 是否主板开1
# limit_up_record_datas 今日历史涨停
def is_shsz_open_limit_up(code, block, limit_up_record_datas, code_block_dict):
def get_shsz_open_limit_up_codes(code, block, limit_up_record_datas, code_block_dict):
    # 获取今日9:30的时间戳
    time_str = datetime.datetime.now().strftime("%Y-%m-%d") + " 09:30:00"
    timestamp = time.mktime(time.strptime(time_str, '%Y-%m-%d %H:%M:%S'))
    limit_up_codes = set()
    for k in limit_up_record_datas:
        if code_block_dict.get(k[3]) == block:
            if int(k[5]) < timestamp:
                return True, f"{k[3]}开一"
    return False, ""
                limit_up_codes.add(k[3])
    return limit_up_codes
# 代码是否是后排
@@ -87,7 +88,7 @@
    return False, block_codes_infos[:topn]
def is_record_top_block(code, block, limit_up_record_datas,yesterday_current_limit_up_codes, topn):
def is_record_top_block(code, block, limit_up_record_datas, yesterday_current_limit_up_codes, topn):
    block_codes_infos = []
    limit_up_time = time.time()
    for k in limit_up_record_datas: