Files
trading_bot_v4/scripts/debug-open-trades.mjs
2025-11-06 12:18:31 +01:00

33 lines
686 B
JavaScript

import { getPrismaClient } from '../lib/database/trades'
async function main() {
const prisma = getPrismaClient()
const openTrades = await prisma.trade.findMany({
where: { status: { not: 'closed' } },
orderBy: { entryTime: 'desc' },
take: 10,
})
console.log(
openTrades.map(t => ({
id: t.id,
symbol: t.symbol,
direction: t.direction,
status: t.status,
entryPrice: t.entryPrice,
exitPrice: t.exitPrice,
realizedPnL: t.realizedPnL,
exitReason: t.exitReason,
entryTime: t.entryTime,
exitTime: t.exitTime,
}))
)
process.exit(0)
}
main().catch(err => {
console.error(err)
process.exit(1)
})