Add persistent learning data and PnL display

- Created persistent learning status API with trading statistics
- Added comprehensive PnL and win rate display to AI Learning panel
- Implemented trading stats tracking with win/loss ratios
- Added persistent data storage for historical trading performance
- Enhanced learning panel with real-time trading metrics
- Fixed learning data visibility when bot is not running
- Added sample trading data for demonstration
This commit is contained in:
mindesbunister
2025-07-27 13:57:52 +02:00
parent 7752463b9f
commit f623e46c26
4 changed files with 460 additions and 234 deletions

View File

@@ -0,0 +1,53 @@
{
"totalTrades": 47,
"winningTrades": 28,
"losingTrades": 19,
"totalPnL": 342.75,
"winRate": 59.57,
"avgWinAmount": 18.45,
"avgLossAmount": -12.30,
"bestTrade": 89.50,
"worstTrade": -35.20,
"learningDecisions": 156,
"aiEnhancements": 23,
"riskThresholds": {
"emergency": 3,
"risk": 5,
"mediumRisk": 8
},
"lastUpdated": "2025-07-27T10:45:00.000Z",
"systemStatus": "learning",
"dataCollected": true,
"recentTrades": [
{
"id": "trade_1753612001_abc123",
"symbol": "SOLUSD",
"type": "LONG",
"entry": 186.45,
"exit": 189.20,
"pnl": 15.75,
"outcome": "WIN",
"timestamp": "2025-07-27T09:30:00.000Z"
},
{
"id": "trade_1753612002_def456",
"symbol": "SOLUSD",
"type": "LONG",
"entry": 184.80,
"exit": 182.15,
"pnl": -8.95,
"outcome": "LOSS",
"timestamp": "2025-07-27T08:15:00.000Z"
},
{
"id": "trade_1753612003_ghi789",
"symbol": "SOLUSD",
"type": "LONG",
"entry": 187.30,
"exit": 195.80,
"pnl": 42.50,
"outcome": "WIN",
"timestamp": "2025-07-27T07:45:00.000Z"
}
]
}