diff --git a/app/api/automation/analysis-details/route.js b/app/api/automation/analysis-details/route.js index ee9b51c..443eeac 100644 --- a/app/api/automation/analysis-details/route.js +++ b/app/api/automation/analysis-details/route.js @@ -33,6 +33,9 @@ export async function GET() { id: 'demo-trade-1', side: 'BUY', amount: 1.5, + tradingAmount: 250, // Trading amount in USD + leverage: 5, // 5x leverage + positionSize: 1250, // Total position size (tradingAmount * leverage) price: 174.25, status: 'OPEN', profit: null, @@ -76,6 +79,9 @@ export async function GET() { id: 'demo-trade-2', side: 'SELL', amount: 2.04, + tradingAmount: 180, // Trading amount in USD + leverage: 3, // 3x leverage + positionSize: 540, // Total position size (tradingAmount * leverage) price: 176.88, status: 'COMPLETED', profit: 3.24, @@ -117,6 +123,9 @@ export async function GET() { id: 'demo-trade-3', side: 'BUY', amount: 1.8, + tradingAmount: 300, // Trading amount in USD + leverage: 4, // 4x leverage + positionSize: 1200, // Total position size (tradingAmount * leverage) price: 173.15, status: 'COMPLETED', profit: -1.89, @@ -153,6 +162,50 @@ export async function GET() { timeBasedExit: false, analysisInvalidated: true } + }, + { + id: 'demo-trade-4', + side: 'SELL', + amount: 1.2, + tradingAmount: 150, // Trading amount in USD + leverage: 2, // 2x leverage + positionSize: 300, // Total position size (tradingAmount * leverage) + price: 175.90, + status: 'COMPLETED', + profit: 1.86, + createdAt: new Date(Date.now() - 6 * 60 * 60 * 1000).toISOString(), // 6 hours ago + aiAnalysis: 'SELL signal with 81% confidence - Bearish momentum confirmed', + stopLoss: 177.20, + takeProfit: 174.35, + confidence: 81, + // Enhanced analysis context + triggerAnalysis: { + decision: 'SELL', + confidence: 81, + timeframe: '1h', + keySignals: ['Bearish engulfing pattern', 'Volume spike on rejection', 'RSI divergence'], + marketCondition: 'Strong bearish momentum', + riskReward: '1:1.2', + invalidationLevel: 177.50 + }, + // Exit metrics + exitMetrics: { + exitPrice: 174.35, + exitReason: 'Take profit hit', + timeInTrade: '52 minutes', + maxUnrealizedPnL: 2.10, + maxDrawdown: -0.42, + analysisAccuracy: 'Good - TP hit with minor slippage', + actualRiskReward: '1:1.2' + }, + // Exit conditions + exitConditions: { + stopLossHit: false, + takeProfitHit: true, + manualExit: false, + timeBasedExit: false, + analysisInvalidated: false + } } ] @@ -268,6 +321,9 @@ export async function GET() { type: trade.type || 'MARKET', side: trade.side, amount: trade.amount, + tradingAmount: trade.tradingAmount || 100, // Default to $100 if not specified + leverage: trade.leverage || 1, // Default to 1x leverage if not specified + positionSize: trade.positionSize || (trade.tradingAmount || 100) * (trade.leverage || 1), price: trade.price, status: trade.status, pnl: trade.profit, diff --git a/app/automation/page.js b/app/automation/page.js index 7e69e90..25db910 100644 --- a/app/automation/page.js +++ b/app/automation/page.js @@ -589,6 +589,7 @@ export default function AutomationPage() { {trade.side} {trade.amount} + {trade.leverage}x + {/* Trading Details */} + + + + Trading Amount: + ${trade.tradingAmount} + + + Leverage: + {trade.leverage}x + + + Position Size: + ${trade.positionSize} + + + Entry Price: + ${trade.entryPrice.toFixed(2)} + + + + {/* Analysis Context */} {trade.triggerAnalysis && ( @@ -693,7 +716,7 @@ export default function AutomationPage() { {/* Trade Summary */} - {trade.duration} + {trade.duration} | ${trade.tradingAmount} @ {trade.leverage}x diff --git a/prisma/prisma/dev.db b/prisma/prisma/dev.db index e8066dc..be905c4 100644 Binary files a/prisma/prisma/dev.db and b/prisma/prisma/dev.db differ