From 21c96ed504f93f16ce6f8a3ccf164a87c9edd9c0 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期二, 30 一月 2024 15:45:23 +0800 Subject: [PATCH] 增加调试日志 --- l2/l2_data_util.py | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/l2/l2_data_util.py b/l2/l2_data_util.py index 6b3bdf3..9abfa2b 100644 --- a/l2/l2_data_util.py +++ b/l2/l2_data_util.py @@ -244,7 +244,7 @@ price = float(val["price"]) money = price * int(val["num"]) if price > 3.0: - if money >= 30000: + if money >= 29900: return True else: return False @@ -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"})) -- Gitblit v1.8.0