Administrator
2023-12-22 f0248f54f90a12f491245f0ee3ccfbe8f477a76b
l2/l2_data_util.py
@@ -408,11 +408,16 @@
        if int(val["operateType"]) != 2:
            return False
        return True
        price = float(val["price"])
        num = int(val["num"])
        # if price * num * 100 < 50 * 10000:
        #     return False
    # 涨停卖撤
    @classmethod
    def is_limit_up_price_sell_cancel(cls, val):
        if int(val["limitPrice"]) != 1:
            return False
        if int(val["operateType"]) != 3:
            return False
        return True
    # 是否涨停买撤
@@ -443,6 +448,22 @@
        if int(val["operateType"]) == 2:
            return True
        return False
    # 是否为买
    @classmethod
    def is_buy(cls, val):
        if int(val["operateType"]) == 0:
            return True
        return False
    # l2时间差值
    @classmethod
    def time_sub_as_ms(cls, val1, val2):
        # 计算时间差值
        sub_s = tool.trade_time_sub(val1["time"], val2["time"])
        sub_ms = int(val1["tms"]) - int(val2["tms"])
        fs = sub_s * 1000 + sub_ms
        return fs
class L2TradeQueueUtils(object):
@@ -558,4 +579,4 @@
if __name__ == "__main__":
    print(load_l2_data("002235"))
    print(L2DataUtil.time_sub_as_ms({"time": "13:00:00", "time_ms": "980"}, {"time": "11:29:59", "time_ms": "590"}))