feat: implement complete automation system with real trading connection
This commit is contained in:
31
app/api/automation/recent-trades/route.js
Normal file
31
app/api/automation/recent-trades/route.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const trades = await prisma.trade.findMany({
|
||||
where: {
|
||||
userId: 'default-user',
|
||||
isAutomated: true
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc'
|
||||
},
|
||||
take: 10
|
||||
})
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
trades
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Get recent trades error:', error)
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
error: 'Internal server error',
|
||||
message: error.message
|
||||
}, { status: 500 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user