Administrator
2025-01-13 4646c44858e83949f8fb7a3e381c9ec40b64d73b
bug修复
3个文件已修改
24 ■■■■ 已修改文件
servers/huaxin_trade_server.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_constant.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_strategy.py 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py
@@ -499,7 +499,7 @@
        if data["sell"] and len(data["sell"]) > 1 and data["sell"][1][1] > 0:
            # 出现卖二
            radical_buy_strategy.clear_data(code, force=True)
            radical_buy_strategy.clear_data(code, force=True, market_time_str=time_str)
        # 设置扫入数据
        RadicalCodeMarketInfoManager().set_market_info(code, time_str, limit_up_price, data["buy"][0],
@@ -893,7 +893,7 @@
                                        break
                                latest_deal_time = l2_market_time_str
                            RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict[code] = (
                                time.time() + 30, latest_buy_no, buy_blocks,
                                time.time() + 60, latest_buy_no, buy_blocks,
                                latest_deal_time, buy_blocks_with_money)
                            return False
                    else:
third_data/kpl_data_constant.py
@@ -113,6 +113,8 @@
                kpl_block_dict[code] = []
            kpl_block_dict[code].append((r[2], r[1]))  # (板块, 日期)
        for code in kpl_block_dict:
            if code =='002361':
                print("")
            block_infos = kpl_block_dict.get(code)
            cls.__radical_buy_reasons_dict[code] = cls.__compute_limit_up_reasons(code, block_infos)
@@ -129,9 +131,13 @@
        # {"板块":[(出现次数, 最近出现日期)]}
        temp_dict = {}
        for b in block_infos:
            if b[0] in constant.KPL_INVALID_BLOCKS:
                continue
            if b[0] not in temp_dict:
                temp_dict[b[0]] = [0, b[1]]
            temp_dict[b[0]][0] += 1
        if not temp_dict:
            return set()
        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)
trade/buy_radical/radical_buy_strategy.py
@@ -30,9 +30,10 @@
__latest_deal_active_buy_order = {}
def clear_data(code, force=False):
def clear_data(code, force=False, market_time_str=None):
    """
    清除数据:下单过后/开板后清除数据
    @param market_time_str: L2 market时间
    @param force: 是否强制清除
    @param code:
    @return:
@@ -50,8 +51,15 @@
            force = True
    if force:
        # 如果比最近成交时间<=L2 market时间就视为数据延迟
        if market_time_str and code in RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict:
            if tool.trade_time_sub(market_time_str,
                                   RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict[code][3]) <= 0:
                async_log_util.info(logger_l2_radical_buy, f"L2market时间小于成交时间:{code}-{market_time_str}")
                return
        if __deal_active_buy_total_money.get(code):
            async_log_util.info(logger_l2_radical_buy, f"清除涨停卖成交数据")
            async_log_util.info(logger_l2_radical_buy, f"清除涨停卖成交数据:{code}-{market_time_str}")
        # 强制清除数据
        if code in __deal_active_buy_total_money:
            __deal_active_buy_total_money.pop(code)
@@ -60,7 +68,7 @@
            RadicalBuyDealCodesManager.buy_by_l2_delegate_expire_time_dict.pop(code)
def process_limit_up_active_buy_deal(code, transaction_datas, is_almost_open_limit_up = False):
def process_limit_up_active_buy_deal(code, transaction_datas, is_almost_open_limit_up=False):
    """
    涨停主动买成交
    @param code: