- **clp_manager.py**: Renamed from 'uniswap_manager.py'. Standardized logic for Uniswap V3 liquidity provision. - **clp_hedger.py**: Renamed from 'unified_hedger.py'. Consolidated hedging logic including Delta Calculation fixes, EAC (Edge Avoidance), and Fishing order implementation. - **Cleanup**: Removed legacy 'aerodrome' folder and tools. - **Monitoring**: Added Telegram monitoring scripts. - **Config**: Updated gitignore to exclude market data CSVs.
109 lines
3.4 KiB
Python
109 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
Setup script for Telegram Bot notifications
|
||
Helps users create a Telegram bot and get required credentials
|
||
"""
|
||
|
||
import webbrowser
|
||
import time
|
||
|
||
def print_instructions():
|
||
"""Print setup instructions"""
|
||
print("🤖 TELEGRAM BOT SETUP INSTRUCTIONS")
|
||
print("=" * 50)
|
||
print()
|
||
print("1️⃣ CREATE YOUR TELEGRAM BOT:")
|
||
print(" • Open Telegram and search for @BotFather")
|
||
print(" • Send: /newbot")
|
||
print(" • Choose a name for your bot")
|
||
print(" • Choose a username (must end with 'bot')")
|
||
print(" • BotFather will give you a HTTP API token")
|
||
print(" • Copy this token (it looks like: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz)")
|
||
print()
|
||
print("2️⃣ GET YOUR CHAT ID:")
|
||
print(" • Send a message to your new bot first (any message)")
|
||
print(" • Your bot will not work if you haven't messaged it first")
|
||
print(" • Use the script below to get your Chat ID")
|
||
print()
|
||
print("3️⃣ CONFIGURE ENVIRONMENT:")
|
||
print(" • Add to your .env file:")
|
||
print(" TELEGRAM_MONITOR_ENABLED=True")
|
||
print(" TELEGRAM_BOT_TOKEN=your_bot_token_here")
|
||
print(" TELEGRAM_CHAT_ID=your_chat_id_here")
|
||
print()
|
||
print("4️⃣ RUN THE MONITOR:")
|
||
print(" • python tools/telegram_monitor.py")
|
||
print()
|
||
print("=" * 50)
|
||
|
||
def get_chat_id():
|
||
"""Get chat ID using bot token"""
|
||
print("🔍 CHAT ID FINDER")
|
||
print("-" * 20)
|
||
|
||
token = input("Enter your bot token: ").strip()
|
||
if not token:
|
||
print("❌ No token provided")
|
||
return
|
||
|
||
try:
|
||
import requests
|
||
import json
|
||
|
||
url = f"https://api.telegram.org/bot{token}/getUpdates"
|
||
response = requests.get(url, timeout=10)
|
||
data = response.json()
|
||
|
||
if data.get('ok'):
|
||
updates = data.get('result', [])
|
||
if updates:
|
||
chat_id = updates[-1]['message']['chat']['id']
|
||
print(f"✅ Your Chat ID: {chat_id}")
|
||
print()
|
||
print("Add this to your .env file:")
|
||
print(f"TELEGRAM_CHAT_ID={chat_id}")
|
||
else:
|
||
print("❌ No messages found")
|
||
print("Send a message to your bot first, then try again")
|
||
else:
|
||
print(f"❌ Error: {data.get('description', 'Unknown error')}")
|
||
|
||
except Exception as e:
|
||
print(f"❌ Error getting Chat ID: {e}")
|
||
|
||
def main():
|
||
"""Main setup menu"""
|
||
print("🤖 CLP TELEGRAM NOTIFICATION SETUP")
|
||
print("=" * 40)
|
||
print()
|
||
|
||
while True:
|
||
print("Choose an option:")
|
||
print("1. Show setup instructions")
|
||
print("2. Get Chat ID")
|
||
print("3. Open BotFather (to create bot)")
|
||
print("4. Exit")
|
||
print()
|
||
|
||
choice = input("Enter choice (1-4): ").strip()
|
||
|
||
if choice == '1':
|
||
print_instructions()
|
||
elif choice == '2':
|
||
get_chat_id()
|
||
elif choice == '3':
|
||
print("Opening BotFather in Telegram...")
|
||
try:
|
||
webbrowser.open('https://t.me/BotFather')
|
||
except:
|
||
print("Could not open browser. Go to https://t.me/BotFather manually")
|
||
elif choice == '4':
|
||
print("Goodbye! 🚀")
|
||
break
|
||
else:
|
||
print("Invalid choice. Try again.")
|
||
|
||
print("\n" + "=" * 40 + "\n")
|
||
|
||
if __name__ == "__main__":
|
||
main() |