From 70f473d20da7532f4cb2f84b7e82b0bcee357700 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 24 四月 2023 15:45:36 +0800 Subject: [PATCH] 修复大单bug,优化买入时的档口要求 --- l2/code_price_manager.py | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/l2/code_price_manager.py b/l2/code_price_manager.py index 7a1f517..c4a3a48 100644 --- a/l2/code_price_manager.py +++ b/l2/code_price_manager.py @@ -11,6 +11,7 @@ class Buy1PriceManager: __redisManager = redis_manager.RedisManager(1) __latest_data = {} + __current_buy_1_price = {} @classmethod def __get_redis(cls): @@ -30,6 +31,21 @@ data = json.loads(data) return data[0], data[1] + @classmethod + def __save_buy1_price(cls, code, buy_1_price): + cls.__current_buy_1_price[code] = buy_1_price + cls.__get_redis().setex(f"buy1_price-{code}", tool.get_expire(), buy_1_price) + + @classmethod + def __get_buy1_price(cls, code): + return cls.__get_redis().get(f"buy1_price-{code}") + + @classmethod + def get_buy1_price(cls, code): + if code in cls.__current_buy_1_price: + return cls.__current_buy_1_price.get(code) + return cls.__get_buy1_price(code) + # 澶勭悊 @classmethod def process(cls, code, buy_1_price, time_str, limit_up_price, sell_1_price, sell_1_volumn): @@ -37,6 +53,9 @@ if cls.__latest_data.get(code) == data_str: return cls.__latest_data[code] = data_str + # 淇濆瓨涔�1浠锋牸 + cls.__save_buy1_price(code, buy_1_price) + # 璁板綍鏃ュ織 logger_trade_queue_price_info.info( f"code={code} data: time_str-{time_str}, buy_1_price-{buy_1_price},limit_up_price-{limit_up_price},sell_1_price-{sell_1_price},sell_1_volumn-{sell_1_volumn}") -- Gitblit v1.8.0