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:
@@ -1,10 +1,27 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import { automationService } from '@/lib/automation-service-simple'
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
export async function POST() {
|
||||
try {
|
||||
// Stop the automation service
|
||||
const success = await automationService.stopAutomation()
|
||||
|
||||
// Also update all active automation sessions in database to INACTIVE
|
||||
await prisma.automationSession.updateMany({
|
||||
where: {
|
||||
status: 'ACTIVE'
|
||||
},
|
||||
data: {
|
||||
status: 'INACTIVE',
|
||||
updatedAt: new Date()
|
||||
}
|
||||
})
|
||||
|
||||
console.log('🛑 All automation sessions marked as INACTIVE in database')
|
||||
|
||||
if (success) {
|
||||
return NextResponse.json({ success: true, message: 'Automation stopped successfully' })
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user