diff --git a/telegram/8619211027341.session b/telegram/8619211027341.session index bcf1f79..e9c22ab 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 94db0bb..c81d8a7 100644 Binary files a/telegram/bot_session.session and b/telegram/bot_session.session differ diff --git a/交易/websea-结构优化.py b/交易/websea-结构优化.py index 20f60ad..eb6dc7b 100644 --- a/交易/websea-结构优化.py +++ b/交易/websea-结构优化.py @@ -736,4 +736,3 @@ class WeexTransaction: if __name__ == '__main__': transaction = WeexTransaction(tge_id=191303) transaction.action() - diff --git a/交易/weex-结构优化.py b/交易/weex-结构优化.py index 40e73f5..e074bcf 100644 --- a/交易/weex-结构优化.py +++ b/交易/weex-结构优化.py @@ -66,16 +66,16 @@ class KlineAnalyzer: # 前跌后涨包住 -> 做多 if (KlineAnalyzer.is_bullish(curr) and - KlineAnalyzer.is_bearish(prev) and - int(c_open) <= int(p_close) and - int(c_close) >= int(p_open)): + KlineAnalyzer.is_bearish(prev) and + int(c_open) <= int(p_close) and + int(c_close) >= int(p_open)): return "long", "bear_bull_engulf" # 前涨后跌包住 -> 做空 if (KlineAnalyzer.is_bearish(curr) and - KlineAnalyzer.is_bullish(prev) and - int(c_open) >= int(p_close) and - int(c_close) <= int(p_open)): + KlineAnalyzer.is_bullish(prev) and + int(c_open) >= int(p_close) and + int(c_close) <= int(p_open)): return "short", "bull_bear_engulf" return None, None @@ -163,9 +163,9 @@ class WEEXApiClient: self.headers = headers def get_kline_data(self, contract_id: str = Config.CONTRACT_ID, - product_code: str = Config.PRODUCT_CODE, - kline_type: str = Config.KLINE_TYPE, - limit: int = Config.KLINE_LIMIT) -> List[Dict]: + product_code: str = Config.PRODUCT_CODE, + kline_type: str = Config.KLINE_TYPE, + limit: int = Config.KLINE_LIMIT) -> List[Dict]: """ 获取K线数据 @@ -403,7 +403,7 @@ class TradingExecutor: """ # 检查是否已经持有相同方向的仓位 if (direction == "long" and current_position == PositionManager.POSITION_LONG) or \ - (direction == "short" and current_position == PositionManager.POSITION_SHORT): + (direction == "short" and current_position == PositionManager.POSITION_SHORT): logger.info(f"已持有{direction}方向仓位,无需重复开仓") return True # 返回True表示"状态正常",虽然没有执行交易 @@ -445,8 +445,8 @@ class PositionManager: # 持仓状态常量 POSITION_SHORT = -1 # 做空 - POSITION_NONE = 0 # 无持仓 - POSITION_LONG = 1 # 做多 + POSITION_NONE = 0 # 无持仓 + POSITION_LONG = 1 # 做多 def __init__(self, trading_executor: TradingExecutor): self.trading_executor = trading_executor @@ -489,7 +489,7 @@ class PositionManager: # 持多仓,连续两根阴线,平多 if self.current_position == self.POSITION_LONG: if (KlineAnalyzer.is_bearish(kline_1) and - KlineAnalyzer.is_bearish(kline_2)): + KlineAnalyzer.is_bearish(kline_2)): logger.success( f"{datetime.datetime.now()},止损信号:连续两根阴线,平多" ) @@ -500,7 +500,7 @@ class PositionManager: # 持空仓,连续两根阳线,平空 elif self.current_position == self.POSITION_SHORT: if (KlineAnalyzer.is_bullish(kline_1) and - KlineAnalyzer.is_bullish(kline_2)): + KlineAnalyzer.is_bullish(kline_2)): logger.success( f"{datetime.datetime.now()},止损信号:连续两根阳线,平空" ) @@ -538,8 +538,8 @@ class MessageSender: @staticmethod def format_position_message(position_data: Optional[Dict], - current_price: float, - available_balance: float) -> str: + current_price: float, + available_balance: float) -> str: """ 格式化持仓信息消息 @@ -790,7 +790,7 @@ class WeexTransaction: # 检查是否已经持有相同方向的仓位 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): + (direction == "short" and current_pos == PositionManager.POSITION_SHORT): logger.info(f"已持有{direction}方向仓位,继续持仓,不执行新开仓操作") # 继续持仓,不发送开仓信息,直接返回继续执行后续的持仓信息发送 else: