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