PROBLEM (Nov 16, 22:03): - Ghost position closed with -$6.77 loss - Validator cleanup removed orders - Position existed on Drift with NO on-chain TP/SL - Only Position Manager software protection active - If bot crashes, position completely unprotected FIX: - Added restoreOrdersIfMissing() to startup validator - Checks every verified position for orders - Automatically places TP/SL if missing - Updates database with order transaction IDs BEHAVIOR: - Runs on every container startup - Validates all open positions - Logs: '✅ {symbol} has X on-chain orders' - Or: '⚠️ {symbol} has NO orders - restoring...' - Provides dual-layer protection always Impact: Eliminates unprotected position risk after validator cleanups, container restarts, or order issues.
11 KiB
11 KiB