Commit Graph

3 Commits

Author SHA1 Message Date
mindesbunister
d38511f580 feat: fix orphaned order detection and enhance automation UI
- Fixed Drift orders API to handle new object-based status format
- Updated cleanup API to properly detect orphaned TAKE PROFIT orders
- Changed status filtering from order.status === 0 to order.status.hasOwnProperty('open')

- Restored automation-v2 page with emergency stop functionality
- Added position monitor integration with real-time cleanup status
- Enhanced UI with emoji indicators and better status display
- Added emergency stop API endpoint for immediate trading halt

- Enhanced orphaned order detection for lingering SL/TP orders
- Added comprehensive debug logging for order processing
- Improved error handling and status reporting
- Real-time cleanup reporting in position monitor

 Verified working:
- Orders API correctly detects active orders with new Drift format
- Cleanup system successfully processes orphaned orders
- Position monitor shows accurate cleanup status
- Emergency stop functionality integrated
2025-07-26 20:07:40 +02:00
mindesbunister
dab10868aa Fix: Re-enable browser cleanup to prevent Chromium resource exhaustion
- Re-enabled cleanup logic in enhanced-screenshot API after screenshot/analysis completion
- Run cleanup in background to avoid blocking responses
- Prevents Chromium processes from spawning indefinitely and consuming resources during automation
2025-07-22 19:50:20 +02:00
mindesbunister
9e93bacdf2 Fix position sizing and stop loss placement issues
- Fixed insufficient collateral error by implementing proper position sizing
- Added balance fetching before trade decisions for accurate calculations
- Implemented minimum order size enforcement (0.01 SOL for Drift)
- Improved stop loss placement with 2% minimum risk and better error logging
- Enhanced risk management with conservative slippage buffers
- Fixed 'Order Amount Too Small' errors by ensuring minimum order requirements

Position sizing now:
- Uses actual Drift account balance (5.69)
- Calculates appropriate position size based on risk percentage
- Ensures minimum 0.01 SOL order size for Drift compatibility
- Provides detailed calculation logging for debugging
2025-07-22 17:29:41 +02:00