Administrator
2024-07-16 9646d816498351e9e5979bc49d57317baeee804c
上证S重砸优化
1个文件已修改
14 ■■■■■ 已修改文件
cancel_strategy/s_l_h_cancel_strategy.py 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cancel_strategy/s_l_h_cancel_strategy.py
@@ -51,11 +51,18 @@
            else:
                return constant.S_FAST_RATE, "常规"
        elif cancel_type == cls.TYPE_S_FAST_BIG:
            # 重砸
            if must_buy:
                return constant.S_FAST_BIG_RATE_WITH_MUST_BUY, "加红"
            elif half_must_buy:
                return round((constant.S_FAST_RATE + constant.S_FAST_BIG_RATE_WITH_MUST_BUY) / 2, 2), "半红"
            else:
                # 上证 如果没有大单成交,不需要看比例
                if tool.is_sh_code(code):
                    # 获取大单成交
                    deal_big_order_count = BigOrderDealManager().get_total_buy_count(code)
                    if deal_big_order_count < 1:
                        return 0, "常规(无大单成交)"
                return constant.S_FAST_RATE, "常规"
        elif cancel_type == cls.TYPE_S_SLOW:
            if must_buy:
@@ -367,6 +374,11 @@
        if total_deal_money >= threshold_big_deal:
            # S重砸必撤的金额满足以后,以前是无脑撤。现在优化一下,看成交进度位---真实下单位的区间额≤重砸金额*3.3倍,就撤。
            try:
                # 上证如果重砸额大于阈值的1.5倍直接撤单
                if tool.is_sh_code(code) and total_deal_money >= threshold_big_deal * 1.5:
                    if not gpcode_manager.MustBuyCodesManager().is_in_cache(code):
                        return True, f"1s内成交({threshold_big_deal}) 大于大卖单({total_deal_money})的1.5倍"
                need_compute = False
                trade_index, is_default = TradeBuyQueue().get_traded_index(code)
                if trade_index is None:
@@ -1028,7 +1040,7 @@
                            code))
                    if left_count > 0:
                        after_count += 1
                        if l2_data_util.is_big_money(val,is_ge_code):
                        if l2_data_util.is_big_money(val, is_ge_code):
                            watch_indexes.add(i)
                            # 记录索引的位置
                            self.__set_cancel_l_down_after_place_order_index(code, i, after_count - 1)