| import requests |
| import smtplib |
| from email.mime.text import MIMEText |
| from email.mime.multipart import MIMEMultipart |
|
|
| def get_live_usdt_dominance(): |
| """Fetches global USDT Dominance to act as a Macro Kill Switch.""" |
| try: |
| url = "https://api.coingecko.com/api/v3/global" |
| response = requests.get(url, timeout=5).json() |
| return response['data']['market_cap_percentage']['usdt'] |
| except Exception as e: |
| print(f"Error fetching macro data: {e}") |
| |
| return 100.0 |
|
|
| def send_email_alert(sender_email, sender_password, receiver_email, symbol, message): |
| """Packages and sends the AI trade signal directly to your email inbox.""" |
| try: |
| msg = MIMEMultipart() |
| msg['From'] = sender_email |
| msg['To'] = receiver_email |
| msg['Subject'] = f"🎯 AI TRADE ALERT: Prime Setup on {symbol}" |
| |
| msg.attach(MIMEText(message, 'plain')) |
| |
| |
| server = smtplib.SMTP('smtp.gmail.com', 587) |
| server.starttls() |
| server.login(sender_email, sender_password) |
| server.send_message(msg) |
| server.quit() |
| print(f"Email successfully sent for {symbol}") |
| except Exception as e: |
| print(f"Failed to send email: {e}") |
| |