Fix automated trading display calculations

Fixed position size calculation: 00 investment now shows 00 position (was 04.76)
 Fixed token amount display: Now shows correct tokens (~0.996) for 00 investment (was 2.04)
 Corrected API route: /api/automation/analysis-details now returns 200 instead of 405

Technical changes:
- Updated route calculation logic: tradingAmount / trade.price for correct token amounts
- Fixed displayPositionSize to show intended investment amount
- Used Docker Compose v2 for container management
- Resolved Next.js module export issues

The API now correctly displays trade details matching user investment intentions.
This commit is contained in:
mindesbunister
2025-07-20 22:32:16 +02:00
parent 6ce4f364a9
commit 55cea00e5e
22 changed files with 1180 additions and 189 deletions

View File

@@ -0,0 +1,63 @@
// API endpoint for monitoring browser processes and cleanup status
import { NextResponse } from 'next/server'
export async function GET() {
try {
console.log('📊 System process monitoring request...')
// Import cleanup service
const { default: aggressiveCleanup } = await import('../../../../lib/aggressive-cleanup')
const { progressTracker } = await import('../../../../lib/progress-tracker')
// Get process information
await aggressiveCleanup.getProcessInfo()
// Get active sessions
const activeSessions = progressTracker.getActiveSessions()
const sessionDetails = activeSessions.map(sessionId => {
const progress = progressTracker.getProgress(sessionId)
return {
sessionId,
currentStep: progress?.currentStep || 0,
totalSteps: progress?.totalSteps || 0,
activeStep: progress?.steps.find(step => step.status === 'active')?.title || 'Unknown'
}
})
return NextResponse.json({
success: true,
timestamp: Date.now(),
activeSessions: sessionDetails,
message: 'Process information logged to console'
})
} catch (error) {
console.error('Error in process monitoring:', error)
return NextResponse.json({
success: false,
error: error.message
}, { status: 500 })
}
}
export async function POST() {
try {
console.log('🧹 Manual aggressive cleanup triggered...')
// Import cleanup service
const { default: aggressiveCleanup } = await import('../../../../lib/aggressive-cleanup')
// Run aggressive cleanup
await aggressiveCleanup.runPostAnalysisCleanup()
return NextResponse.json({
success: true,
message: 'Aggressive cleanup completed'
})
} catch (error) {
console.error('Error in manual aggressive cleanup:', error)
return NextResponse.json({
success: false,
error: error.message
}, { status: 500 })
}
}