| | |
| | | from l2 import l2_log |
| | | from l2.l2_data_util import L2DataUtil |
| | | from log_module import async_log_util, log_export |
| | | from log_module.log import hx_logger_l2_sell_delegate, hx_logger_l2_sell_deal |
| | | from log_module.log import hx_logger_l2_sell_delegate, hx_logger_l2_sell_deal, logger_debug |
| | | from utils import tool |
| | | |
| | | |
| | |
| | | order_no_set = cls.__order_no_set_dict.get(code) |
| | | if order_no_set is None: |
| | | order_no_set = set() |
| | | limit_up_active_buy_datas = [] |
| | | # 统计涨停卖单的成交 |
| | | # 卖单成交字典 |
| | | __deal_order_volume_dict = {} |
| | | for d in fdatas: |
| | | # 是否有涨停主动买成交 |
| | | if not d[1]: |
| | | if not d[1] or not d[2]: |
| | | continue |
| | | if not d[2]: |
| | | continue |
| | | limit_up_active_buy_datas.append(d) |
| | | total_deal_volume = 0 |
| | | if code in cls.__delegating_sell_num_dict: |
| | | for d in fdatas: |
| | | # 减去 |
| | | if d[0][7] in order_no_set: |
| | | total_deal_volume += d[0][2] |
| | | cls.__delegating_sell_num_dict[code] -= total_deal_volume |
| | | if d[0][7] not in __deal_order_volume_dict: |
| | | __deal_order_volume_dict[d[0][7]] = 0 |
| | | __deal_order_volume_dict[d[0][7]] += d[0][2] |
| | | |
| | | if len(limit_up_active_buy_datas): |
| | | # 减去 |
| | | add_order_nos = order_no_set & __deal_order_volume_dict.keys() |
| | | _total_deal_volume = sum([__deal_order_volume_dict[x] for x in add_order_nos]) |
| | | if code in cls.__delegating_sell_num_dict: |
| | | cls.__delegating_sell_num_dict[code] -= _total_deal_volume |
| | | if _total_deal_volume > 0: |
| | | l2_log.info(code, hx_logger_l2_sell_deal, |
| | | f"涨停主动买成交:{limit_up_active_buy_datas}") |
| | | f"涨停主动买成交:{_total_deal_volume}") |
| | | # 打印日志 |
| | | l2_log.info(code, hx_logger_l2_sell_deal, |
| | | f"有涨停主动卖:{code}-{fdatas[-1][0][3]}-{cls.__delegating_sell_num_dict.get(code)}, 成交量-{total_deal_volume}") |
| | | except: |
| | | pass |
| | | f"有涨停主动卖:{code}-{fdatas[-1][0][3]}-{cls.__delegating_sell_num_dict.get(code)}, 成交量-{_total_deal_volume}") |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | @classmethod |
| | | def clear_data(cls, code): |