From 4e8e61b5cfcefc1a659589cb94ee9322ba8a1bc4 Mon Sep 17 00:00:00 2001 From: 21in7 Date: Mon, 2 Mar 2026 16:27:17 +0900 Subject: [PATCH] fix: guard against None current_trade_side in _calc_estimated_pnl Made-with: Cursor --- src/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bot.py b/src/bot.py index 2645c42..4eb79b7 100644 --- a/src/bot.py +++ b/src/bot.py @@ -192,7 +192,7 @@ class TradingBot: def _calc_estimated_pnl(self, exit_price: float) -> float: """진입가·수량 기반 예상 PnL 계산 (수수료 미반영).""" - if self._entry_price is None or self._entry_quantity is None: + if self._entry_price is None or self._entry_quantity is None or self.current_trade_side is None: return 0.0 if self.current_trade_side == "LONG": return (exit_price - self._entry_price) * self._entry_quantity