| | |
| | | RedisUtils.setex_async(self.__db, f"l_cancel_real_place_order_index-{code}", tool.get_expire(), index) |
| | | if buy_single_index is not None: |
| | | if code in self.__last_trade_progress_dict: |
| | | # L撤从成交进度位开始计算 |
| | | self.compute_watch_index(code, buy_single_index, |
| | | max(buy_single_index, self.__last_trade_progress_dict[code] + 1), index) |
| | | self.__last_trade_progress_dict[code], index) |
| | | else: |
| | | self.compute_watch_index(code, buy_single_index, buy_single_index, index) |
| | | |
| | |
| | | |
| | | return False, None, "" |
| | | |
| | | def place_order_success(self, code): |
| | | self.clear(code) |
| | | # B撤单 |
| | | # 剩余一个大单撤半截就撤单 |
| | | def need_cancel_for_b(self, code, start_index, end_index): |
| | | real_place_order_info = self.__real_place_order_index_dict.get(code) |
| | | if not real_place_order_info or real_place_order_info[1]: |
| | | # 没有真实下单位置 |
| | | return False, None, "没有真实下单位置" |
| | | trade_index, is_default = TradeBuyQueue().get_traded_index(code) |
| | | if trade_index is None: |
| | | return False,None, "未获取到成交进度位" |
| | | total_datas = local_today_datas.get(code) |
| | | buyno_map = local_today_buyno_map.get(code) |
| | | cancel_half_index = None |
| | | for i in range(start_index, end_index + 1): |
| | | data = total_datas[i] |
| | | val = data['val'] |
| | | if not L2DataUtil.is_limit_up_price_buy_cancel(val): |
| | | continue |
| | | orderNo = val['orderNo'] |
| | | buy_data = buyno_map.get(f"{orderNo}") |
| | | if not buy_data: |
| | | continue |
| | | # 判断大单 |
| | | if buy_data["val"]["num"] * float(buy_data["val"]["price"]) < 29900: |
| | | continue |
| | | # 判断是否撤半截 |
| | | if buy_data["val"]["num"] > val["num"]: |
| | | cancel_half_index = i |
| | | break |
| | | if cancel_half_index is None: |
| | | return False,None, "没有撤半截" |
| | | # 有大单撤半截桩 |
| | | # 计算是否还剩下大单 |
| | | total_big_num_count = 0 |
| | | for i in range(trade_index, real_place_order_info[0]): |
| | | data = total_datas[i] |
| | | val = data['val'] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | if val["num"] * float(val["price"]) < 29900: |
| | | continue |
| | | 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_big_num_count += 1 |
| | | break |
| | | if total_big_num_count == 0: |
| | | # 没有剩下大单 |
| | | return True, total_datas[cancel_half_index], f"B撤:撤单索引-{cancel_half_index}" |
| | | return False, None, "还有大单没撤单" |
| | | |
| | | def cancel_success(self, code): |
| | | self.clear(code) |
| | | |
| | | def place_order_success(self, code): |
| | | self.clear(code) |
| | | |
| | | |
| | | def cancel_success(self, code): |
| | | self.clear(code) |
| | | |
| | | |
| | | # ---------------------------------独苗撤------------------------------- |