From be73e2b78857adaf006063275726b69c4c60f0d7 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 12 十月 2022 11:54:25 +0800 Subject: [PATCH] 买撤策略修改;加入报警功能 --- trade_gui.py | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/trade_gui.py b/trade_gui.py index a73aae1..bb64ef9 100644 --- a/trade_gui.py +++ b/trade_gui.py @@ -74,6 +74,12 @@ cancel_trade_win = cls.getCancelBuyWin() if cancel_trade_win <= 0: raise Exception("濮旀墭鎾ら攢绐楀彛鏈墦寮�") + else: + pos = win32gui.GetWindowRect(cancel_trade_win) + width = pos[2] - pos[0] + height = pos[3] - pos[1] + if width <= 0 or height <= 0: + raise Exception("濮旀墭鎾ら攢绐楀彛琚渶灏忓寲") @classmethod def getText(cls, hwnd): @@ -321,7 +327,10 @@ logger_trade_gui.info("寮�濮嬫挙鍗曪細code-{}".format(code)) win = self.cancel_win if win <= 0: - raise Exception("鏃犳硶鎵惧埌鍙栨秷濮旀墭绐楀彛") + self.cancel_win = self.getCancelBuyWin() + win = self.cancel_win + if win <= 0: + raise Exception("鏃犳硶鎵惧埌鍙栨秷濮旀墭绐楀彛") t = time.time() print(t) start = int(round(t * 1000)) -- Gitblit v1.8.0