From 1c76abc59af35931b70b4742038dae0cfe4890d4 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期二, 18 七月 2023 16:28:18 +0800 Subject: [PATCH] 华鑫适配 --- l2/code_price_manager.py | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/l2/code_price_manager.py b/l2/code_price_manager.py index e57532a..8f7016b 100644 --- a/l2/code_price_manager.py +++ b/l2/code_price_manager.py @@ -40,11 +40,31 @@ def __get_buy1_price(cls, code): return cls.__get_redis().get(f"buy1_price-{code}") + # 璁剧疆鐐告澘鍚庣殑鏈�浣庝环 + @classmethod + def __save_open_limit_up_lowest_price(cls, code, price): + cls.__get_redis().setex(f"open_limit_up_lowest_price-{code}", tool.get_expire(), f"{price}") + + @classmethod + def __get_open_limit_up_lowest_price(cls, code): + return cls.__get_redis().get(f"open_limit_up_lowest_price-{code}") + + @classmethod + def set_open_limit_up_lowest_price(cls, code, price): + old_price = cls.__get_open_limit_up_lowest_price(code) + if not old_price or float(old_price) - float(price) > 0.001: + cls.__save_open_limit_up_lowest_price(code, price) + @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 get_open_limit_up_lowest_price(cls, code): + price = cls.__get_open_limit_up_lowest_price(code) + return price # 澶勭悊 @classmethod @@ -74,6 +94,10 @@ # 鏈夋定鍋滄椂闂达紝褰撳墠娌℃湁娑ㄥ仠锛屼箣鍓嶆病鏈夋墦寮�娑ㄥ仠 cls.__save_buy1_price_info(code, old_limit_up_time, time_str) + if old_limit_up_time and not is_limit_up: + # 涔嬪墠娑ㄥ仠杩囦笖鐜板湪灏氭湭娑ㄥ仠 + cls.set_open_limit_up_lowest_price(code, buy_1_price) + # 鏄惁鍙互涓嬪崟 @classmethod def is_can_buy(cls, code): -- Gitblit v1.8.0