- 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
6.0 KiB
6.0 KiB