Kaynağa Gözat

Initialize largest_loss to negative infinity in PerformanceCalculator for accurate loss tracking. This change ensures that the calculation correctly identifies the largest loss during performance evaluations.

Carles Sentis 1 hafta önce
ebeveyn
işleme
ff17177a83
2 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 2 1
      src/stats/performance_calculator.py
  2. 1 1
      trading_bot.py

+ 2 - 1
src/stats/performance_calculator.py

@@ -62,7 +62,7 @@ class PerformanceCalculator:
             total_entry_volume = 0.0
             total_exit_volume = 0.0
             largest_win = 0.0
-            largest_loss = 0.0
+            largest_loss = float('-inf')  # Initialize to negative infinity
             largest_win_token = "N/A"
             largest_loss_token = "N/A"
             largest_win_pct = 0.0
@@ -95,6 +95,7 @@ class PerformanceCalculator:
                         largest_win_token = token['token']
                         largest_win_pct = (token_largest_win / token.get('largest_winning_cycle_entry_volume', 1)) * 100
                     
+                    # For losses, we want the most negative number
                     if token_largest_loss < largest_loss:
                         largest_loss = token_largest_loss
                         largest_loss_token = token['token']

+ 1 - 1
trading_bot.py

@@ -14,7 +14,7 @@ from datetime import datetime
 from pathlib import Path
 
 # Bot version
-BOT_VERSION = "2.4.213"
+BOT_VERSION = "2.4.214"
 
 # Add src directory to Python path
 sys.path.insert(0, str(Path(__file__).parent / "src"))