Quantum computing stocks moved 18% in 30 minutes last Tuesday when IBM announced its roadmap update. Most retail traders found out hours later. Here's how to build a Python alert system that catches these moves in real-time — 45 minutes to set up, zero API costs.

What You Will Build

  • Real-time monitoring of $RGTI, $QUBT, $IONQ via Yahoo Finance API
  • Email alerts triggered by 5%+ price movements within 15-minute windows
  • Automated deployment using cron jobs — runs without manual intervention

Requirements and Setup Time

You need Python 3.8+, a Gmail account, and basic command line knowledge. Time estimate: 45 minutes. Difficulty: Intermediate.

The technical stack: yfinance for data (unlimited free requests), smtplib for alerts, cron for automation. No API keys required — Yahoo Finance allows unlimited personal use requests, unlike Alpha Vantage's 5-calls-per-minute limit.

Core Implementation

Install Dependencies

pip install yfinance requests schedule smtplib

Create quantum_alerts.py with this foundation:

import yfinance as yf
import smtplib
from email.mime.text import MIMEText
import time
import json
from datetime import datetime

Configure Your Watchlist

QUANTUM_STOCKS = {
    'RGTI': 'Rigetti Computing',
    'QUBT': 'Quantum Computing Inc',
    'IONQ': 'IonQ Inc'
}

PRICE_THRESHOLD = 0.05 # 5% trigger
CHECK_INTERVAL = 900 # 15 minutes

$RGTI trades at $1.2B market cap, focuses on quantum cloud services. $QUBT at $180M, develops quantum software. $IONQ at $2.1B, builds trapped-ion systems. The 5% threshold captures institutional moves while filtering normal volatility.

a person holding up a cell phone with a stock chart on it
Photo by PiggyBank / Unsplash

Email Alert Function

def send_alert(subject, message):
    sender_email = "your_email@gmail.com"
    sender_password = "your_app_password" # Not regular password
    recipient_email = "alerts@yourdomain.com"

    msg = MIMEText(message)
    msg['Subject'] = subject
    msg['From'] = sender_email
    msg['To'] = recipient_email

    try:
        server = smtplib.SMTP('smtp.gmail.com', 587)
        server.starttls()
        server.login(sender_email, sender_password)
        server.send_message(msg)
        server.quit()
    except Exception as e:
        print(f"Email failed: {e}")

Critical: Use Gmail App Passwords. Go to Google Account → Security → 2-Step Verification → App passwords. Generate a 16-character password. Regular passwords fail due to OAuth requirements.

Price Monitoring Engine

def monitor_stocks():
    try:
        with open('last_prices.json', 'r') as f:
            last_prices = json.load(f)
    except FileNotFoundError:
        last_prices = {}

    current_prices = {}
    alerts_sent = 0

    for ticker, company in QUANTUM_STOCKS.items():
        stock = yf.Ticker(ticker)
        data = stock.history(period='1d', interval='1m')
        current_price = data['Close'].iloc[-1]
        current_prices[ticker] = float(current_price)

        if ticker in last_prices:
            change = (current_price - last_prices[ticker]) / last_prices[ticker]
            if abs(change) >= PRICE_THRESHOLD:
                direction = "UP" if change > 0 else "DOWN"
                pct = abs(change * 100)
                subject = f"ALERT: {ticker} {direction} {pct:.1f}%"
                message = f"{company} ({ticker})\n${current_price:.2f}\n{pct:.1f}% {direction}\n{datetime.now()}"
                send_alert(subject, message)
                alerts_sent += 1

    with open('last_prices.json', 'w') as f:
        json.dump(current_prices, f)
    return alerts_sent

The system pulls 1-minute interval data — catches rapid moves that signal news breaks or institutional flow. 15-minute checks balance timeliness with API limits.

Continuous Monitoring Loop

if __name__ == "__main__":
    print("Quantum stock monitoring active")
    print(f"Tickers: {list(QUANTUM_STOCKS.keys())}")
    print(f"Threshold: {PRICE_THRESHOLD*100}%")

    while True:
        try:
            alerts = monitor_stocks()
            timestamp = datetime.now().strftime("%H:%M:%S")
            print(f"[{timestamp}] Check complete. Alerts: {alerts}")
        except Exception as e:
            print(f"Error: {e}")
        time.sleep(CHECK_INTERVAL)

Production Deployment

Test first: Set PRICE_THRESHOLD = 0.01 temporarily to trigger alerts. Run python3 quantum_alerts.py. You'll get test emails within 15 minutes — quantum stocks move enough to hit 1% regularly during market hours.

For automation, create a cron job: crontab -e, then add:

@reboot cd /path/to/script && python3 quantum_alerts.py >> log.txt 2>&1

Windows users: Task Scheduler → Create Basic Task → Trigger "At startup" → Action "Start a program" → Point to your Python executable and script path.

Common failures: Gmail authentication (use App Passwords), Yahoo Finance timeouts (add if data.empty: continue), script crashes (wrap main loop in try-except with logging).

Advanced Configurations

Add volume filters to avoid low-liquidity spikes: if data['Volume'].iloc[-1] < 10000: continue. Set ticker-specific thresholds — $IONQ typically moves 7-8% on news, $RGTI around 4-5%.

Enable after-hours monitoring: stock.history(period='1d', interval='1m', prepost=True). Quantum announcements often break outside market hours — IBM's Tuesday roadmap hit at 4:47 PM ET.

The bigger opportunity isn't just catching individual stock moves. It's understanding that quantum computing developments create systematic risk across sectors — encryption, cloud computing, even Bitcoin. The alert system you're building captures the first domino.