fix: Resolve win rate and P&L discrepancies between Status and AI Learning sections
- Fixed analysis-details API to use stored profit field as fallback when exit prices missing - Updated UI to use Status API data instead of calculating from limited recent trades - Modified AI Learning Status to use real database trade data instead of demo numbers - Enhanced price monitor with automatic trade closing logic for TP/SL hits - Modified automation service to create trades with OPEN status for proper monitoring - Added test scripts for creating OPEN trades and validating monitoring system Key changes: - Status section now shows accurate 50% win rate from complete database - AI Learning Status shows consistent metrics based on real trading performance - Both sections display same correct P&L (8.62) from actual trade results - Real-time price monitor properly detects and tracks OPEN status trades - Fixed trade lifecycle: OPEN → monitoring → COMPLETED when TP/SL hit All trading performance metrics now display consistent, accurate data from the same source.
This commit is contained in:
@@ -726,7 +726,7 @@ ${validResults.map(r => `• ${r.timeframe}: ${r.analysis?.recommendation} (${r.
|
||||
executionPrice,
|
||||
amount: decision.positionSize,
|
||||
direction: decision.direction,
|
||||
status: 'COMPLETED',
|
||||
status: 'OPEN', // Trades start as OPEN, not COMPLETED
|
||||
timestamp: new Date(),
|
||||
fees: decision.positionSize * 0.001, // 0.1% fee
|
||||
slippage: slippage * 100
|
||||
|
||||
Reference in New Issue
Block a user