From 16264d61c7f4b1fc148172d7ecb6f8ccd35e43d6 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 19 七月 2023 18:59:58 +0800 Subject: [PATCH] bug修复 --- utils/huaxin_util.py | 7 +++++++ trade/huaxin/trade_api_server.py | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/trade/huaxin/trade_api_server.py b/trade/huaxin/trade_api_server.py index ddfd80e..36f14ce 100644 --- a/trade/huaxin/trade_api_server.py +++ b/trade/huaxin/trade_api_server.py @@ -362,6 +362,21 @@ if dataJSON["code"] == 0: data = dataJSON["data"] huaxin_trade_record_manager.DelegateRecordManager.add(data) + # 鏄惁鍙互鎾ゅ崟 + if data: + codes = [] + for d in data: + if huaxin_util.is_can_cancel(d["orderStatus"]): + codes.append(d["securityID"]) + if codes: + try: + trade_manager.process_trade_delegate_data([{"code":c} for c in codes]) + except Exception as e: + logging.exception(e) + + + + elif type_ == "money": dataJSON = huaxin_trade_api.get_money() if dataJSON["code"] == 0: diff --git a/utils/huaxin_util.py b/utils/huaxin_util.py index f362ac6..cc4fd49 100644 --- a/utils/huaxin_util.py +++ b/utils/huaxin_util.py @@ -27,3 +27,10 @@ TORA_TSTP_EXD_SZSE = 2 # 娣卞湷浜ゆ槗鎵� TORA_TSTP_EXD_HK = 3 # 棣欐腐浜ゆ槗鎵� TORA_TSTP_EXD_BSE = 4 # 鍖椾含璇佸埜浜ゆ槗鎵� + + +# 鏄惁鍙互鎾ゅ崟 +def is_can_cancel(state): + if state == TORA_TSTP_OST_Cached or state == TORA_TSTP_OST_Unknown or state == TORA_TSTP_OST_Accepted or state == TORA_TSTP_OST_PartTraded: + return True + return False -- Gitblit v1.8.0