| | |
| | | if val['orderNo'] == watch_info[1]: |
| | | total_num -= watch_info[2] |
| | | min_index = min(watch_info[0]) |
| | | sell_orders = HuaXinSellOrderStatisticManager.get_latest_transaction_datas(code, total_datas[real_place_order_info[0]]['val'][ |
| | | sell_orders = HuaXinSellOrderStatisticManager.get_latest_transaction_datas(code, total_datas[ |
| | | real_place_order_info[0]]['val'][ |
| | | 'orderNo']) |
| | | sell_order_num = sum([x[1] for x in sell_orders]) // 100 |
| | | rate = round(sell_order_num / total_num, 2) |
| | |
| | | # 防止分母为0 |
| | | total_fast_money = 1 |
| | | rate = round(total_deal_money / total_fast_money, 2) |
| | | if total_deal_money >= threash_money_w * 10000 and rate >= 0.25: |
| | | threshold_rate = constant.F_FAST_RATE |
| | | if gpcode_manager.MustBuyCodesManager().is_in_cache(code): |
| | | threshold_rate = constant.F_FAST_RATE_WITH_MUST_BUY |
| | | |
| | | 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}万,成交占比:{total_deal_money}/{total_fast_money})" |
| | | else: |
| | | l2_log.s_cancel_debug(code, |
| | |
| | | total_datas = local_today_datas.get(code) |
| | | |
| | | # h撤计算必须超过3分钟 |
| | | if tool.trade_time_sub(total_datas[-1]["val"]["time"], total_datas[real_place_order_index]["val"]["time"]) < 180: |
| | | if tool.trade_time_sub(total_datas[-1]["val"]["time"], |
| | | total_datas[real_place_order_index]["val"]["time"]) < 180: |
| | | l2_log.h_cancel_debug(code, "180s内囊括计算H撤") |
| | | return |
| | | # -----------------计算H上------------------- |
| | |
| | | code)) |
| | | cancel_num += val['num'] * (data['re'] - left_count) |
| | | rate = round(cancel_num / total_num, 4) |
| | | must_buy_cancel_rate = constant.H_CANCEL_RATE_WITH_LDOWN_CANT_INVALID if code in self.__l_cancel_triggered_codes else constant.H_CANCEL_RATE |
| | | threshold_rate = constant.H_CANCEL_RATE_WITH_LDOWN_CANT_INVALID if code in self.__l_cancel_triggered_codes else constant.H_CANCEL_RATE |
| | | try: |
| | | temp_rate = gpcode_manager.MustBuyCodesManager().get_cancel_rate_cache(code) |
| | | if temp_rate: |
| | | must_buy_cancel_rate = temp_rate |
| | | must_buy = gpcode_manager.MustBuyCodesManager().is_in_cache(code) |
| | | if must_buy: |
| | | threshold_rate = constant.H_CANCEL_RATE_WITH_MUST_BUY |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_h_cancel, str(e)) |
| | | if rate >= must_buy_cancel_rate: |
| | | if rate >= threshold_rate: |
| | | l2_log.h_cancel_debug(code, f"撤单比例:{rate}") |
| | | return True, total_data[-1] |
| | | return False, None |
| | |
| | | @classmethod |
| | | def get_cancel_rate(cls, code, buy_exec_time, is_up=False, is_l_down_recomputed=False): |
| | | try: |
| | | must_buy_cancel_rate = cls.__MustBuyCodesManager.get_cancel_rate_cache(code) |
| | | if must_buy_cancel_rate is not None: |
| | | return must_buy_cancel_rate, True |
| | | must_buy = cls.__MustBuyCodesManager.is_in_cache(code) |
| | | if must_buy: |
| | | if is_up: |
| | | return constant.L_CANCEL_RATE_UP_WITH_MUST_BUY, True |
| | | else: |
| | | return constant.L_CANCEL_RATE_WITH_MUST_BUY, True |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_l_cancel, str(e)) |
| | | |
| | |
| | | deal_rate = 0 |
| | | if code in cls.__big_num_deal_rate_dict: |
| | | deal_rate =round( cls.__big_num_deal_rate_dict[code]/100) |
| | | # if temp_rate >= 1: |
| | | # if temp_rate > 3: |
| | | # temp_rate = 3 |
| | | # deal_rate = round((temp_rate * 3.5 - 2.5) / 100, 4) if is_up else round( |
| | | # (temp_rate * 5.25 - 3.75) / 100, 4) |
| | | |
| | | base_rate += block_rate |
| | | base_rate += deal_rate |
| | |
| | | if rate > 10: |
| | | rate = 10 |
| | | cls.__big_num_deal_rate_dict[code] = rate |
| | | |
| | | |
| | | @classmethod |
| | | def compute_big_num_deal_info(cls, code): |
| | |
| | | if start_index <= i <= end_index: |
| | | # 如果是减小项 |
| | | if val < 0: |
| | | # 当前量小于最大量的24%则需要取消 |
| | | if exec_time_offset >= constant.S_CANCEL_EXPIRE_TIME: |
| | | if total_num <= min_volumn_big and max_buy1_volume * 0.24 > total_num: |
| | | cancel_index = i |
| | | cancel_msg = "封板额小于最高封板额的24% {}/{}".format(total_num, max_buy1_volume) |
| | | break |
| | | # 累计封单金额小于1000万 |
| | | if total_num < min_volumn: |
| | | # 与执行位相隔>=5s时规则生效 |