| | |
| | | |
| | | # 获取撤单比例,返回(撤单比例,是否必买) |
| | | @classmethod |
| | | def get_cancel_rate(cls, code, buy_exec_time, is_up=False, is_l_down_recomputed=False, buy_mode = None): |
| | | def get_cancel_rate(cls, code, buy_exec_time, is_up=False, is_l_down_recomputed=False, buy_mode=None): |
| | | try: |
| | | must_buy = cls.__MustBuyCodesManager.is_in_cache(code) |
| | | if buy_mode == OrderBeginPosInfo.MODE_RADICAL: |
| | |
| | | deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | | code)) |
| | | deal_rate = round(deal_big_order_info[1]/deal_big_order_info[2], 2) |
| | | threshold_rate = 0.5*deal_rate+0.35 |
| | | deal_rate = round(deal_big_order_info[1] / deal_big_order_info[2], 2) |
| | | threshold_rate = 0.5 * deal_rate + 0.35 |
| | | threshold_rate = max(threshold_rate, 0.375) |
| | | threshold_rate = min(threshold_rate, 0.95) |
| | | return threshold_rate, False |
| | |
| | | ##判断监听的数据中是否有大单## |
| | | # 之前的大单为100w,现在改为正常大单 |
| | | has_big_num = False |
| | | BIG_ORDER_NUM_THRESHOLD = l2_data_util.get_big_money_val(gpcode_manager.get_limit_up_price_as_num(code), tool.is_ge_code(code)) |
| | | BIG_ORDER_NUM_THRESHOLD = int(round(BIG_ORDER_NUM_THRESHOLD/(gpcode_manager.get_limit_up_price_as_num(code)*100))) |
| | | BIG_ORDER_NUM_THRESHOLD = l2_data_util.get_big_money_val( |
| | | gpcode_manager.get_limit_up_price_as_num(code), tool.is_ge_code(code)) |
| | | BIG_ORDER_NUM_THRESHOLD = int( |
| | | round(BIG_ORDER_NUM_THRESHOLD / (gpcode_manager.get_limit_up_price_as_num(code) * 100))) |
| | | for i in watch_indexes: |
| | | # 是否有大单 |
| | | data = total_datas[i] |
| | |
| | | cancel_data['val'])) <= 0: |
| | | watch_indexes.add(i) |
| | | break |
| | | |
| | | # 计算真实下单位置到成交进度位的最大未撤大单前2 |
| | | big_order_list = [] |
| | | for i in range(start_index, end_index): |
| | | data = total_datas[i] |
| | | val = data['val'] |
| | | # 涨停买,且未撤单 |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 小金额过滤 |
| | | if val['num'] < BIG_ORDER_NUM_THRESHOLD: |
| | | continue |
| | | cancel_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not cancel_data: |
| | | big_order_list.append((i, val['num'])) |
| | | if big_order_list: |
| | | big_order_list.sort(key=lambda x: x[1], reverse=True) |
| | | watch_indexes |= set([x[0] for x in big_order_list[:2]]) |
| | | # 获取真实下单位后面10笔大单 |
| | | watch_indexes_after = self.__compute_l_down_watch_index_after_real_place_order_index(code) |
| | | if watch_indexes_after: |