| | |
| | | __TradeBuyQueue = transaction_progress.TradeBuyQueue() |
| | | # 非涨停成交时间 |
| | | __not_limit_up_time_dict = {} |
| | | # 最近成交数据字典 |
| | | __latest_transaction_data_dict = {} |
| | | |
| | | # 计算成交进度 |
| | | @classmethod |
| | |
| | | 统计大单成交 |
| | | @param code: |
| | | @param fdatas: 格式:[(数据本身, 是否主动买, 是否涨停, 总成交额, 不含ms时间,含ms时间)] |
| | | @return: |
| | | @return: 大买单列表,大卖单列表 |
| | | """ |
| | | |
| | | def statistic_big_buy_data(): |
| | |
| | | else: |
| | | buy_datas = statistic_big_buy_data() |
| | | sell_datas = statistic_big_sell_data() |
| | | return buy_datas, sell_datas |
| | | # L撤的比例与买卖大单无直接关系了 |
| | | # if buy_datas or sell_datas: |
| | | # buy_money = BigOrderDealManager().get_total_buy_money(code) |
| | |
| | | # q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'], |
| | | # data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'], |
| | | # data['SellNo'], data['ExecType'])) |
| | | if o_datas: |
| | | cls.__latest_transaction_data_dict[code] = o_datas[-1] |
| | | fdatas = [ |
| | | [d, d[6] > d[7], limit_up_price == d[1], d[1] * d[2], '', ''] |
| | | for d in o_datas] |
| | |
| | | _start_time = time.time() |
| | | # 大单统计 |
| | | # cls.__statistic_thread_pool.submit(cls.statistic_big_order_infos, code, datas, order_begin_pos) |
| | | big_sell_list = [] |
| | | try: |
| | | cls.statistic_big_order_infos(code, fdatas, order_begin_pos) |
| | | big_buy_list, big_sell_list = cls.statistic_big_order_infos(code, fdatas, order_begin_pos) |
| | | except Exception as e: |
| | | async_log_util.error(hx_logger_l2_debug, f"统计大单出错:{str(e)}") |
| | | use_time_list.append(("统计大单数据", time.time() - _start_time)) |
| | |
| | | _start_time = time.time() |
| | | |
| | | if is_placed_order: |
| | | |
| | | LCancelBigNumComputer().set_big_sell_order_info(code, big_sell_order_info) |
| | | |
| | | # need_cancel, cancel_msg = SCancelBigNumComputer().set_big_sell_order_info_for_cancel(code, |
| | | # big_sell_order_info, |
| | | # order_begin_pos) |
| | | need_cancel, cancel_msg = False, "" |
| | | cancel_type = None |
| | | if need_cancel: |
| | | cancel_msg = f"S撤:{cancel_msg}" |
| | | cancel_type = trade_constant.CANCEL_TYPE_S |
| | | try: |
| | | can_cancel, cancel_data = LCancelBigNumComputer().add_big_sell_order_deal_list(code, big_sell_list) |
| | | if can_cancel: |
| | | need_cancel, cancel_msg = True, f"L后大卖单成交叠加触发撤单:{big_sell_list}" |
| | | except Exception as e: |
| | | async_log_util.error(logger_debug, f"L后大卖单成交叠加触发撤单:{str(e)}") |
| | | |
| | | if not need_cancel: |
| | | need_cancel, cancel_msg = FCancelBigNumComputer().need_cancel_for_p(code, |
| | | order_begin_pos) |
| | |
| | | big_sell_order_info = HuaXinSellOrderStatisticManager.statistic_continue_limit_up_sell_transaction_datas( |
| | | code, fdatas, |
| | | limit_up_price) |
| | | LCancelBigNumComputer().set_big_sell_order_info(code, big_sell_order_info) |
| | | need_cancel, cancel_msg = False, "" |
| | | cancel_type = None |
| | | if not need_cancel: |
| | |
| | | L2TradeDataProcessor.cancel_buy(code, f"F撤:{cancel_result[1]}", |
| | | cancel_type=trade_constant.CANCEL_TYPE_F) |
| | | |
| | | if o_datas: |
| | | cls.__latest_transaction_data_dict[code] = o_datas[-1] |
| | | limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) |
| | | # =====格式化数据===== |
| | | # 整形数据,格式:[(数据本身, 是否主动买, 是否涨停, 总成交额, 不含ms时间,含ms时间)] |
| | |
| | | if _start_time - __start_time > 5: |
| | | l2_log.info(code, hx_logger_l2_upload, |
| | | f"{code}处理成交用时:{_start_time - __start_time} 数据数量:{len(fdatas)} 详情:{use_time_list}") |
| | | |
| | | @classmethod |
| | | def get_latest_transaction_data(cls, code): |
| | | return cls.__latest_transaction_data_dict.get(code) |