- Extended getActualFillPriceFromTx() to also extract entry fill prices - openPosition() now uses actual fill from tx logs (was using oracle price) - closePosition() already fixed to use actual exit fills - Both prices now extracted via Drift SDK LogParser OrderActionRecord events - Eliminates ~0.08% entry and exit price discrepancies vs Drift UI - P&L calculations now 100% accurate to actual execution prices Files changed: - lib/drift/orders.ts (entry extraction in openPosition) - docs/COMMON_PITFALLS.md (updated Pitfall #89) Expected impact: Entry AND exit prices match Drift exactly on all future trades
48 KiB
48 KiB