// Create a test open trade to demonstrate real-time monitoring const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() async function createTestOpenTrade() { try { const currentPrice = 190.50 // Simulated SOL price const stopLoss = currentPrice * 0.98 // 2% below entry const takeProfit = currentPrice * 1.06 // 6% above entry const trade = await prisma.trade.create({ data: { userId: 'default-user', symbol: 'SOLUSD', side: 'BUY', amount: 0.5263, // ~$100 position price: currentPrice, entryPrice: currentPrice, status: 'OPEN', // This is the key - OPEN status for monitoring stopLoss: stopLoss, takeProfit: takeProfit, leverage: 1, isAutomated: true, tradingMode: 'SIMULATION', confidence: 85, marketSentiment: 'BULLISH', timeframe: '1h', createdAt: new Date() } }) console.log('✅ Created test open trade:', { id: trade.id.slice(-8), symbol: trade.symbol, side: trade.side, entryPrice: trade.entryPrice, stopLoss: trade.stopLoss, takeProfit: trade.takeProfit, status: trade.status }) console.log('📊 Price monitor should now detect this trade and start monitoring it!') console.log('💡 Check the automation page - it should show under "Active Trades Monitor"') } catch (error) { console.error('❌ Error creating test trade:', error) } finally { await prisma.$disconnect() } } createTestOpenTrade()