From 838af524960f363d30fe8955f71f61107e7178de Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 01 四月 2024 15:00:36 +0800 Subject: [PATCH] 主动卖bug修复 --- l2/l2_transaction_data_manager.py | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/l2/l2_transaction_data_manager.py b/l2/l2_transaction_data_manager.py index c80396f..9efb94d 100644 --- a/l2/l2_transaction_data_manager.py +++ b/l2/l2_transaction_data_manager.py @@ -105,6 +105,13 @@ # 杩斿洖鏈�杩�1s鐨勫ぇ鍗曞崠锛�(鎬诲崠閲戦,[(鍗栧崟鍙�,鎬绘墜鏁�,浠锋牸,锛�'寮�濮嬫椂闂�',涔板崟鍙凤級,锛�'缁撴潫鏃堕棿',涔板崟鍙凤級),...]) @classmethod def add_transaction_datas(cls, code, datas, buy_exec_index=None): + # 鏄惁涓轰富鍔ㄥ崠 + def is_active_sell(sell_no): + if buy_exec_index is not None: + return sell_no > int(total_datas[buy_exec_index]["val"]["orderNo"]) + else: + return f"{sell_no}" not in sell_no_map + # q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'], # data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'], # data['SellNo'], data['ExecType'])) @@ -138,8 +145,7 @@ # 澶т簬50w鐨勫崠鍗曟墠浼氫繚瀛� # 澶т簬50w鍔犲叆鍗栧崟 if info[1] * info[2] >= 500000: - if f"{info[0]}" not in sell_no_map or (buy_exec_index is not None and info[0] > int( - total_datas[buy_exec_index]["val"]["orderNo"])): + if is_active_sell(info[0]): l2_log.info(code, hx_logger_l2_transaction_sell_order, f"{cls.__latest_sell_order_dict[code]}") cls.__big_sell_order_ids_dict[code].add(info[0]) @@ -187,9 +193,7 @@ # 缁熻鏈�杩戠殑澶у崟 if latest_sell_order_info[1] * latest_sell_order_info[2] >= 500000: if latest_sell_order_info[0] not in temp_sell_order_ids: - if f"{latest_sell_order_info[0]}" not in sell_no_map or ( - buy_exec_index is not None and latest_sell_order_info[0] > int( - total_datas[buy_exec_index]["val"]["orderNo"])): + if is_active_sell(latest_sell_order_info[0]): big_sell_orders.append(latest_sell_order_info) temp_sell_order_ids.add(latest_sell_order_info[0]) total_sell_info[0] += int(latest_sell_order_info[1] * latest_sell_order_info[2]) -- Gitblit v1.8.0