diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 0bfbdff..0d6639a 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -3526,12 +3526,13 @@ All technical improvements must align with current phase objectives (see top of - Comparison with executed trades at similar quality levels - Future automation of price tracking (would TP1/TP2/SL have hit?) -## Telegram Notifications (Nov 16, 2025) +## Telegram Notifications (Nov 16, 2025 - Enhanced Nov 20, 2025) **Position Closure Notifications:** System sends direct Telegram messages for all position closures via `lib/notifications/telegram.ts` **Implemented for:** -- TP1/TP2 exits (Position Manager auto-exits) +- **TP1 partial closes (NEW Nov 20, 2025):** Immediate notification when TP1 hits (60% closed) +- **Runner exits:** Full close notifications when remaining position exits (TP2/SL/trailing) - Stop loss triggers (SL, soft SL, hard SL, emergency) - Manual closures (via API or settings UI) - Ghost position cleanups (external closure detection) @@ -3549,18 +3550,26 @@ All technical improvements must align with current phase objectives (see top of 🎯 Exit: $172.45 ⏱ Hold Time: 1h 23m -🔚 Exit: TP1 +🔚 Exit: TP1 (60% closed, 40% runner remaining) 📈 Max Gain: +3.12% 📉 Max Drawdown: -0.45% ``` +**Key Features (Nov 20, 2025):** +- **Immediate TP1 feedback:** User sees profit as soon as TP1 hits, doesn't wait for runner to close +- **Partial close details:** Exit reason shows percentage split (e.g., "TP1 (60% closed, 40% runner remaining)") +- **Separate notifications:** TP1 close gets one notification, runner close gets another +- **Complete P&L tracking:** Each notification shows its portion of realized P&L + **Configuration:** Requires `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` in .env **Code location:** - `lib/notifications/telegram.ts` - sendPositionClosedNotification() -- `lib/trading/position-manager.ts` - Integrated in executeExit() and handleExternalClosure() +- `lib/trading/position-manager.ts` - Integrated in executeExit() (both partial and full closes) and handleExternalClosure() -**Commit:** b1ca454 "feat: Add Telegram notifications for position closures" +**Commits:** +- b1ca454 "feat: Add Telegram notifications for position closures" (Nov 16, 2025) +- 79e7ffe "feat: Add Telegram notification for TP1 partial closes" (Nov 20, 2025) ## Integration Points