| | |
| | | self.__s_down_watch_indexes_dict[code] = (latest_deal_time, watch_indexes) |
| | | |
| | | # 是否有大卖单需要撤 |
| | | def __need_cancel_for_big_sell_order(self, code, big_sell_order_info): |
| | | def __need_cancel_for_big_sell_order(self, code, big_sell_order_info, order_begin_pos: OrderBeginPosInfo): |
| | | total_deal_money = sum([x[1] * x[2] for x in big_sell_order_info[1]]) |
| | | if total_deal_money >= 299 * 10000: |
| | | return True, f"近1s有大卖单({round(total_deal_money / 10000, 1)}万/299万)" |
| | | return False, "无299大单" |
| | | # 判断是否为激进下单 |
| | | threash_money_w = 299 |
| | | if order_begin_pos.mode == OrderBeginPosInfo.MODE_ACTIVE: |
| | | try: |
| | | total_datas = local_today_datas.get(code) |
| | | # 真实成交位距离真实下单位,10笔以内且金额≤1000万 , 且在180s内 |
| | | trade_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_index is None: |
| | | trade_index = 0 |
| | | real_order_index_info = self.__get_real_place_order_index_info_cache(code) |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | if real_order_index_info and not real_order_index_info[1]: |
| | | real_order_index = real_order_index_info[0] |
| | | start_order_no = big_sell_order_info[1][-1][4][1] |
| | | sell_time_str = l2_huaxin_util.convert_time(big_sell_order_info[1][-1][4][0], with_ms=False) |
| | | if tool.trade_time_sub(sell_time_str, total_datas[real_order_index]["val"]["time"]) < 180: |
| | | total_num = 0 |
| | | total_count = 0 |
| | | # 获取正在成交的数据 |
| | | dealing_info = HuaXinBuyOrderManager.get_dealing_order_info(code) |
| | | for i in range(trade_index, real_order_index): |
| | | data = total_datas[i] |
| | | val = data['val'] |
| | | if int(val['orderNo']) < start_order_no: |
| | | continue |
| | | if i == trade_index and dealing_info and str( |
| | | total_datas[trade_index]["val"]["orderNo"]) == str( |
| | | dealing_info[0]): |
| | | # 减去当前正在成交的数据中已经成交了的数据 |
| | | total_num -= dealing_info[1] // 100 |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2( |
| | | code, |
| | | i, |
| | | total_datas, |
| | | local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if left_count > 0: |
| | | total_num += val["num"] |
| | | total_count += 1 |
| | | if total_count <= 10 and total_num * float(limit_up_price) < 1000 * 100: |
| | | threash_money_w = 200 |
| | | except Exception as e: |
| | | l2_log.s_cancel_debug(code, f"S撤激进下单计算大单卖阈值出错:{str(e)}") |
| | | if total_deal_money >= threash_money_w * 10000: |
| | | return True, f"近1s有大卖单({round(total_deal_money / 10000, 1)}万/{threash_money_w}万)" |
| | | return False, f"无{threash_money_w}大单" |
| | | |
| | | # big_sell_order_info格式:[总共的卖单金额, 大卖单详情列表] |
| | | def set_big_sell_order_info_for_cancel(self, code, big_sell_order_info, order_begin_pos: OrderBeginPosInfo): |
| | |
| | | if big_sell_order_info[0] < 500000 or not big_sell_order_info[1]: |
| | | return False, "无大单卖" |
| | | try: |
| | | need_cancel, cancel_msg = self.__need_cancel_for_big_sell_order(code, big_sell_order_info) |
| | | need_cancel, cancel_msg = self.__need_cancel_for_big_sell_order(code, big_sell_order_info, order_begin_pos) |
| | | if need_cancel: |
| | | return need_cancel, cancel_msg |
| | | |