| | |
| | | # 守护30s以外的数据 |
| | | if time_space <= constant.H_CANCEL_START_TIME: |
| | | return False, None |
| | | |
| | | if int(tool.get_now_time_str().replace(":", "")) > int("145000"): |
| | | return False, None |
| | | |
| | | l2_log.cancel_debug(code, "H级是否需要撤单,数据范围:{}-{} ", start_index, end_index) |
| | | # 监听的数据 |
| | | watch_index_set = self.__get_watch_index_set_cache(code) |
| | |
| | | def compute_watch_index(self, code, start_index, end_index): |
| | | total_datas = local_today_datas.get(code) |
| | | if total_datas: |
| | | # 计算的上截至位距离下截至位纯买额要小于2.5倍m值 |
| | | thresh_hold_money = l2_trade_factor.L2PlaceOrderParamsManager.get_base_m_val(code) |
| | | thresh_hold_money = int(thresh_hold_money * 2.5) |
| | | threshold_num = thresh_hold_money // (float(gpcode_manager.get_limit_up_price(code)) * 100) |
| | | # 统计净涨停买的数量 |
| | | total_num = 0 |
| | | re_start_index = start_index |
| | | for j in range(end_index, start_index, -1): |
| | | data = total_datas[j] |
| | | val = data['val'] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, |
| | | j, |
| | | total_datas, |
| | | local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if left_count > 0: |
| | | total_num += val['num'] |
| | | if total_num >= threshold_num: |
| | | re_start_index = j - 1 |
| | | |
| | | MIN_MONEYS = [300, 200, 100, 50] |
| | | watch_indexes = set() |
| | | MAX_COUNT = 5 |
| | | for min_money in MIN_MONEYS: |
| | | for i in range(end_index, start_index, -1): |
| | | for i in range(end_index, re_start_index, -1): |
| | | # if i > len(total_datas): |
| | | # continue |
| | | try: |
| | |
| | | break |
| | | if watch_indexes: |
| | | self.__set_watch_indexes(code, watch_indexes) |
| | | l2_log.l_cancel_debug(code, f"设置监听范围, 数据范围:{start_index}-{end_index} 监听范围-{watch_indexes}") |
| | | l2_log.l_cancel_debug(code, f"设置监听范围, 数据范围:{re_start_index}-{end_index} 监听范围-{watch_indexes}") |
| | | |
| | | # 设置真实下单位置 |
| | | def set_real_place_order_index(self, code, index, buy_single_index=None): |