diff --git a/telegram/8619211027341.session b/telegram/8619211027341.session index deddd3a..6e3682a 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 78e9332..d3e81a1 100644 Binary files a/telegram/bot_session.session and b/telegram/bot_session.session differ diff --git a/telegram/gpt1.py b/telegram/gpt1.py index 6cbd005..03dc0ae 100644 --- a/telegram/gpt1.py +++ b/telegram/gpt1.py @@ -536,7 +536,7 @@ async def build_sign_message(user_id: int, username: str) -> str: return ( f"✅ @{username} check-in succeed! Earned {SIGN_POINTS} points.\n" f"Current total points: {total}\n\n" - f"100 points can be exchanged for a 5 USDT experience gold." + f"100 points can be exchanged for a 5 (USDT) $ trial bonus." ) @@ -565,7 +565,7 @@ async def build_points_message(user_id: int, username: str) -> str: f"💰 @{username} Points Overview\n\n" f"📊 Current points: {total_pts}\n" f"👥 Invited users: {invite_count}\n\n" - f"💡 100 points can be exchanged for a 5 USDT experience gold." + f"💡 100 points can be exchanged for a 5 (USDT) $ trial bonus." ) @@ -575,7 +575,7 @@ def get_command_list_text() -> str: info = COMMAND_DEFINITIONS[key] msg += f"`{info['display']}` → {info['description']}\n" msg += ( - f"\nSign-in Reward: {SIGN_POINTS} points each time, and 100 points can be redeemed for a 5 USDT experience gold.\n" + f"\nSign-in Reward: {SIGN_POINTS} points each time, and 100 points can be exchanged for a 5 (USDT) $ trial bonus.\n" f"Chat Reward: The top {DAILY_SPEAK_TOP_N} users in daily chat activity each receive {DAILY_SPEAK_REWARD} points.\n" f"Invitation Reward: Each invited user grants {INVITE_POINTS} points.\n" f"Daily Settlement Time: Every day at 12:00 PM (America/New_York timezone)." diff --git a/telegram/sign.db b/telegram/sign.db index 22d2472..4bdf463 100644 Binary files a/telegram/sign.db and b/telegram/sign.db differ diff --git a/交易/weex-结构优化.py b/交易/weex-结构优化.py index 9783368..40e73f5 100644 --- a/交易/weex-结构优化.py +++ b/交易/weex-结构优化.py @@ -399,8 +399,14 @@ class TradingExecutor: amount: 交易金额 Returns: - 是否成功 + 是否成功(如果已持有相同方向仓位,返回True但不执行操作) """ + # 检查是否已经持有相同方向的仓位 + if (direction == "long" and current_position == PositionManager.POSITION_LONG) or \ + (direction == "short" and current_position == PositionManager.POSITION_SHORT): + logger.info(f"已持有{direction}方向仓位,无需重复开仓") + return True # 返回True表示"状态正常",虽然没有执行交易 + if not self.navigate_to_trading_page(): return False @@ -781,38 +787,48 @@ class WeexTransaction: ) if direction: - # 获取可用余额 - balance = self.api_client.get_available_balance() - if balance is None: - logger.error("获取可用余额失败") - MessageSender.send_dingtalk_message("获取可用余额失败", is_error=True) - return + # 检查是否已经持有相同方向的仓位 + current_pos = self.position_manager.current_position + if (direction == "long" and current_pos == PositionManager.POSITION_LONG) or \ + (direction == "short" and current_pos == PositionManager.POSITION_SHORT): + logger.info(f"已持有{direction}方向仓位,继续持仓,不执行新开仓操作") + # 继续持仓,不发送开仓信息,直接返回继续执行后续的持仓信息发送 + else: + # 需要执行交易(新开仓或反手) + # 获取可用余额 + balance = self.api_client.get_available_balance() + if balance is None: + logger.error("获取可用余额失败") + MessageSender.send_dingtalk_message("获取可用余额失败", is_error=True) + return - amount = balance / Config.POSITION_RATIO + amount = balance / Config.POSITION_RATIO - # 执行交易 - if not self.trading_executor.execute_trade( - direction=direction, - current_position=self.position_manager.current_position, - amount=amount - ): - MessageSender.send_dingtalk_message( - f"交易执行失败,方向:{direction}", - is_error=True + # 执行交易 + trade_executed = self.trading_executor.execute_trade( + direction=direction, + current_position=self.position_manager.current_position, + amount=amount ) - return - # 更新持仓状态 - if direction == "long": - self.position_manager.current_position = PositionManager.POSITION_LONG - elif direction == "short": - self.position_manager.current_position = PositionManager.POSITION_SHORT + if not trade_executed: + MessageSender.send_dingtalk_message( + f"交易执行失败,方向:{direction}", + is_error=True + ) + return - # 发送交易消息 - MessageSender.send_dingtalk_message( - f"信号:{direction},开仓金额:{amount:.2f}", - is_error=False - ) + # 更新持仓状态 + if direction == "long": + self.position_manager.current_position = PositionManager.POSITION_LONG + elif direction == "short": + self.position_manager.current_position = PositionManager.POSITION_SHORT + + # 发送交易消息(只有真正执行了开仓或反手操作才发送) + MessageSender.send_dingtalk_message( + f"信号:{direction},开仓金额:{amount:.2f}", + is_error=False + ) # 再次同步持仓状态(交易后) if not self.sync_position_status():