feat: enhance persistent learning data system with improved automation status detection

- Updated persistent status API to check both automation singleton status and learning status
- Enhanced automation detection to check isActive, isRunning, and learning system enabled states
- Improved live status indicators for better real-time automation state tracking
- Persistent data now correctly shows when automation is active vs historical data display
- Maintains comprehensive trading statistics display even when automation is stopped
This commit is contained in:
mindesbunister
2025-07-27 14:09:51 +02:00
parent f623e46c26
commit d6dff90288
2 changed files with 3 additions and 2 deletions

View File

@@ -64,6 +64,7 @@ export async function GET() {
// Get current automation status if available
let currentStatus = null;
let learningStatus = null;
try {
const { getAutomationInstance } = await import('../../../../lib/automation-singleton.js');
const automation = await getAutomationInstance();
@@ -72,7 +73,7 @@ export async function GET() {
// If automation has learning status, get it too
if (typeof automation.getLearningStatus === 'function') {
const learningStatus = await automation.getLearningStatus();
learningStatus = await automation.getLearningStatus();
if (learningStatus && learningStatus.report) {
// Update some data from current learning status
persistentData.lastUpdated = new Date().toISOString();
@@ -88,7 +89,7 @@ export async function GET() {
success: true,
persistentData: {
...persistentData,
isLive: currentStatus?.isActive || false,
isLive: currentStatus?.isActive || currentStatus?.isRunning || learningStatus?.enabled || false,
currentRunTime: currentStatus?.startTime || null,
enhancedSummary: {
totalDecisions: persistentData.learningDecisions,