Features Added: Analysis Timer: Shows countdown to next analysis with progress bar Individual Timeframe Results: Display analysis for each timeframe separately Real-time Countdown: Updates every second showing time until next analysis Enhanced Status API: Includes timing data and individual results Cycle Counter: Shows current automation cycle number UI Improvements: - Analysis Timer panel with countdown and progress bar - Individual Timeframe Analysis panel showing recommendation and confidence for each timeframe - Real-time updates of countdown timer - Visual indicators for BUY/SELL/HOLD recommendations - Analysis interval display (15m/1h/etc) Technical Changes: - Enhanced AutomationService with timing tracking - Added nextAnalysisIn, analysisInterval, currentCycle to status - Individual timeframe results stored and displayed - Real-time countdown effect in React - Progress bar visualization of analysis cycle - Enhanced status API endpoint with automation service integration Example Display: 15m analysis: SELL (80% confidence) 1h analysis: HOLD (65% confidence) Next Analysis In: 14m 32s [Progress Bar] Cycle #5 | Analysis Interval: 15m
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import { NextResponse } from 'next/server'
|
|
import { automationService } from '../../../../lib/automation-service-simple'
|
|
|
|
export async function GET() {
|
|
try {
|
|
// Get status from the automation service directly (includes timing and individual results)
|
|
const status = await automationService.getStatus()
|
|
|
|
if (!status) {
|
|
return NextResponse.json({
|
|
success: true,
|
|
status: {
|
|
isActive: false,
|
|
mode: 'SIMULATION',
|
|
symbol: 'SOLUSD',
|
|
timeframe: '1h',
|
|
totalTrades: 0,
|
|
successfulTrades: 0,
|
|
winRate: 0,
|
|
totalPnL: 0,
|
|
errorCount: 0,
|
|
nextAnalysisIn: 0,
|
|
analysisInterval: 3600,
|
|
currentCycle: 0,
|
|
individualTimeframeResults: []
|
|
}
|
|
})
|
|
}
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
status: status
|
|
})
|
|
} catch (error) {
|
|
console.error('Automation status error:', error)
|
|
return NextResponse.json({
|
|
success: false,
|
|
error: 'Failed to get automation status'
|
|
}, { status: 500 })
|
|
}
|
|
}
|