|
@@ -123,20 +123,23 @@ class BotManager:
|
|
|
|
|
|
def check_stats_persistence(self):
|
|
|
"""Check and report on statistics persistence."""
|
|
|
- stats_file = "data/trading_stats.json"
|
|
|
- if os.path.exists(stats_file):
|
|
|
+
|
|
|
+ self.logger.info("📊 Checking statistics persistence...")
|
|
|
+ sqlite_file = "data/trading_stats.sqlite"
|
|
|
+ if os.path.exists(sqlite_file):
|
|
|
try:
|
|
|
+
|
|
|
stats = TradingStats()
|
|
|
basic_stats = stats.get_basic_stats()
|
|
|
- total_trades = basic_stats.get('total_trades_count', basic_stats.get('total_trades', 0))
|
|
|
- start_date = basic_stats.get('start_date_formatted', basic_stats.get('start_date', 'unknown'))
|
|
|
- self.logger.info(f"📊 Existing stats found - {total_trades} trades since {start_date}")
|
|
|
+ total_trades = basic_stats.get('total_trades', 0)
|
|
|
+ start_date = basic_stats.get('start_date', 'unknown')
|
|
|
+ self.logger.info(f"📊 Existing SQLite database found - {total_trades} trades since {start_date}")
|
|
|
return True
|
|
|
except Exception as e:
|
|
|
- self.logger.warning(f"⚠️ Stats file {stats_file} exists but couldn't load: {e}")
|
|
|
+ self.logger.warning(f"⚠️ SQLite database {sqlite_file} exists but couldn't load: {e}")
|
|
|
return False
|
|
|
else:
|
|
|
- self.logger.info(f"📊 No existing stats file at {stats_file} - will create new tracking from launch")
|
|
|
+ self.logger.info(f"📊 No existing SQLite database at {sqlite_file} - will create new tracking from launch")
|
|
|
return False
|
|
|
|
|
|
async def run_bot(self):
|