Administrator
2024-04-01 838af524960f363d30fe8955f71f61107e7178de
l2/l2_transaction_data_manager.py
@@ -105,6 +105,13 @@
    # 返回最近1s的大单卖:(总卖金额,[(卖单号,总手数,价格,('开始时间',买单号),('结束时间',买单号)),...])
    @classmethod
    def add_transaction_datas(cls, code, datas, buy_exec_index=None):
        # 是否为主动卖
        def is_active_sell(sell_no):
            if buy_exec_index is not None:
                return sell_no > int(total_datas[buy_exec_index]["val"]["orderNo"])
            else:
                return f"{sell_no}" not in sell_no_map
        # q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'],
        #           data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'],
        #           data['SellNo'], data['ExecType']))
@@ -138,8 +145,7 @@
                    # 大于50w的卖单才会保存
                    # 大于50w加入卖单
                    if info[1] * info[2] >= 500000:
                        if f"{info[0]}"  not in sell_no_map or (buy_exec_index is not None and info[0] > int(
                                total_datas[buy_exec_index]["val"]["orderNo"])):
                        if is_active_sell(info[0]):
                            l2_log.info(code, hx_logger_l2_transaction_sell_order,
                                        f"{cls.__latest_sell_order_dict[code]}")
                            cls.__big_sell_order_ids_dict[code].add(info[0])
@@ -187,9 +193,7 @@
        # 统计最近的大单
        if latest_sell_order_info[1] * latest_sell_order_info[2] >= 500000:
            if latest_sell_order_info[0] not in temp_sell_order_ids:
                if f"{latest_sell_order_info[0]}" not in sell_no_map or (
                        buy_exec_index is not None and latest_sell_order_info[0] > int(
                        total_datas[buy_exec_index]["val"]["orderNo"])):
                if is_active_sell(latest_sell_order_info[0]):
                    big_sell_orders.append(latest_sell_order_info)
                    temp_sell_order_ids.add(latest_sell_order_info[0])
                    total_sell_info[0] += int(latest_sell_order_info[1] * latest_sell_order_info[2])