From d4e6598dabe42e7cd4a5bee05125db433f5c6870 Mon Sep 17 00:00:00 2001 From: cbazza Date: Wed, 21 Jan 2026 22:31:29 +0100 Subject: [PATCH] fix: Correct f-string format specifier in enhanced position monitor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed invalid format specifier error: - Cannot use conditional expression inside f-string format specifier - Changed from: {atr_value:.5f if atr_value else 'N/A'} - Changed to: separate variable with conditional, then format This fixes the recurring ERROR in position monitor logs. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- enhanced_trailing_stop.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/enhanced_trailing_stop.py b/enhanced_trailing_stop.py index 505a436..1f2132b 100644 --- a/enhanced_trailing_stop.py +++ b/enhanced_trailing_stop.py @@ -413,7 +413,8 @@ def create_enhanced_position_monitor( logger.debug(f"Could not calculate ATR: {e}") logger.info(f"\nšŸ” Enhanced Position Monitor - {len(positions)} position(s)") - logger.info(f" Session: {session.upper()} | ATR: {atr_value:.5f if atr_value else 'N/A'}") + atr_display = f"{atr_value:.5f}" if atr_value else "N/A" + logger.info(f" Session: {session.upper()} | ATR: {atr_display}") for position in positions: should_update, new_sl, reason = trailing_manager.should_update_trailing_stop(