fix: enhanced_trailing_stop, dynamic_threshold_optimizer, signal_cache

enhanced_trailing_stop.py:
- mt -> mt5 (all occurrences)
- Add pandas + timezone imports at file top
- Fix UTC bug: datetime.fromtimestamp(..., tz=timezone.utc).replace(tzinfo=None)
- Fetch symbol_info once per call, reuse for point (was called twice)
- cleanup_closed_positions: handle None from positions_get()
- Remove pandas import from inside function body

dynamic_threshold_optimizer.py:
- Fix SQL injection: replace f-string session filter with parameterized query (?)
- Add logging module, replace all print() with logger calls
- Use context manager (with sqlite3.connect()) to prevent connection leak on exception
- save_thresholds_to_config: add try/except with logger.error

signal_cache.py:
- Fix bare except -> except Exception in _cleanup_old_entries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-12 11:48:38 +02:00
co-authored by Claude Sonnet 4.6
parent 4e45db967b
commit f37e7adcf3
3 changed files with 51 additions and 46 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ class SignalCache:
age_hours = (now - timestamp).total_seconds() / 3600
if age_hours > MAX_CACHE_AGE_HOURS:
to_remove.append(ticket)
except:
except Exception:
to_remove.append(ticket)
for ticket in to_remove: