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,32 @@
|
||||
|
||||
# ==========================================
|
||||
# INTEGRATION: Bot Controller mit execute_trade
|
||||
# ==========================================
|
||||
|
||||
# Original execute_trade_v2_adaptive function wrappen
|
||||
if 'bot_controller' in dir() and bot_controller is not None:
|
||||
|
||||
# Original Funktion sichern
|
||||
if '_original_execute_trade_before_telegram' not in dir():
|
||||
_original_execute_trade_before_telegram = execute_trade_v2_adaptive
|
||||
|
||||
def execute_trade_with_telegram_control(*args, **kwargs):
|
||||
"""
|
||||
Wrapper der bot_controller.is_paused prüft
|
||||
"""
|
||||
# Check if trading is paused
|
||||
if bot_controller.is_paused:
|
||||
print("⏸️ Trading PAUSED via Telegram")
|
||||
print(f" Reason: {bot_controller.pause_reason}")
|
||||
return
|
||||
|
||||
# Execute original function
|
||||
return _original_execute_trade_before_telegram(*args, **kwargs)
|
||||
|
||||
# Replace execute_trade
|
||||
execute_trade_v2_adaptive = execute_trade_with_telegram_control
|
||||
|
||||
print("✅ execute_trade_v2_adaptive wrapped with Telegram control")
|
||||
print(" Trading can now be paused/resumed via /pause and /resume")
|
||||
else:
|
||||
print("⚠️ bot_controller not available, skipping integration")
|
||||
Reference in New Issue
Block a user