AI-powered investment thesis monitor
Caution
Disclaimer: This project is not financial advice. It does not place trades, manage accounts, or have access to any brokerage. It is a personal research tool that gathers public data and summarizes it using AI. Your mileage may vary. The system informs -- you decide. Always do your own due diligence before making investment decisions.
thesis-engine monitors your stock portfolio around the clock by pulling data from 14 independent layers, synthesizing it through an LLM, and alerting you when something threatens (or strengthens) your investment thesis.
The 14 data layers:
- Prices -- Real-time quotes, cost basis tracking, gain/loss calculations
- Fundamentals -- P/E, revenue growth, margins, debt ratios via Finnhub
- Technicals -- 17 technical indicators (RSI, MACD, Bollinger, ADX, Ichimoku, Stochastic, OBV, VWAP, Keltner, Fibonacci, and more) with composite scoring
- Macro -- Fed funds rate, inflation (CPI), GDP, unemployment, VIX, treasury yields
- Press releases -- SEC 8-K filings classified by type (dilution, contract, executive, earnings)
- News RSS -- Multi-source news aggregation with sentiment scoring
- Reddit -- Retail sentiment from r/stocks, r/wallstreetbets, and ticker-specific subreddits
- Wikipedia -- Recent edits to company pages (controversy/vandalism detection)
- World news -- GDELT-powered geopolitical event monitoring
- Google Trends -- Search interest trends for company names and tickers
- Insider trades -- SEC Form 4 filings with C-suite detection
- Hedge funds -- 13F institutional ownership changes
- Congress trades -- STOCK Act disclosures with sector-aware committee relevance
- Sustainability -- ESG signal extraction (environmental, social, governance red flags)
Portfolio summary with action badges (BUY MORE / KEEP / SELL), P&L, watchlist, and key takeaways:
Red header, fired immediately when thesis-breaking events are detected:
stocks.yaml (your portfolio config)
|
v
14 parallel data layers (free APIs, no keys needed for most)
|
v
LLM synthesis (one API call per analysis run)
|
v
Email alerts (urgent / daily digest / weekend prep)
Data flow: On each run, the analyzer reads your stocks.yaml, dispatches all 14 data-fetching modules in parallel using ThreadPoolExecutor, collects the results into a single context bundle, and sends it to the LLM with a carefully tuned prompt. thesis-engine decides whether an urgent alert is needed or if a standard digest suffices.
Everything except the LLM API is free. Your total cost depends on which model you choose:
| Claude Model | Speed | Quality | Best for |
|---|---|---|---|
| Haiku | Fastest | Good | Routine monitoring, testing |
| Sonnet | Fast | Great | Daily use (recommended) |
| Opus | Slower | Best | Deep thesis evaluation |
At ~200 runs/month (hourly during market hours), expect to pay pennies to a few dollars/month depending on model. Check Anthropic's pricing page for current rates.
All other components are free:
| Component | Cost |
|---|---|
| Finnhub API | Free tier (60 calls/min) |
| Reddit API | Free (personal/non-commercial use only, requires OAuth credentials) |
| Quiver Quant (Congress) | Free tier |
| GitHub Actions | Free (2,000 min/month) |
| SEC EDGAR, BLS, GDELT, Wikimedia | Free (public APIs) |
| Gmail SMTP | Free |
Switch models by changing one line in analyzer.py. Start with Haiku to test, move up from there.
git clone https://github.com/YOURUSERNAME/thesis-engine.git
cd thesis-enginechmod +x setup.sh
./setup.shThis creates a virtual environment, installs dependencies, and scaffolds config files.
Edit .env with your API keys:
ANTHROPIC_API_KEY=your-api-key-here
FINNHUB_API_KEY=your-finnhub-key-here
NOTIFY_EMAIL=your@email.com
EMAIL_PASSWORD=your-gmail-app-passwordFor Gmail, you need an App Password (not your real password). Enable 2-Step Verification first.
Edit stocks.yaml with your holdings. See stocks.yaml.example for format.
source .venv/bin/activate
python analyzer.py --testSet up GitHub Actions in your private fork (see analyze.yml.example) or run via cron on any server.
thesis-engine/
├── analyzer.py # Main orchestrator
├── modules/
│ ├── prices.py # Layer 1: Price & cost basis
│ ├── fundamentals.py # Layer 2: Financial ratios
│ ├── technicals.py # Layer 3: Technical indicators
│ ├── macro.py # Layer 4: Macroeconomic data
│ ├── press_releases.py # Layer 5: SEC 8-K filings
│ ├── news_rss.py # Layer 6: News sentiment
│ ├── reddit.py # Layer 7: Retail sentiment
│ ├── wikipedia.py # Layer 8: Wiki edit monitoring
│ ├── world_news.py # Layer 9: Geopolitical events
│ ├── google_trends.py # Layer 10: Search trends
│ ├── insider_trades.py # Layer 11: Insider transactions
│ ├── hedge_funds.py # Layer 12: Institutional ownership
│ ├── congress_trades.py # Layer 13: Congressional trades
│ ├── sustainability.py # Layer 14: ESG signals
│ └── alerts.py # Email formatting & delivery
├── tests/ # Unit tests (pure functions, no API keys)
├── stocks.yaml.example # Sample portfolio config
├── .env.example # Environment variable template
├── .github/workflows/
│ └── ci.yml # Lint + test on push/PR
├── setup.sh # One-command setup
├── requirements.txt # Python dependencies
├── pyproject.toml # Ruff/project config
└── LICENSE # MIT
Sent immediately when thesis-engine detects a thesis-breaking event:
- Major insider selling by C-suite
- SEC investigation or fraud allegations
- Dilutive offering announced
- Earnings miss with guidance cut
- Congress member on relevant committee selling
End-of-day summary across all holdings. Includes action badges (BUY MORE / KEEP / SELL) for each position.
Sunday evening review. Covers macro trends, sector rotation, and thesis health heading into Monday.
All portfolio configuration lives in stocks.yaml. This is the only file you need to edit.
- Add a stock: Copy an existing entry, update ticker/sector/thesis
- Remove a stock: Delete the entry
- Track a purchase: Add a new entry under
purchaseswith date, dollars, and price_per_share - Add to watchlist: Add tickers under the
watchlistsection (lighter monitoring, no cost basis) - Update thesis: Modify the
thesisandthesis_risksfields as your conviction evolves
| Issue | Fix |
|---|---|
ANTHROPIC_API_KEY not set |
Add your key to .env |
Finnhub rate limit |
Free tier allows 60 calls/min -- reduce portfolio size or add delays |
Reddit 403 |
Create a Reddit app at reddit.com/prefs/apps and add credentials to .env |
Email not sending |
Ensure you're using a Gmail App Password with 2FA enabled |
No data for ticker |
Some layers skip OTC/foreign stocks -- this is expected |
LLM response empty |
Check your Anthropic API key and billing status |
| Tests failing | Run source .venv/bin/activate && pytest -v to see details |
This project is designed to run in a private GitHub repo (your portfolio data is personal).
- Fork or clone this repo
- Make it private: Settings > Danger Zone > Change visibility > Private
- Add secrets in your private repo: Settings > Secrets and variables > Actions
ANTHROPIC_API_KEYFINNHUB_API_KEYNOTIFY_EMAILEMAIL_PASSWORDREDDIT_CLIENT_ID(optional)REDDIT_CLIENT_SECRET(optional)QUIVER_API_KEY(optional)
- Rename
.github/workflows/analyze.yml.exampletoanalyze.yml - Edit
stocks.yamlwith your actual holdings - Push -- GitHub Actions will start running on schedule
git clone https://github.com/YOURUSERNAME/thesis-engine.git
cd thesis-engine
# Make it private on GitHub first, then:
cp stocks.yaml.example stocks.yaml
cp .github/workflows/analyze.yml.example .github/workflows/analyze.yml
# Edit stocks.yaml and .env with your real data
git add -A && git commit -m "Configure my portfolio"
git pushMIT -- see LICENSE.

