Administrator
2024-03-01 f01bb646b68659b60ef63c2a7a50de8d37ec9fd7
l2/cancel_buy_strategy.py
@@ -23,6 +23,7 @@
from log_module import async_log_util
from trade.deal_big_money_manager import DealOrderNoManager
from trade.sell.sell_rule_manager import TradeRuleManager
from trade.trade_manager import MarketSituationManager
from utils import tool
from l2.transaction_progress import TradeBuyQueue
from trade import trade_queue_manager, l2_trade_factor, trade_record_log_util
@@ -818,6 +819,14 @@
            l2_log.l_cancel_debug(code, f"计算撤单比例出错:{e}")
        return round(base_rate, 2), False
    # 获取L后成交太快的撤单比例
    @classmethod
    def get_fast_deal_cancel_rate(cls, code):
        must_buy_cancel_rate = cls.__MustBuyCodesManager.get_cancel_rate_cache(code)
        if must_buy_cancel_rate is not None:
            return must_buy_cancel_rate
        return constant.L_CANCEL_FAST_DEAL_RATE
    # 设置板块涨停数量(除开自己)
    @classmethod
    def set_block_limit_up_count(cls, reason_codes_dict):
@@ -1283,7 +1292,7 @@
        if real_place_order_index_info and real_place_order_index_info[1]:
            return False, "没获取到真实的下单位"
        threshold_rate = constant.L_CANCEL_FAST_DEAL_RATE
        threshold_rate = LCancelRateManager.get_fast_deal_cancel_rate(code)
        rate = orgin_deal_data[0] / (total_l_down_not_deal_num[0] * 100)
        if rate > threshold_rate:
            limit_up_price = float(gpcode_manager.get_limit_up_price(code))
@@ -1860,7 +1869,11 @@
                if cancel_data:
                    canceled_indexes.add(cancel_data["index"])
            cancel_rate = round(len(canceled_indexes) / len(watch_indexes), 2)
            if cancel_rate > constant.G_CANCEL_RATE:
            threshhold_rate = constant.G_CANCEL_RATE
            situation = MarketSituationManager().get_situation_cache()
            if situation == MarketSituationManager.SITUATION_GOOD:
                threshhold_rate = constant.G_CANCEL_RATE_FOR_GOOD_MARKET
            if cancel_rate > threshhold_rate:
                canceled_indexes_list = list(canceled_indexes)
                canceled_indexes_list.sort()
                return True, total_datas[canceled_indexes_list[-1]], f"撤单比例:{cancel_rate}"