ROOT CAUSE: placePerpOrder() only places orders on Drift order book, doesn't fill. SOLUTION: placeAndTakePerpOrder() places AND matches against makers atomically. Real Incident (Dec 31, 2025): - Dec 30 18:17: SHORT opened at $124.36 - Dec 31 00:30: LONG signal received - should flip position - Transaction confirmed but Solscan showed 'Place' not 'Fill' - Position remained open, eventually hit SL twice - Total loss: ~$40.21 Files changed: - lib/drift/orders.ts (line 662): placePerpOrder → placeAndTakePerpOrder - docs/COMMON_PITFALLS.md: Added Bug #90 documentation Deployment: Dec 31, 2025 11:38 CET (container trading-bot-v4)
40 KiB
40 KiB