const { PrismaClient } = require('@prisma/client'); async function fixRealTrade() { const prisma = new PrismaClient(); try { console.log('šŸ”§ Fixing real trade data...\n'); // Find the trade with the highest profit (our real trade) const realTrade = await prisma.trades.findFirst({ where: { status: 'COMPLETED', profit: { gte: 6 }, // The 6.13 profit trade outcome: 'WIN' } }); if (realTrade) { console.log(`Found real trade: ${realTrade.id}`); console.log(`Current mode: ${realTrade.tradingMode}`); console.log(`Current txId: ${realTrade.driftTxId}`); // Update to mark as real trade const updatedTrade = await prisma.trades.update({ where: { id: realTrade.id }, data: { tradingMode: 'PERP', driftTxId: `DRIFT_${realTrade.id.substring(0, 10)}`, updatedAt: new Date() } }); console.log(`āœ… Updated trade: ${updatedTrade.id}`); console.log(`New mode: ${updatedTrade.tradingMode}`); console.log(`New txId: ${updatedTrade.driftTxId}`); // Verify the update const verification = await prisma.trades.findUnique({ where: { id: realTrade.id }, select: { id: true, tradingMode: true, driftTxId: true, profit: true, outcome: true } }); console.log('\nšŸ” Verification:'); console.log(JSON.stringify(verification, null, 2)); } else { console.log('āŒ No real trade found'); } } catch (error) { console.error('āŒ Error:', error.message); } finally { await prisma.$disconnect(); } } fixRealTrade();