Overview
Search Reddit for stock ticker mentions daily, score each thread's sentiment with an LLM, aggregate by ticker, and track sentiment trends over a rolling 30-day window.
Trigger
Daily cron (e.g. 18:00 UTC, after market close)
Schedule
Daily after market close
Workflow Steps
Define ticker watchlist
List of tickers to track: AAPL, TSLA, NVDA, etc.
Search Scavio Reddit endpoint per ticker
POST /api/v1/search with platform=reddit, query='$TICKER'. Top-20 threads.
Score sentiment per thread
Send thread title + top comment to LLM: 'Rate sentiment -1 to +1 for this stock discussion. Return JSON {score, reasoning}.'
Aggregate daily score per ticker
Average sentiment scores across all threads for that ticker.
Append to rolling 30-day log
Store in SQLite or CSV: date, ticker, avg_sentiment, thread_count.
Optional: alert on sentiment spikes
If today's score deviates > 0.5 from 7-day average, send Slack alert.
Python Implementation
import requests, os, json
key = os.environ["SCAVIO_API_KEY"]
tickers = ["AAPL", "TSLA", "NVDA"]
for ticker in tickers:
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": key},
json={"query": f"${ticker}", "platform": "reddit", "limit": 20})
threads = resp.json().get("results", [])
scores = []
for t in threads:
result = call_llm(f"Rate sentiment -1 to +1: {t['title']}. JSON: score, reasoning.")
scores.append(json.loads(result)["score"])
avg = sum(scores) / len(scores) if scores else 0
print(f"{ticker}: avg sentiment {avg:.2f} across {len(threads)} threads")JavaScript Implementation
const tickers = ["AAPL", "TSLA", "NVDA"];
for (const ticker of tickers) {
const resp = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST",
headers: { "x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ query: `$${ticker}`, platform: "reddit", limit: 20 })
});
const threads = (await resp.json()).results;
const scores = [];
for (const t of threads) {
const r = await callLLM(`Rate sentiment -1 to +1: ${t.title}. JSON: {score, reasoning}.`);
scores.push(JSON.parse(r).score);
}
const avg = scores.reduce((a, b) => a + b, 0) / (scores.length || 1);
console.log(`${ticker}: avg sentiment ${avg.toFixed(2)} across ${threads.length} threads`);
}Platforms Used
Community, posts & threaded comments from any subreddit