From 5adedb7c797ad08b7607c56e8255c21609c97000 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 15 四月 2024 00:07:31 +0800 Subject: [PATCH] 新版深证下单完善 --- l2/place_order_single_data_manager.py | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/l2/place_order_single_data_manager.py b/l2/place_order_single_data_manager.py index 536ceeb..8a091e2 100644 --- a/l2/place_order_single_data_manager.py +++ b/l2/place_order_single_data_manager.py @@ -17,6 +17,9 @@ __latest_limit_up_sell_order_no_set_dict = {} + # 涓诲姩鍗栬鍗曞彿闆嗗悎 + __active_sell_order_no_set_dict = {} + @classmethod def add_l2_delegate_limit_up_sell(cls, code, data): """ @@ -86,6 +89,12 @@ if not sell_list: return sell_info = sell_list[-1] + # 涓诲姩鍗栬鍗曢泦鍚� + active_sell_order_no_set = cls.__active_sell_order_no_set_dict.get(code) + if active_sell_order_no_set and sell_info['val']['orderNo'] in active_sell_order_no_set: + l2_log.info(code, logger_l2_trade_buy,f"鏈�杩戠殑鍗栨槸涓诲姩鍗�:{sell_info['val']['orderNo']}") + return + sell_info_num = sell_info['val']['num'] deal_num = cls.__latest_sell_data[code][1] // 100 @@ -97,6 +106,23 @@ l2_log.info(code, logger_l2_trade_buy, f"{code}#鎵惧埌鏈�杩戠殑琚姩娑ㄥ仠鍗栧崟鏁版嵁锛歿sell_info['val']['orderNo']}, 鍙互瑙﹀彂涓嬪崟") # l2_log.info(code, logger_l2_trade_buy, f"鎵惧埌鏈�杩戠殑琚姩娑ㄥ仠鍗栧崟鏁版嵁锛歿data['val']['orderNo']}, 鍙互瑙﹀彂涓嬪崟") + except Exception as e: + logger_debug.exception(e) + + @classmethod + def add_active_limit_up_sell_data(cls, data): + """ + 娣诲姞涓诲姩鍗栨暟鎹� + @param data: + @return: + """ + try: + code = data[0] + sell_no = data[7] + if code not in cls.__active_sell_order_no_set_dict: + cls.__active_sell_order_no_set_dict[code] = set() + cls.__active_sell_order_no_set_dict[code].add(sell_no) + except Exception as e: logger_debug.exception(e) @@ -149,7 +175,7 @@ # 鐢熸晥鏃堕棿鍦�1s浠ュ唴 cls.__latest_sell_data_dict[code] = (data, tool.trade_time_add_millionsecond(deal_time, 1000)) if cls.__callback: - cls.__callback.OnTradeSingle(code, cls.__latest_sell_data_dict[code]) + cls.__callback.OnTradeSingle(code, cls.TYPE_PASSIVE, cls.__latest_sell_data_dict[code]) @classmethod def set_sell_passive_to_active_datas(cls, code, passive_data, active_data): @@ -166,7 +192,7 @@ cls.__latest_sell_active_deal_data_dict[code] = ( active_data, tool.trade_time_add_millionsecond(deal_time, 1000)) if cls.__callback: - cls.__callback.OnTradeSingle(code, cls.__latest_sell_active_deal_data_dict[code]) + cls.__callback.OnTradeSingle(code, cls.TYPE_ACTIVE, cls.__latest_sell_active_deal_data_dict[code]) @classmethod def get_valid_trade_single(cls, code, latest_time_with_ms): -- Gitblit v1.8.0