docs: Add Bug #91 to COMMON_PITFALLS.md and copilot-instructions.md
Bug #91: Math.floor truncation leaves fractional position remnants - Root cause: new BN(Math.floor(sizeToClose * 1e9)) truncates position sizes - Solution: SDK's closePosition() uses exact BN arithmetic (baseAssetAmount.abs()) - Added to Quick Reference Table in COMMON_PITFALLS.md - Added full documentation entry (~70 lines) - Updated Top 10 Critical Pitfalls in copilot-instructions.md - Replaced #75 (Wrong Year) with #91 (more impactful to trading operations)
This commit is contained in:
2
.github/copilot-instructions.md
vendored
2
.github/copilot-instructions.md
vendored
@@ -879,7 +879,7 @@ docs/COMMON_PITFALLS.md
|
||||
1. **Position Manager Never Monitors (#77)** - Logs say "added" but isMonitoring=false = $1,000+ losses
|
||||
2. **Silent SL Placement Failure (#76)** - placeExitOrders() returns SUCCESS with 2/3 orders, no SL protection
|
||||
3. **Orphan Cleanup Removes Active Orders (#78)** - cancelAllOrders() affects ALL positions on symbol
|
||||
4. **Wrong Year in SQL Queries (#75)** - Query 2024 dates when current is 2025 = 12× inflated results
|
||||
4. **Math.floor Truncation in Position Close (#91)** - Leaves fractional remnants → Use SDK closePosition()
|
||||
5. **Drift SDK Memory Leak (#1)** - JS heap OOM after 10+ hours → Smart health monitoring
|
||||
6. **Wrong RPC Provider (#2)** - Alchemy breaks Drift SDK → Use Helius only
|
||||
7. **P&L Compounding Race Condition (#48, #49, #61)** - Multiple closures → Atomic Map.delete()
|
||||
|
||||
Reference in New Issue
Block a user