Administrator
2025-07-07 b381f779ae142d4c63c89ed38942d5920e71b87e
禁止扫入下单
4个文件已修改
47 ■■■■■ 已修改文件
api/outside_api_command_callback.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
build_server.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cancel_strategy/s_l_h_cancel_strategy.py 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_strategy.py 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/outside_api_command_callback.py
@@ -1068,8 +1068,8 @@
                            except:
                                pass
                            # L撤比例
                            l_down_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code,
                                                                                              buy_mode=OrderBeginPosInfo.MODE_RADICAL)
                            l_down_cancel_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code,
                                                                                                                buy_mode=OrderBeginPosInfo.MODE_RADICAL)
                            # 在挂的距离成交进度位金额/(远近期参考量-单当日实时成交量)*100%
                            expire_rate = "未知"
@@ -1081,8 +1081,8 @@
                                    expire_rate = "100%"
                                else:
                                    expire_rate = f"{100 - round(100 * total_left_num * 100 / (referer_volume - today_volumn), 2)}%"
                            except:
                                pass
                            except Exception as e:
                                logger_debug.exception(e)
                            fdata = {"id": orderSysID, "code_info": (code, code_name), "total_num": total_nums,
                                     "finish_num": deal_or_cancel_num,
@@ -1108,6 +1108,7 @@
                                     "block": '',
                                     "trade_queue": [],
                                     "l_down_cancel_rate": l_down_cancel_rate,
                                     "l_down_cancel_rate_info": cancel_rate_info,
                                     "expire_rate": expire_rate
                                     }
                            l_down_cancel_rate = CancelRateHumanSettingManager().get_l_down(code)
build_server.py
@@ -5,7 +5,7 @@
import socketserver
import subprocess
from http.server import BaseHTTPRequestHandler
from log_module.log import logger_system, logger_request_api
from log_module.log import logger_system, logger_request_api, logger_debug
from utils import tool
@@ -35,6 +35,7 @@
            root_dir = ps_dict.get("dir")
            script = ps_dict.get("script")
            output_file = ps_dict.get("output")
            logger_debug.info(f"编译: dir - 【{root_dir}】, script - 【{script}】, output - 【{output_file}】 ")
            output_file_path = os.path.join(root_dir, output_file)
            if os.path.exists(output_file_path):
                os.remove(output_file_path)
cancel_strategy/s_l_h_cancel_strategy.py
@@ -568,6 +568,14 @@
    # 获取撤单比例,返回(撤单比例,是否必买)
    @classmethod
    def get_cancel_rate(cls, code, is_up=False, is_l_down_recomputed=False, buy_mode=None):
        """
        @param code:
        @param is_up:
        @param is_l_down_recomputed:
        @param buy_mode:
        @return: 撤单比例, 是否加红, (原值,人为设置的值)
        """
        try:
            must_buy = cls.__MustBuyCodesManager.is_in_cache(code)
            if buy_mode == OrderBeginPosInfo.MODE_RADICAL:
@@ -579,13 +587,13 @@
                    human_rate = 0
                if must_buy:
                    # 扫入加红
                    return max(constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate), True
                    return max(constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate), True, (constant.L_CANCEL_RATE_WITH_MUST_BUY_FOR_REDICAL_BUY, human_rate)
                else:
                    # 根据成交额的大单成交占比来计算撤单比例
                    big_money_rate = radical_buy_data_manager.TotalDealBigOrderInfoManager.get_big_order_rate(code)
                    if big_money_rate is not None:
                        threshold_rate = min(big_money_rate * 3, 0.8)
                        return max(threshold_rate, human_rate), False
                        return max(threshold_rate, human_rate), False, (threshold_rate, human_rate)
                    else:
                        deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code,
                                                                                                     gpcode_manager.get_limit_up_price_as_num(
@@ -594,12 +602,12 @@
                        threshold_rate = 0.5 * deal_rate + 0.35
                        threshold_rate = max(threshold_rate, 0.375)
                        threshold_rate = min(threshold_rate, 0.8)
                        return max(threshold_rate, human_rate), False
                        return max(threshold_rate, human_rate), False, (threshold_rate, human_rate)
            if must_buy:
                if is_up:
                    return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True
                    return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True, None
                else:
                    return constant.L_CANCEL_RATE_WITH_MUST_BUY, True
                    return constant.L_CANCEL_RATE_WITH_MUST_BUY, True, None
        except Exception as e:
            async_log_util.error(logger_l2_l_cancel, str(e))
@@ -629,7 +637,7 @@
            base_rate += deal_rate
        except Exception as e:
            l2_log.l_cancel_debug(code, f"计算撤单比例出错:{e}")
        return round(base_rate, 2), False
        return round(base_rate, 2), False, None
    # 获取L后成交太快的撤单比例
    @classmethod
@@ -1506,7 +1514,7 @@
        # 计算监听的总条数
        total_num = 0
        max_num, max_num_count = 0, 0
        thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code)
        thresh_hold_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code)
        for wi in watch_indexes:
            if str(wi) in after_place_order_index_dict:
@@ -1651,7 +1659,7 @@
                    else:
                        canceled_count_weight += WATCH_INDEX_WEIGHTS[-1]
            rate = round(canceled_count_weight / total_count_weight, 3)
            thresh_cancel_rate, must_buy = LCancelRateManager.get_cancel_rate(code, is_up=True)
            thresh_cancel_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code, is_up=True)
            l2_log.l_cancel_debug(code, f"计算范围:{start_index}-{end_index},L前已撤单比例:{rate}/{thresh_cancel_rate}")
            if rate >= thresh_cancel_rate:
                # 计算成交进度位置到当前下单位置的纯买额
@@ -1804,7 +1812,7 @@
            total_nums += val["num"]
            if left_count > 0 and index < trade_index:
                total_deal_nums += val["num"]
        thresh_hold_rate, must_buy = LCancelRateManager.get_cancel_rate(code)
        thresh_hold_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code)
        if total_deal_nums / total_nums > 1 - thresh_hold_rate - 0.05:
            return False
        return True
trade/buy_radical/radical_buy_strategy.py
@@ -142,11 +142,16 @@
    price = transaction_datas[-1][1]
    huaxin_timestamp = transaction_datas[-1][3]
    # 判断是否可以扫入
    # 判断是否可以扫入, 暂时都不可扫入
    can_direct_buy = False
    human_setting_money = TotalDealBigOrderThresholdMoneyManager().get_money_cache(code)
    if human_setting_money:
        can_direct_buy = True
        # 自由市值80亿以上不扫
        # zyltgb = global_util.zyltgb_map.get(
        #     code)
        # if zyltgb and zyltgb < 80e8:
        #     can_direct_buy = True
        pass
    # 获取参考总卖额
    refer_sell_data = L2MarketSellManager().get_refer_sell_data(code, l2_huaxin_util.convert_time(