AI slob:
A lightweight, automated stock screener designed to run on OpenWrt routers or low-power Linux devices. It scans the NASDAQ 100, S&P 500, and a custom watchlist for technical breakout signals and sends rich notifications via Telegram.
- π Technical Analysis: Detects 200-Day EMA Crossovers, Golden Crosses (50 > 200), and Death Crosses (50 < 200).
- πͺπΊ EU-Friendly: Bypasses Yahoo Finance GDPR/Geo-blocks by scraping Finviz for fundamental data (P/E Ratio, Company Name).
- π Dynamic Watchlists: Automatically scrapes Slickcharts for the latest S&P 500 & NASDAQ 100 components every run.
- π Charts & Trends: Generates instant price charts with EMA trendlines using the QuickChart API.
- π‘οΈ Spam Protection: Uses a local state file (
screener_state.json) to prevent duplicate alerts for the same stock on the same day. - β‘ Lightweight: Built with pure Python (
requestsonly) β no heavy libraries likepandasornumpy.
SSH into your OpenWrt router and install Python 3:
opkg update
opkg install python3-light python3-pip python3-requests python3-openssl ca-certificates
# Optional: For easier file transfer
opkg install openssh-sftp-server- Chat with @BotFather to create a bot and get your
BOT_TOKEN. - Chat with @userinfobot to get your numeric
CHAT_ID. - Edit
screener.pyand update the configuration section:
# --- CONFIGURATION ---
BOT_TOKEN = "123456789:AbCdeF..."
CHAT_ID = "987654321"Copy the script and your custom watchlist to the router using scp.
(Note: Use -O for legacy SCP protocol if you didn't install sftp-server).
# Copy the script
scp -O screener.py root@192.168.1.120:/root/screener.py
# Copy custom watchlist (optional)
scp -O lookup_stocks root@192.168.1.120:/root/lookup_stocksCreate a file named lookup_stocks in the same directory. Add tickers line-by-line or comma-separated:
INTC
GME, AMC
PLTR
To run the scanner automatically every weekday (Mon-Fri) at 10:00 PM:
- SSH into your router.
- Edit the crontab:
crontab -e - Add the following line:
0 22 * * 1-5 /usr/bin/python3 /root/screener.py >> /tmp/screener.log 2>&1- Restart cron:
/etc/init.d/cron restartYou can trigger a scan manually at any time:
python3 /root/screener.pyThe script tracks sent alerts in screener_state.json. To force a re-scan of stocks you've already seen today:
rm /root/screener_state.json| Issue | Solution |
|---|---|
scp: /usr/libexec/sftp-server: not found |
Use scp -O ... (legacy mode) or install openssh-sftp-server. |
| Telegram Photo Error 400 | The script automatically handles URL shortening. If this persists, check if the stock symbol is valid. |
| Yahoo "User unable to access" | The script uses Finviz for fundamentals to fix this. Ensure your router isn't blocking finviz.com. |
NameError: name '__file__' is not defined |
This happens in Jupyter Notebooks. The script includes a fallback to os.getcwd() to fix this. |
This project is open-source and available under the MIT License.