Minimal skeleton for testing: "Does LLM-scored Musk tweet sentiment predict weekly TSLA returns?"
| Data | Source | Notes |
|---|---|---|
| Tweets | Kaggle: Elon Musk Tweets 2010-2021 | 13K tweets, free download |
| Kaggle: Elon Musk Tweets (updated) | More recent, ~50K tweets | |
| Prices | yfinance | Auto-fetched, no setup needed |
# 1. Install dependencies
pip install -r requirements.txt
# 2. Validate pipeline logic with synthetic data
python test_synthetic.py
# 3. Download tweet data from Kaggle, place in ./data/elonmusk_tweets.csv
# 4. Set your Anthropic API key
export ANTHROPIC_API_KEY=sk-ant-...
# 5. Run real backtest
python pipeline.py- Correlation: Does weekly sentiment score correlate with next week's return?
- Directional accuracy: Does positive sentiment → positive return (>50% = better than random)
- Quintile spread: Do high-sentiment weeks outperform low-sentiment weeks?
- Strategy vs buy-hold: Does trading on signal beat holding?
- Synthetic test: instant
- Real data (5000 tweets): ~30 min for LLM scoring (cached after first run)
- Subsequent runs: seconds (uses cache)
musk_signal/
├── pipeline.py # Main pipeline
├── test_synthetic.py # Validates logic with fake data
├── requirements.txt
├── README.md
└── data/
├── elonmusk_tweets.csv # You provide this
├── scored_tweets.json # Generated (LLM score cache)
└── backtest_results.csv # Generated (final output)
The hypothesis is this works for volatile/high-profile executives. To test others:
- Find tweet archive (or scrape with appropriate tools)
- Change
TWEET_FILEand ticker inload_prices() - Potentially adjust
SCORING_PROMPTto mention the relevant company
Candidates: Chamath Palihapitiya, Michael Saylor, Ryan Cohen, etc.