| | |
| | | @param end_index: |
| | | @return: 是否需要撤单,撤单索引, 消息 |
| | | """ |
| | | buyno_map = local_today_buyno_map.get(code) |
| | | watch_indexes = self.__watch_indexes_cache.get(code) |
| | | if not watch_indexes: |
| | | return False, None, "无大单监听" |
| | | total_datas = local_today_datas.get(code) |
| | | need_compute = False |
| | | 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 |
| | | if val["num"] * float(val["price"]) < 5000: |
| | | continue |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(data, buyno_map) |
| | | if buy_index is None: |
| | | continue |
| | | if buy_index in watch_indexes: |
| | | need_compute = True |
| | | break |
| | | cancel_indexes = set() |
| | | canceled_buyno_map = local_today_canceled_buyno_map.get(code) |
| | | if need_compute or True: |
| | | if True: |
| | | cancel_count = 0 |
| | | cancel_data = None |
| | | # 成交买单号 |
| | |
| | | # 买单已撤单 |
| | | cancel_count += 1 |
| | | cancel_indexes.add(index) |
| | | if cancel_indexes: |
| | | l2_log.d_cancel_debug(code, f"已撤单:{cancel_indexes}") |
| | | rate = round(cancel_count / len(watch_indexes), 2) |
| | | if rate >= 0.8: |
| | | return True, cancel_data, f"撤单比例-{rate},大单撤单({cancel_indexes})" |
| | |
| | | |
| | | def __clear_data(self, code): |
| | | if code in self.__watch_indexes_cache: |
| | | l2_log.d_cancel_debug(code, f"清除大单监听") |
| | | self.__watch_indexes_cache.pop(code) |
| | | RedisUtils.delete_async(self.__db, f"radical_big_order_watch-{code}") |
| | | |
| | |
| | | b_need_cancel, b_cancel_data, extra_msg = RDCancelBigNumComputer().need_cancel(code, start_index, |
| | | end_index) |
| | | if b_need_cancel and b_cancel_data: |
| | | l2_log.d_cancel_debug(code, f"准备RD撤({start_index}-{end_index}): {extra_msg}") |
| | | big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | | code)) |
| | | if big_order_info[0] > 0: |
| | | return b_cancel_data, f"RD撤({extra_msg})", trade_constant.CANCEL_TYPE_RD |
| | | else: |
| | | l2_log.d_cancel_debug(code, f"触发RD撤,但是大单已经足够:{big_order_info}") |
| | | except Exception as e: |
| | | async_log_util.error(logger_l2_error, |
| | | f"RD撤出错 参数:buy_single_index-{_buy_single_index} buy_exec_index-{_buy_exec_index} 错误原因:{str(e)}") |
| | |
| | | import re |
| | | import time |
| | | |
| | | try: |
| | | import easyocr |
| | | from cnocr import CnOcr |
| | | except: |
| | | pass |
| | | |
| | | |
| | | # 图像识别类 |
| | |
| | | # 下单成功 |
| | | radical_buy_data_manager.BlockPlaceOrderRecordManager().add_record(code, buy_blocks) |
| | | radical_buy_strategy.clear_data(code, force=True) |
| | | RDCancelBigNumComputer().clear_data(code) |
| | | # RDCancelBigNumComputer().clear_data(code) |
| | | # 大单成交足够 |
| | | RadicalBuyDataManager().big_order_deal_enough(code) |
| | | return True |
| | |
| | | from trade.trade_data_manager import CodeActualPriceProcessor, RadicalBuyDealCodesManager |
| | | import concurrent.futures |
| | | |
| | | trade_gui = import_util.import_lib("trade.trade_gui") |
| | | |
| | | __actualPriceProcessor = CodeActualPriceProcessor() |
| | | |
| | |
| | | from trade.trade_data_manager import AccountMoneyManager, RadicalBuyDealCodesManager |
| | | from utils import import_util, tool, huaxin_util |
| | | |
| | | try: |
| | | trade_gui = import_util.import_lib("trade.trade_gui") |
| | | |
| | | except: |
| | | pass |
| | | __db = 2 |
| | | __redis_manager = redis_manager.RedisManager(2) |
| | | |