Editable stock notebooks
Open a notebook, rerun the cells, then change the ticker list or pre-market table.
Pre-market idea
For a list of tickers moving before the open, create a small feature table: sector, theme, size bucket, product exposure, or index basket. Then compare each ticker against peers with overlapping features.
pairs['similarity'] = (
same_sector * 2
+ same_theme * 3
+ same_size_bucket
)
peer_implied_move = weighted_average(peer_moves, similarity)
This is a read-through exercise, not a forecast. The useful pandas lesson is the self-join, feature scoring, weighted average, and residual: actual move minus peer-implied move.
Why returns instead of prices
Price levels are not comparable across tickers. Daily returns make correlations, volatility, and relative performance easier to compare.
wide_close = prices.pivot(index='date', columns='symbol', values='close')
wide_returns = wide_close.pct_change().dropna()
wide_returns.corr()
Other notebook ideas
- Earnings-day reaction versus peer basket reaction.
- Sector ETF beta: ticker returns versus QQQ, SPY, XLK, or SMH.
- Rolling 30-day correlation to see when relationships break.
- Volume spike days and whether they line up with large returns.
- Feature-based peer search for any ticker list pasted before the open.