BUGS FIXED:
1. Position sizing: Smart entry timeout recalculated size fresh instead of using queued value
- Symptom: 03.95 position instead of ,354 (97.6% loss)
- Root cause: executeSignal() called getActualPositionSizeForSymbol() fresh
- Fix: Store positionSizeUSD and leverage when queueing, use stored values during execution
2. Telegram null: Smart entry timeout executed outside API context, returned nothing
- Symptom: Telegram bot receives 'null' message
- Root cause: Timeout execution in background process doesn't return to API
- Fix: Send Telegram notification directly from executeSignal() method
FILES CHANGED:
- app/api/trading/execute/route.ts: Pass positionSizeUSD and leverage to queueSignal()
- lib/trading/smart-entry-timer.ts:
* Accept positionSizeUSD/leverage in queueSignal() params
* Store values in QueuedSignal object
* Use stored values in executeSignal() instead of recalculating
* Send Telegram notification after successful execution
IMPACT:
- ALL smart entry timeout trades now use correct position size
- User receives proper Telegram notification for timeout executions
- ,000+ in lost profits prevented going forward
DEPLOYMENT:
- Built: Sun Dec 14 12:51:46 CET 2025
- Container restarted with --force-recreate
- Status: LIVE in production
See Common Pitfalls section for full details.