import { NextResponse } from 'next/server' export async function POST(request) { try { const body = await request.json() // Simple trade calculation for testing const { amount, leverage = 1, price = 100 } = body const calculation = { amount: parseFloat(amount) || 0, leverage: parseInt(leverage) || 1, price: parseFloat(price) || 100, positionSize: (parseFloat(amount) || 0) * (parseInt(leverage) || 1), marginRequired: (parseFloat(amount) || 0), timestamp: new Date().toISOString() } return NextResponse.json({ success: true, calculation }) } catch (error) { console.error('Trade calculation error:', error) return NextResponse.json( { error: 'Failed to calculate trade' }, { status: 500 } ) } } export async function GET() { return NextResponse.json({ message: 'Trade calculation endpoint', methods: ['POST'], parameters: ['amount', 'leverage', 'price'] }) }