import prisma from '../../../lib/prisma'
import { NextResponse } from 'next/server'

export async function GET() {
  try {
    const trades = await prisma.trade.findMany({
      orderBy: { executedAt: 'desc' },
      take: 50
    })
    return NextResponse.json(trades)
  } catch (e: any) {
    return NextResponse.json({ error: e.message }, { status: 500 })
  }
}
