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
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
# ==========================================
|
||||
# TELEGRAM BOT COMMANDS - Background Service
|
||||
# ==========================================
|
||||
|
||||
from telegram_bot_commands import TelegramBotCommander, get_bot_controller
|
||||
import threading
|
||||
|
||||
# Start Telegram Bot in background
|
||||
try:
|
||||
print("🚀 Starting Telegram Bot Commander...")
|
||||
|
||||
bot_commander = TelegramBotCommander()
|
||||
bot_thread = bot_commander.start_background()
|
||||
|
||||
# Get controller for integration with execute_trade
|
||||
bot_controller = get_bot_controller()
|
||||
|
||||
print("✅ Telegram Bot is running in background!")
|
||||
print("📱 Available Commands:")
|
||||
print(" /status - Bot status & positions")
|
||||
print(" /pause - Pause trading")
|
||||
print(" /resume - Resume trading")
|
||||
print(" /close - Close all positions (requires confirm)")
|
||||
print(" /balance - Account balance")
|
||||
print(" /stats - Performance stats")
|
||||
print(" /help - Show help")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Failed to start Telegram Bot: {e}")
|
||||
bot_controller = None
|
||||
Reference in New Issue
Block a user