From 99cc81fca997dc7b73c5ac00ad47a60cf590d0ff Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 23 九月 2024 18:34:27 +0800 Subject: [PATCH] 买入规则修改 --- l2/l2_limitup_sell_data_manager.py | 42 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 39 insertions(+), 3 deletions(-) diff --git a/l2/l2_limitup_sell_data_manager.py b/l2/l2_limitup_sell_data_manager.py index c39d2a3..c3b2a02 100644 --- a/l2/l2_limitup_sell_data_manager.py +++ b/l2/l2_limitup_sell_data_manager.py @@ -49,7 +49,6 @@ cls.__order_no_set_dict[code].discard(order_no) cls.__delegating_sell_num_dict[code] -= volume async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate, f"{code}-鍗栨挙-{order_no, price, volume}") - else: if d[3] != '1': # 鍗� @@ -59,6 +58,15 @@ async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate, f"{code}-鍗�-{order_no, price, volume}") except: pass + + @classmethod + def get_delegating_sell_num(cls, code): + """ + 鑾峰彇澶勪簬濮旀墭鐘舵�佺殑鍗栧崟鎬绘墜鏁� + @param code: + @return: + """ + return cls.__delegating_sell_num_dict.get(code) @classmethod def set_deal_datas(cls, code, datas): @@ -71,16 +79,44 @@ try: limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) has_limit_up_active_buy = False + order_no_set = cls.__order_no_set_dict.get(code) + if order_no_set is None: + order_no_set = set() for d in datas: + if d[1] != limit_up_price: + continue # 鏄惁鏈夋定鍋滀富鍔ㄤ拱鎴愪氦 if d[6] < d[7]: continue - if d[1] != limit_up_price: - continue has_limit_up_active_buy = True break + + if code in cls.__delegating_sell_num_dict: + for d in datas: + # 鍑忓幓 + if d[7] in order_no_set: + cls.__delegating_sell_num_dict[code] -= d[2] + if has_limit_up_active_buy: # 鎵撳嵃鏃ュ織 async_log_util.l2_data_log.info(hx_logger_l2_sell_deal, f"鏈夋定鍋滀富鍔ㄥ崠锛歿code}-{datas[-1][3]}-{ cls.__delegating_sell_num_dict.get(code)}") except: pass + + @classmethod + def clear_data(cls, code): + """ + 娓呴櫎鏁版嵁锛氬綋鍑虹幇涓诲姩鍗栫殑鏃跺�欏氨鍙互娓呴櫎鏁版嵁 + @param code: + @return: + """ + if code in cls.__order_no_set_dict: + cls.__order_no_set_dict.pop(code) + + if code in cls.__order_no_data_map_dict: + cls.__order_no_data_map_dict.pop(code) + + if code in cls.__delegating_sell_num_dict: + cls.__delegating_sell_num_dict.pop(code) + + -- Gitblit v1.8.0