π Market Sentiment Briefing β System Documentation
Overview
Daily market sentiment briefing delivered to Matt's DM. Fetches analyst recommendations, insider sentiment, earnings surprises, and price data from Finnhub (free tier).
Commands
| Command |
Description |
/briefing |
Generate and send market briefing on-demand |
/watchlist |
Show current watchlist |
watchlist TICKER TICKER ... |
Update watchlist |
Architecture
βββββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Cron Job ββββββΆβ Finnhub API ββββββΆβ Telegram DM β
β (daily 3PM CT) β β (60 calls/m)β β (Matt) β
βββββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β watchlist.json β β Configurable ticker list
βββββββββββββββββββ
Files
| File |
Purpose |
core/market/sentiment.py |
Finnhub API client + briefing generator |
core/handlers/market_briefing.py |
Telegram command handlers |
jobs/daily_briefing.py |
Cron job entrypoint |
API Endpoints (Free Tier)
/quote β Real-time price and change
/stock/insider-sentiment β Monthly insider buying/selling sentiment
/stock/recommendation β Analyst buy/sell/hold consensus
/stock/earnings β Earnings surprise history
/company-news β Recent headlines (not yet used)
Signal Logic
| Signal |
Condition |
| π’ Bullish |
>60% analyst buy OR insider MSPR >0.2 |
| π΄ Bearish |
>40% analyst sell OR insider MSPR <-0.2 |
| βͺ Neutral |
Neither condition met |
Alerts
- π° Earnings surprise >10%
- π Analyst consensus change β₯2 buys
Cron Setup
# Add to crontab (3:00 PM CT = market close)
0 15 * * 1-5 cd /home/hoffmann_admin/.openclaw/workspace/services/icarus && ICARUS_ENV=staging python3 jobs/daily_briefing.py
Environment Variables
| Variable |
Required |
Description |
FINNHUB_API_KEY |
β
|
Finnhub API key (free tier) |
TELEGRAM_BOT_TOKEN |
β
|
Bot token for sending DMs |
TELEGRAM_CHAT_ID_MATT |
β
|
Matt's chat ID |
Watchlist
Default: AAPL MSFT GOOGL AMZN TSLA NVDA META JPM
Stored in: ~/.icarus/staging/watchlist.json
Rate Limits
- Free tier: 60 calls/minute
- Per-ticker cost: 4 calls (quote, sentiment, recommendations, earnings)
- 8 tickers = 32 calls = well within limit
Future Enhancements
- [ ] News sentiment (requires paid tier or alternative source)
- [ ] Sector rotation signals
- [ ] Technical indicators (RSI, MACD)
- [ ] Portfolio tracking (if Matt adds holdings)