Files
trading_bot_v3/app/api/automation
mindesbunister fd25f4c8e9 feat: implement automation restart and trade recording systems
- Added auto-restart detection in position monitor
  - Triggers when no position + START_TRADING recommendation
  - Provides autoRestart status for UI integration
  - Enables automatic new cycle initiation after cleanup

- Implemented real trade recording in position history API
  - Fetches completed trades from database for AI learning
  - Filters out simulation trades (excludes SIM_ prefix)
  - Records automated trade outcomes for learning enhancement
  - Provides accurate statistics for AI system

- Enhanced trade recording with proper P&L calculation
  - Records recent closed positions automatically
  - Calculates win/loss outcomes based on price movement
  - Integrates with existing automation decision tracking

Resolves: No new cycle after cleanup + Missing trade data for AI learning
System now properly restarts and records real trading history for learning.
2025-07-28 18:06:23 +02:00
..