mindesbunister
c9c987ab5d
feat: Extend smart validation timeout from 10 to 30 minutes
...
- Problem: Quality 70 signal with strong ADX 29.7 hit TP1 after 30+ minutes
- Analysis: 3/10 blocked signals hit TP1, most moves develop after 15-30 min
- Solution: Extended entryWindowMinutes from 10 → 30 minutes
- Expected impact: Catch more profitable moves like today's signal
- Missed opportunity: $22.10 profit at 10x leverage (0.41% move)
Files changed:
- lib/trading/smart-validation-queue.ts: Line 105 (10 → 30 min)
- lib/notifications/telegram.ts: Updated expiry message
Trade-off: May hold losing signals slightly longer, but -0.4% drawdown
limit provides protection. Data shows most TP1 hits occur after 15-30min.
Status: ✅ DEPLOYED Dec 7, 2025 10:30 CET
Container restarted and verified operational.
2025-12-07 13:01:20 +01:00
mindesbunister
302511293c
feat: Add production logging gating (Phase 1, Task 1.1)
...
- Created logger utility with environment-based gating (lib/utils/logger.ts)
- Replaced 517 console.log statements with logger.log (71% reduction)
- Fixed import paths in 15 files (resolved comment-trapped imports)
- Added DEBUG_LOGS=false to .env
- Achieves 71% immediate log reduction (517/731 statements)
- Expected 90% reduction in production when deployed
Impact: Reduced I/O blocking, lower log volume in production
Risk: LOW (easy rollback, non-invasive)
Phase: Phase 1, Task 1.1 (Quick Wins - Console.log Production Gating)
Files changed:
- NEW: lib/utils/logger.ts (production-safe logging)
- NEW: scripts/replace-console-logs.js (automation tool)
- Modified: 15 lib/*.ts files (console.log → logger.log)
- Modified: .env (DEBUG_LOGS=false)
Next: Task 1.2 (Image Size Optimization)
2025-12-05 00:32:41 +01:00
mindesbunister
7367673e4d
feat: Complete Smart Entry Validation System with Telegram notifications
...
Implementation:
- Smart validation queue monitors quality 50-89 signals
- Block & Watch strategy: queue → validate → enter if confirmed
- Validation thresholds: LONG +0.3% confirms / -0.4% abandons
- Validation thresholds: SHORT -0.3% confirms / +0.4% abandons
- Monitoring: Every 30 seconds for 10 minute window
- Auto-execution via API when price confirms direction
Telegram Notifications:
- ⏰ Queued: Alert when signal enters validation queue
- ✅ Confirmed: Alert when price validates entry (with slippage)
- ❌ Abandoned: Alert when price invalidates (saved from loser)
- ⏱️ Expired: Alert when 10min window passes without confirmation
- ✅ Executed: Alert when validated trade opens (with delay time)
Files:
- lib/trading/smart-validation-queue.ts (NEW - 460+ lines)
- lib/notifications/telegram.ts (added sendValidationNotification)
- app/api/trading/check-risk/route.ts (await async addSignal)
Integration:
- check-risk endpoint already queues signals (lines 433-452)
- Startup initialization already exists
- Market data cache provides 1-min price updates
Expected Impact:
- Recover 77% of moves from quality 50-89 false negatives
- Example: +1.79% move → entry at +0.41% → capture +1.38%
- Protect from weak signals that fail validation
- User visibility into validation activity via Telegram
Status: READY FOR DEPLOYMENT
2025-11-30 23:48:36 +01:00
mindesbunister
702d08b0ba
feat: Integrate ADX validation into revenge system using 1-min market data
...
ENHANCEMENTS:
- Revenge system now checks fresh ADX from 1-minute market data cache
- Blocks revenge if ADX < 20 (weak trend - not worth re-entering)
- Executes revenge if ADX >= 20 (strong trend - high probability)
- Saves revengeFailedReason='ADX_TOO_LOW_X.X' for blocked attempts
- Telegram notification shows ADX check result
DATABASE:
- Added revengeFailedReason field to StopHunt table
- Added revengePnL field to track revenge trade outcomes
INTEGRATION:
- Uses getPythPriceMonitor().getCachedPrice() for fresh data
- Falls back to originalADX if cache unavailable
- Logs ADX validation: 'ADX check: X.X (threshold: 20)'
1-MINUTE DATA COLLECTION COMPLETE:
- TradingView alerts recreated with new format
- Bot correctly filters timeframe='1' → BlockedSignal
- Market data cache updates every 60 seconds
- Verified working: 2 signals collected, 0 trades executed
2025-11-27 10:16:59 +01:00
mindesbunister
ca7b49f745
feat: Add automated profit withdrawal system
...
- UI page: /withdrawals with stats dashboard and config form
- Settings API: GET/POST for .env configuration
- Stats API: Real-time profit and withdrawal calculations
- Execute API: Safe withdrawal with Drift SDK integration
- Drift service: withdrawFromDrift() with USDC spot market (index 0)
- Safety checks: Min withdrawal amount, min account balance, profit-only
- Telegram notifications: Withdrawal alerts with Solscan links
- Dashboard navigation: Added Withdrawals card (3-card grid)
User goal: 10% of profits automatically withdrawn on schedule
Current: Manual trigger ready, scheduled automation pending
Files: 5 new (withdrawals page, 3 APIs, Drift service), 2 modified
2025-11-19 18:07:07 +01:00
mindesbunister
b1ca454a6f
feat: Add Telegram notifications for position closures
...
Implemented direct Telegram notifications when Position Manager closes positions:
- New helper: lib/notifications/telegram.ts with sendPositionClosedNotification()
- Integrated into Position Manager's executeExit() for all closure types
- Also sends notifications for ghost position cleanups
Notification includes:
- Symbol, direction, entry/exit prices
- P&L amount and percentage
- Position size and hold time
- Exit reason (TP1, TP2, SL, manual, ghost cleanup, etc.)
- MAE/MFE stats (max gain/drawdown during trade)
User request: Receive P&L notifications on position closures via Telegram bot
Previously: Only opening notifications via n8n workflow
Now: All closures (TP/SL/manual/ghost) send notifications directly
2025-11-16 00:51:56 +01:00