Added comprehensive documentation per user request: 'is everything documentet
and pushed to git? nothing we forget to mention which is crucial for other
developers/agents?'
Updates:
- Common Pitfall #40: Added refactoring note (removed time-based Layer 1)
- User feedback: Time-based cleanup too aggressive for long-running positions
- Now 100% Drift API-based ghost detection (commit 9db5f85)
- Common Pitfall #41: Telegram notifications for position closures (NEW)
- Implemented lib/notifications/telegram.ts with sendPositionClosedNotification()
- Direct Telegram API calls (no n8n dependency)
- Includes P&L, prices, hold time, MAE/MFE, exit reason with emojis
- Integrated into Position Manager (commit b1ca454)
- Common Pitfall #42: Telegram bot DNS retry logic (NEW)
- Python urllib3 transient DNS failures (same as Node.js)
- Added retry_request() wrapper with exponential backoff
- 3 attempts (2s → 4s → 8s), matches Node.js retryOperation pattern
- Applied to /status and manual trade execution (commit bdf1be1)
- Common Pitfall #43: Drift account leverage UI requirement (NEW)
- Account leverage is on-chain setting, CANNOT be changed via API
- Must use Drift UI settings page
- Confusion: Order leverage dropdown ≠ account leverage setting
- Temporary workaround: Reduced position size to 6% for 1x leverage
- User action needed: Set account leverage to 15x in Drift UI
- Telegram Notifications section: Added to main architecture documentation
- Purpose, format, configuration, integration points
- Reference implementation details
Session focus: Ghost detection refactoring, Telegram notifications, DNS retry,
Drift leverage diagnostics. User emphasized knowledge preservation for future
developers and AI agents working on this codebase.