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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user