diff --git a/telegram/8619211027341.session b/telegram/8619211027341.session index fdd0e2b..3aa9b5f 100644 Binary files a/telegram/8619211027341.session and b/telegram/8619211027341.session differ diff --git a/telegram/bot_session.session b/telegram/bot_session.session index ecb8b34..5d816b2 100644 Binary files a/telegram/bot_session.session and b/telegram/bot_session.session differ diff --git a/telegram/sign.db b/telegram/sign.db index c51b303..fddad46 100644 Binary files a/telegram/sign.db and b/telegram/sign.db differ diff --git a/交易/weex-结构优化.py b/交易/weex-结构优化.py index 49a471b..d0a66b8 100644 --- a/交易/weex-结构优化.py +++ b/交易/weex-结构优化.py @@ -276,7 +276,8 @@ class WEEXApiClient: for attempt in range(Config.MAX_RETRY_ATTEMPTS): try: response = self.session.post( - 'https://http-gateway2.ngsvsfx.cn/api/v1/private/order/v2/getHistoryOrderFillTransactionPage', + # 'https://http-gateway2.ngsvsfx.cn/api/v1/private/order/v2/getHistoryOrderFillTransactionPage', + 'https://http-gateway2.janapw.com/api/v1/private/order/v2/getHistoryOrderFillTransactionPage', json=json_data, timeout=15 ) @@ -286,7 +287,7 @@ class WEEXApiClient: if not datas: return True, None - latest_order = datas[0] + latest_order = datas return True, latest_order except Exception as e: logger.warning(f"获取持仓状态失败(第{attempt + 1}次尝试): {e}") @@ -354,7 +355,7 @@ class TradingExecutor: try: self.page.ele('x:(//span[normalize-space(text()) = "闪电平仓"])').scroll.to_see(center=True) time.sleep(1) - self.page.ele('x:(//span[normalize-space(text()) = "闪电平仓"])').click() + self.page.ele('x:(//span[normalize-space(text()) = "闪电平仓"])').click(by_js=True) time.sleep(3) logger.success("成功执行平仓操作") return True @@ -457,16 +458,30 @@ class PositionManager: Args: position_data: 持仓数据字典 """ - self.position_data = position_data + self.position_datas = position_data if not position_data: self.current_position = self.POSITION_NONE return + position_data.reverse() + start = 0 + start1 = 0 + for _, i in enumerate(position_data): - direction = position_data.get("legacyOrderDirection") - if direction == "OPEN_LONG": + direction = i.get("legacyOrderDirection") + if direction == "CLOSE_SHORT": + start = 0 + elif direction == "CLOSE_LONG": + start1 = 0 + elif direction == "OPEN_SHORT": + start -= 1 + elif direction == "OPEN_LONG": + start1 += 1 + + # direction = position_data.get("legacyOrderDirection") + if start1: self.current_position = self.POSITION_LONG - elif direction == "OPEN_SHORT": + elif start: self.current_position = self.POSITION_SHORT else: self.current_position = self.POSITION_NONE