// Quick test to verify the trade validation fix
const testTradeValidation = async () => {
  console.log('🧪 Testing trade validation with fixed amountUSD...')
  
  // Use port 9000 for Docker or 3001 for local dev
  const apiUrl = process.env.DOCKER_MODE ? 'http://localhost:9000' : 'http://localhost:3001'
  
  const tradeData = {
    symbol: 'USDCUSD',
    side: 'BUY', 
    amount: 5,
    amountUSD: 5, // This should be passed through correctly now
    useRealDEX: false, // Use simulation for testing
    tradingPair: 'USDCUSD/USDC'
  }
  
  console.log('🚀 Sending test trade to:', apiUrl)
  console.log('🚀 Trade data:', tradeData)
  
  try {
    const response = await fetch(`${apiUrl}/api/trading/execute-dex`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(tradeData)
    })
    
    const result = await response.json()
    
    console.log('📊 Response status:', response.status)
    console.log('📊 Response body:', result)
    
    if (response.ok) {
      console.log('✅ Trade validation fix is working!')
    } else {
      console.log('❌ Trade validation still has issues:', result.message)
    }
    
  } catch (error) {
    console.error('❌ Test failed:', error)
  }
}

testTradeValidation()
