Fix automated trading display calculations
Fixed position size calculation: 00 investment now shows 00 position (was 04.76) Fixed token amount display: Now shows correct tokens (~0.996) for 00 investment (was 2.04) Corrected API route: /api/automation/analysis-details now returns 200 instead of 405 Technical changes: - Updated route calculation logic: tradingAmount / trade.price for correct token amounts - Fixed displayPositionSize to show intended investment amount - Used Docker Compose v2 for container management - Resolved Next.js module export issues The API now correctly displays trade details matching user investment intentions.
This commit is contained in:
58
check-database.js
Normal file
58
check-database.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const { PrismaClient } = require('@prisma/client')
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function checkDatabase() {
|
||||
try {
|
||||
console.log('=== DATABASE VERIFICATION ===')
|
||||
|
||||
// Count total trades
|
||||
const totalTrades = await prisma.trade.count()
|
||||
console.log(`Total trades in database: ${totalTrades}`)
|
||||
|
||||
// Get all trades with details
|
||||
const allTrades = await prisma.trade.findMany({
|
||||
orderBy: { createdAt: 'desc' }
|
||||
})
|
||||
|
||||
console.log('\n=== ALL TRADES ===')
|
||||
allTrades.forEach((trade, index) => {
|
||||
console.log(`\nTrade ${index + 1}:`)
|
||||
console.log(` ID: ${trade.id}`)
|
||||
console.log(` Symbol: ${trade.symbol}`)
|
||||
console.log(` Side: ${trade.side}`)
|
||||
console.log(` Amount: ${trade.amount}`)
|
||||
console.log(` Price: ${trade.price}`)
|
||||
console.log(` Status: ${trade.status}`)
|
||||
console.log(` Created: ${trade.createdAt}`)
|
||||
console.log(` Profit: ${trade.profit}`)
|
||||
console.log(` Confidence: ${trade.confidence}`)
|
||||
})
|
||||
|
||||
// Check automation sessions
|
||||
const totalSessions = await prisma.automationSession.count()
|
||||
console.log(`\n=== AUTOMATION SESSIONS ===`)
|
||||
console.log(`Total sessions: ${totalSessions}`)
|
||||
|
||||
const sessions = await prisma.automationSession.findMany({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 5
|
||||
})
|
||||
|
||||
sessions.forEach((session, index) => {
|
||||
console.log(`\nSession ${index + 1}:`)
|
||||
console.log(` ID: ${session.id}`)
|
||||
console.log(` Symbol: ${session.symbol}`)
|
||||
console.log(` Timeframe: ${session.timeframe}`)
|
||||
console.log(` Status: ${session.status}`)
|
||||
console.log(` Created: ${session.createdAt}`)
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error checking database:', error)
|
||||
} finally {
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
checkDatabase()
|
||||
Reference in New Issue
Block a user