fix: correct entry prices and position sizing in trading system
- Fixed automation service to use real SOL price (~89) instead of hardcoded 00 - Updated position size calculation to properly convert USD investment to token amount - Enhanced trade display to show separate entry/exit prices with price difference - Added data quality warnings for trades with missing exit data - Updated API to use current SOL price (189.50) and improved trade result determination - Added detection and warnings for old trades with incorrect price data Resolves issue where trades showed 9-100 entry prices instead of real SOL price of 89 and position sizes of 2.04 SOL instead of correct ~0.53 SOL for 00 investment
This commit is contained in:
@@ -67,6 +67,14 @@ export async function GET(request) {
|
||||
take: 5
|
||||
})
|
||||
|
||||
// Get actual total trades count for consistency
|
||||
const totalTradesCount = await prisma.trade.count({
|
||||
where: {
|
||||
userId: 'default-user',
|
||||
symbol: symbol
|
||||
}
|
||||
})
|
||||
|
||||
// Get recent market context
|
||||
const allTrades = await prisma.trade.findMany({
|
||||
where: {
|
||||
@@ -103,7 +111,7 @@ export async function GET(request) {
|
||||
marketContext: {
|
||||
recentPnL,
|
||||
winRate: winRate.toFixed(1),
|
||||
totalTrades: allTrades.length,
|
||||
totalTrades: totalTradesCount, // Use actual total count
|
||||
avgProfit: allTrades.length > 0 ? (recentPnL / allTrades.length).toFixed(2) : 0,
|
||||
trend: sessions.length > 0 ? sessions[0].lastAnalysisData?.sentiment : 'NEUTRAL'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user