fix: spread dict access and close_position retry logic

- Fix 'dict' has no attribute 'spread' by using .get("spread", 0)
- Add 3-retry loop to close_position() with fresh price each attempt
- Match retry pattern from send_order() for consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
GifariKemal
2026-02-06 13:36:46 +07:00
co-authored by Claude Opus 4.6
parent 0d25548ed5
commit 6e0db5274b
2 changed files with 75 additions and 43 deletions
+1 -1
View File
@@ -1220,7 +1220,7 @@ class TradingBot:
regime=regime,
volatility=volatility,
session=session_status.get("session", "unknown"),
spread=self.mt5.get_symbol_info(self.config.symbol).spread if hasattr(self.mt5, 'get_symbol_info') else 0,
spread=self.mt5.get_symbol_info(self.config.symbol).get("spread", 0) if hasattr(self.mt5, 'get_symbol_info') else 0,
atr=0, # ATR calculated in main loop, not available here
smc_signal=signal.signal_type,
smc_confidence=signal.confidence,