Files
trading_bot_v4/lib/startup
mindesbunister 8163858b0d fix: Correct entry price when restoring orphaned positions from Drift
- Startup validation now updates entryPrice to match Drift's actual value
- Prevents tracking with wrong entry price after container restarts
- Also updates positionSizeUSD to reflect current position (runner after TP1)

Bug: When reopening closed trades found on Drift, used stale DB entry price
Result: Stop loss calculated from wrong entry (41.51 vs actual 41.31)
Impact: 0.14% difference in SL placement (~$0.20 per SOL)

Fix: Query Drift for real entry price and update DB during restoration
Files: lib/startup/init-position-manager.ts
2025-11-15 11:16:05 +01:00
..