Administrator
2024-05-27 40074d68d34bc222a6b8b8fce9a7cca0fc8044c1
cancel_strategy/s_l_h_cancel_strategy.py
@@ -39,7 +39,7 @@
                if can_buy_result and can_buy_result[0]:
                    if can_buy_result[0][1] <= 1 and can_buy_result[0][2] >= 3:
                        # 炸板率>60%以上就不加半红
                        if can_buy_result[0][3]<=0 or can_buy_result[0][2]/can_buy_result[0][3]>0.4:
                        if can_buy_result[0][3] <= 0 or can_buy_result[0][2] / can_buy_result[0][3] > 0.4:
                            half_must_buy = True
            except:
                pass
@@ -47,24 +47,24 @@
            if must_buy:
                return constant.S_FAST_RATE_WITH_MUST_BUY, "加红"
            elif half_must_buy:
                return round((constant.S_FAST_RATE + constant.S_FAST_RATE_WITH_MUST_BUY) / 2, 2),"半红"
                return round((constant.S_FAST_RATE + constant.S_FAST_RATE_WITH_MUST_BUY) / 2, 2), "半红"
            else:
                return constant.S_FAST_RATE,"常规"
                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),"半红"
                return round((constant.S_FAST_RATE + constant.S_FAST_BIG_RATE_WITH_MUST_BUY) / 2, 2), "半红"
            else:
                return constant.S_FAST_RATE,"常规"
                return constant.S_FAST_RATE, "常规"
        elif cancel_type == cls.TYPE_S_SLOW:
            if must_buy:
                return constant.S_SLOW_RATE_WITH_MUST_BUY, "加红"
            elif half_must_buy:
                return round((constant.S_SLOW_RATE + constant.S_SLOW_RATE_WITH_MUST_BUY) / 2, 2),"半红"
                return round((constant.S_SLOW_RATE + constant.S_SLOW_RATE_WITH_MUST_BUY) / 2, 2), "半红"
            else:
                return constant.S_SLOW_RATE,"常规"
        return None,""
                return constant.S_SLOW_RATE, "常规"
        return None, ""
class SCancelBigNumComputer:
@@ -292,7 +292,8 @@
        total_datas[real_place_order_info[0]]['val']['orderNo'], min_sell_money=min_sell_money)
        sell_order_num = sum([x[1] for x in sell_orders]) // 100
        rate = round(sell_order_num / total_num, 2)
        threshold_rate,threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_SLOW)
        threshold_rate, threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code,
                                                                                    SCancelRateManager.TYPE_S_SLOW)
        if rate > threshold_rate:
            return True, f"慢砸成交比例:{rate}/0.49({threshold_rate_msg})  成交:{sell_order_num}/{total_num}"
        else:
@@ -380,7 +381,8 @@
                    if total_num == 0:
                        total_num = 1
                    threshold_rate,threshold_rate_msg  = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_FAST_BIG)
                    threshold_rate, threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code,
                                                                                                SCancelRateManager.TYPE_S_FAST_BIG)
                    if total_deal_money / (total_num * limit_up_price * 100) >= threshold_rate:
                        # 大单成交额占总剩余总囊括的30%
@@ -441,7 +443,8 @@
            # 防止分母为0
            total_fast_money = 1
        rate = round(total_deal_money / total_fast_money, 2)
        threshold_rate,threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_FAST)
        threshold_rate, threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code,
                                                                                    SCancelRateManager.TYPE_S_FAST)
        if total_deal_money >= threash_money_w * 10000 and rate >= threshold_rate:
            return True, f"近1s有大卖单({round(total_deal_money / 10000, 1)}万/{threash_money_w}万({threshold_rate_msg}),成交占比:{total_deal_money}/{total_fast_money})"
@@ -521,7 +524,6 @@
            l2_log.s_cancel_debug(code, f"S慢砸监听范围:{watch_info}")
        except Exception as e:
            logger_l2_s_cancel.exception(e)
# ---------------------------------L撤-------------------------------
@@ -1219,7 +1221,8 @@
                if cancel_data:
                    if str(wi) in after_place_order_index_dict:
                        # 真实下单位置之后的按照权重比例来计算
                        canceled_num += total_data[wi]["val"]["num"] * (10 - after_place_order_index_dict[str(wi)]) // 10
                        canceled_num += total_data[wi]["val"]["num"] * (
                                    10 - after_place_order_index_dict[str(wi)]) // 10
                    else:
                        canceled_num += total_data[wi]["val"]["num"]
@@ -1416,6 +1419,7 @@
        print(self.__get_cancel_l_down_after_place_order_index_dict(code))
# --------------------------------H撤-------------------------------
class HourCancelBigNumComputer:
    __db = 0