diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 80abc3e..6ad37b7 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -994,10 +994,18 @@ ORDER BY MIN(adx) DESC; ## Common Pitfalls 1. **WRONG RPC PROVIDER (CRITICAL - CATASTROPHIC SYSTEM FAILURE):** - - **Symptom:** Trades hit SL immediately after opening, 239+ rate limit errors in 10 minutes, duplicate close attempts, Position Manager loses tracking, database save failures, TP1/TP2 never trigger correctly - - **Root Cause:** Helius free tier (10 req/sec sustained) is TOO LOW for trade execution + Position Manager monitoring - - **Fix:** Use Alchemy RPC (https://solana-mainnet.g.alchemy.com/v2/YOUR_API_KEY) - 300M compute units/month - - **Impact:** System went from completely broken to perfectly functional (TP1 → 70% close → runner → trailing stop all working) + - **UPDATED Nov 14, 2025:** Alchemy RPC is INCOMPATIBLE with Drift SDK despite high throughput + - **Symptom #1 (Helius free tier):** 239+ rate limit errors in 10 minutes, trades hit SL immediately, duplicate closes, Position Manager loses tracking + - **Symptom #2 (Alchemy):** 100+ accountSubscribe errors during init, SDK claims "initialized successfully" but hangs on subsequent calls, positions open WITHOUT TP/SL orders (no risk management), Position Manager doesn't track positions + - **Root Cause #1:** Helius free tier (10 req/sec sustained) TOO LOW for trade execution + Position Manager monitoring + - **Root Cause #2:** Alchemy RPC does NOT support WebSocket subscriptions (accountSubscribe method) which Drift SDK REQUIRES + - **CORRECT SOLUTION:** Use Helius RPC with proper rate limit handling (5s exponential backoff retries) + - **Why Helius:** Supports ALL Solana RPC methods including WebSocket subscriptions, Drift SDK functions correctly + - **Why NOT Alchemy:** Despite 10,000 CU/s throughput (Growth plan), lacks WebSocket support = Drift SDK malfunction + - **Impact:** With Helius + retries: System fully operational, TP1/TP2/SL work correctly, Position Manager tracks properly + - **Date discovered:** Nov 12, 2025 (Helius limits), Nov 14, 2025 (Alchemy incompatibility confirmed by user) + - **User quote:** "after changing back the settings it started to act up again" (referring to Alchemy) + - **Critical:** NEVER use RPC provider without WebSocket subscription support for Drift Protocol trading - **Date Fixed:** Nov 14, 2025 - Switched to Alchemy, EVERYTHING started working immediately - **Rule:** NEVER use Helius free tier for production trading - rate limits destroy trade execution - **Evidence:** First trade on Alchemy: ZERO rate limit errors, clean TP1 hit, runner activated successfully