From 365491c1fcf523994035e4bd28d8b5872dd6ec98 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 31 七月 2025 14:47:48 +0800 Subject: [PATCH] 除权采用掘金更新K线 --- l2/l2_data_manager.py | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/l2/l2_data_manager.py b/l2/l2_data_manager.py index 1a0d08b..bbbe0ef 100644 --- a/l2/l2_data_manager.py +++ b/l2/l2_data_manager.py @@ -14,14 +14,16 @@ # 涓嬪崟涓存椂淇℃伅 class OrderBeginPosInfo(object): - MODE_NORMAL = 0 + MODE_NORMAL = 0 # 鏅�氫笅鍗� MODE_FAST = 1 - MODE_ACTIVE = 2 + MODE_ACTIVE = 2 # 绉瀬鍔ㄤ拱 + MODE_RADICAL = 3 # 鎵叆 + MODE_OPEN_LIMIT_UP = 4 # 鎺�1 # mode: 0-鏅�氫氦鏄� 1-蹇�熶氦鏄� def __init__(self, buy_single_index=None, buy_exec_index=-1, buy_compute_index=None, num=0, count=0, max_num_set=None, buy_volume_rate=None, sell_info=None, threshold_money=None, mode=0, mode_desc=None, - at_limit_up=False): + at_limit_up=False, first_limit_up_buy=False, min_order_no = None): self.buy_single_index = buy_single_index self.buy_exec_index = buy_exec_index self.buy_compute_index = buy_compute_index @@ -38,6 +40,10 @@ self.mode_desc = mode_desc # 鏄惁鏄澘涓婁拱 self.at_limit_up = at_limit_up + # 鏄惁涓洪灏佷拱 + self.first_limit_up_buy = first_limit_up_buy + # 缁熻鎵规澶у崟鎴愪氦鐨勬渶灏忚鍗曞彿 + self.min_order_no = min_order_no def get_max_num_set(self): if self.max_num_set: @@ -81,6 +87,8 @@ __buy_compute_index_info_cache = {} __buy_cancel_single_pos_cache = {} __instance = None + # 鏈�杩戠殑涓嬪崟妯″紡 + __latest_place_order_mode_cache = {} def __new__(cls, *args, **kwargs): if not cls.__instance: @@ -116,7 +124,6 @@ # 鑾峰彇涔板叆鐐逛俊鎭� # 杩斿洖鏁版嵁涓猴細涔板叆鐐� 绱绾拱棰� 宸茬粡璁$畻鐨勬暟鎹储寮� - def get_buy_compute_start_data(self, code): _key = "buy_compute_index_info-{}".format(code) _data_json = RedisUtils.get(self.__get_redis(), _key) @@ -139,6 +146,10 @@ # nums 绱绾拱棰� def set_buy_compute_start_data_v2(self, code, order: OrderBeginPosInfo): + + if order.mode is not None: + self.__latest_place_order_mode_cache[code] = order.mode + expire = tool.get_expire() _key = "buy_compute_index_info-{}".format(code) data_ = None @@ -156,6 +167,15 @@ def is_placed_order(cls, order_begin_pos: OrderBeginPosInfo): return order_begin_pos and order_begin_pos.buy_exec_index is not None and order_begin_pos.buy_exec_index > -1 + @classmethod + def get_latest_place_order_mode(cls, code): + """ + 鑾峰彇鏈�杩戜笅鍗曠殑妯″紡 + @param code: + @return: + """ + return cls.__latest_place_order_mode_cache.get(code) + # 娓呴櫎l2鏁版嵁 def clear_l2_data(code): -- Gitblit v1.8.0