Administrator
2024-04-11 832d70d984316e43048a84ad61d0c8a12c319993
l2/l2_transaction_data_manager.py
@@ -104,9 +104,12 @@
    # 最近所有的卖单
    __latest_all_sell_orders_dict = {}
    # 保存最近成交的价格
    __latest_trade_price_dict = {}
    # 返回最近1s的大单卖:(总卖金额,[(卖单号,总手数,价格,('开始时间',买单号),('结束时间',买单号)),...])
    @classmethod
    def add_transaction_datas(cls, code, datas, buy_exec_index=None):
    def add_transaction_datas(cls, code, datas, limit_up_price=None):
        # 是否为主动卖
        def is_active_sell(sell_no, buy_no):
            return sell_no > buy_no
@@ -131,8 +134,18 @@
        total_datas = local_today_datas.get(code)
        if not sell_no_map:
            sell_no_map = {}
        # 保存最近的成交价格:(价格,成交时间)
        cls.__latest_trade_price_dict[code] = (datas[-1][1], datas[-1][3])
        for d in datas:
            if not is_active_sell(d[7], d[6]):
            # 获取当前是否为主动买
            _is_active_sell = is_active_sell(d[7], d[6])
            if not _is_active_sell and d[1] == limit_up_price:
                # TODO 被动涨停卖,这个卖的订单是否在最近的涨停卖列表中
                pass
            if not _is_active_sell:
                continue
            cls.__latest_sell_order_info_list_dict[code].append(d)
            if code not in cls.__latest_sell_order_dict:
@@ -169,7 +182,9 @@
        total_big_sell_datas = cls.__big_sell_order_info_list_dict.get(code)
        total_sell_info = [0, None]  # 总资金,开始成交信息,结束成交信息
        latest_sell_order_info = cls.__latest_sell_order_dict[code]
        latest_sell_order_info = cls.__latest_sell_order_dict.get(code)
        if latest_sell_order_info:
            # 不是第一次非主动卖上传
        big_sell_order_ids = cls.__big_sell_order_ids_dict[code]
        # print("大卖单", big_sell_order_ids)
        big_sell_orders = []
@@ -231,3 +246,8 @@
            else:
                total_orders.append(cls.__latest_sell_order_dict[code])
        return total_orders
    # 获取最近成交价格信息, 返回格式:(价格,时间)
    @classmethod
    def get_latest_trade_price_info(cls, code):
        return cls.__latest_trade_price_dict.get(code)