Commit Graph
3 Commits
Author SHA1 Message Date
cbazza d6ecc7605b Fix Telegram Bot - disable job_queue and fix event loop
Changes:
- Disable job_queue to avoid timezone/pytz error
- Fix event loop in background thread (use new_event_loop)
- Keep event loop running with run_forever()
- Add error handling in thread

Fixes: bot_thread was dying due to timezone error
Now: Thread stays alive and processes commands
2025-12-26 21:38:17 +01:00
cbazza 9475730769 Update Telegram Bot to v22.x API (fix import error)
Changes:
- Updated from python-telegram-bot 13.15 to 22.5
- Changed from sync API to async/await pattern
- Updated all command handlers to async
- Updated Application builder (new API)
- Fixed ModuleNotFoundError: No module named 'telegram'

Technical changes:
- Updater -> Application.builder()
- CommandHandler now uses async functions
- Context.DEFAULT_TYPE instead of CallbackContext
- await for all telegram API calls

Compatibility: python-telegram-bot 22.5 works with Python 3.12
2025-12-26 20:09:41 +01:00
cbazza 155ec1b524 Add Telegram Bot Commands - Remote Control Implementation
Features:
- Remote control via Telegram commands
- /status - Bot status, positions, balance
- /pause - Pause trading (no new trades)
- /resume - Resume trading
- /close - Close all positions (emergency)
- /balance - Account balance & equity
- /stats - Performance statistics
- /help - Command help

Integration:
- Integrated into notebook (cells 27-29)
- Wrapped execute_trade_v2_adaptive with pause check
- Background service running parallel to bot
- MT5 integration for positions & balance
- Database integration for stats

Safety:
- Only authorized chat ID can send commands
- /close requires confirmation
- Instant pause/resume

Files:
- telegram_bot_commands.py - Main implementation
- setup_telegram_bot.py - Setup & installation
- TELEGRAM_BOT_COMMANDS_GUIDE.md - Complete documentation
- Notebook updated with 3 new cells (27-29)

Expected Impact: High - Full remote control from mobile phone
2025-12-26 19:50:12 +01:00