From 81f328532e366eef171b71810b221a9294dda78f Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 21 十二月 2023 14:31:58 +0800 Subject: [PATCH] 买入条件调整/L撤调整 --- l2/l2_data_util.py | 31 ++++++++++++++++++++++++++----- 1 files changed, 26 insertions(+), 5 deletions(-) diff --git a/l2/l2_data_util.py b/l2/l2_data_util.py index 6b3bdf3..8b02f15 100644 --- a/l2/l2_data_util.py +++ b/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"})) -- Gitblit v1.8.0