Add TP1/SL consistency check on trade restore
This commit is contained in:
30
scripts/debug-open-trades.ts
Normal file
30
scripts/debug-open-trades.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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('Open trades:', openTrades.map(t => ({
|
||||
id: t.id,
|
||||
symbol: t.symbol,
|
||||
direction: t.direction,
|
||||
status: t.status,
|
||||
entryPrice: t.entryPrice,
|
||||
exitPrice: t.exitPrice,
|
||||
exitReason: t.exitReason,
|
||||
realizedPnL: t.realizedPnL,
|
||||
createdAt: t.entryTime,
|
||||
exitTime: t.exitTime,
|
||||
})))
|
||||
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
Reference in New Issue
Block a user