#!/usr/bin/env python3 """ FΓΌgt Telegram Dependencies Installation Cell ins Notebook hinzu """ import json notebook_path = "TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb" print(f"πŸ“– Loading notebook: {notebook_path}") with open(notebook_path, 'r', encoding='utf-8') as f: notebook = json.load(f) # Find Cell 28 (Telegram Bot Commander) # We need to insert a dependency installation cell BEFORE it # Create new cell for dependency installation (will be Cell 27.5) dependency_cell = { "cell_type": "code", "execution_count": None, "metadata": {}, "outputs": [], "source": [ "# ==========================================\n", "# INSTALL TELEGRAM BOT DEPENDENCIES\n", "# ==========================================\n", "\n", "import sys\n", "import subprocess\n", "\n", "print(\"πŸ“¦ Installing python-telegram-bot...\")\n", "\n", "try:\n", " # Install or upgrade python-telegram-bot\n", " subprocess.check_call([\n", " sys.executable, \"-m\", \"pip\", \"install\", \n", " \"python-telegram-bot\", \"--upgrade\", \"--quiet\"\n", " ])\n", " print(\"βœ… python-telegram-bot installed successfully!\")\n", " \n", " # Verify\n", " import telegram\n", " print(f\"βœ… telegram module version: {telegram.__version__}\")\n", " \n", "except Exception as e:\n", " print(f\"❌ Installation failed: {e}\")\n", " print(\"\\n⚠️ Please run manually:\")\n", " print(\" pip install python-telegram-bot --upgrade\")\n" ] } # Insert at position 27 (before the markdown info cell) insert_position = 27 print(f"πŸ“ Inserting dependency installation cell at position {insert_position}...") notebook['cells'].insert(insert_position, dependency_cell) # Update cell count new_total = len(notebook['cells']) print(f"βœ… New total cells: {new_total}") # Save notebook print(f"πŸ’Ύ Saving notebook...") with open(notebook_path, 'w', encoding='utf-8') as f: json.dump(notebook, f, indent=1, ensure_ascii=False) print("βœ… Notebook updated successfully!") print(f"\n🎯 NEW CELL STRUCTURE:") print(f" Cell 27: Dependency Installation (NEW)") print(f" Cell 28: Telegram Bot Info (Markdown)") print(f" Cell 29: Telegram Bot Commander (Code)") print(f" Cell 30: execute_trade Integration (Code)") print(f"\nπŸ“‹ INSTRUCTIONS:") print(f" 1. Run Cell 27 FIRST (install dependencies)") print(f" 2. Then run Cell 29 (Telegram Bot Commander)") print(f" 3. Then run Cell 30 (Integration)")