RC
Network
Copula
Rolling Correlation
testng
Pearson correlation, computed on a rolling window of daily log returns. Each pair gets one r per day. The six tabs slice the same r matrix through different lenses.
What we measure
We pull daily adjusted-close prices from yfinance, take log returns, then for every pair (A, B) compute Pearson r over the trailing N trading days. Result: one r per (pair, date). N is the window — current report uses 30d.
Window choice
Shorter windows (30d) react fast to regime shifts but are noisier. Longer windows (60d, 120d) smooth the signal but lag turning points by weeks. Pick the window to match the question — fast trades vs. structural shifts.
What each tab shows
- Overlay — pair-level r over time, top-N by recent divergence. Find pairs that just stopped moving together.
- Cohesion — basket-mean r ±1σ / ±2σ bands. Mean rising = basket marching in lockstep. Pairs outside ±1σ behave unusually.
- Cluster — most-/least-correlated groups in the latest snapshot. Useful for spotting regime-driven sub-baskets.
- Stats & Pairs — sortable table + searchable grid for every pair, with rank, latest r, and divergence.
- 3D Surface — sector × sector × time. Watch how cross-sector correlation evolves in three dimensions.
- Insights — week-over-week jumps in r above threshold, plus benchmark beta info per ticker.
Limits
- Academic / educational only. No live trading guidance.
- Daily close only — intraday moves invisible.
- Pearson r is linear and averages the whole scatter. For crash-only or rally-only co-movement, see /copula/ — it fits tail-dependence copulas that read just the extremes.
Symbols
- Pearson correlation coefficient. Range [-1, +1]. +1 = perfect linear move-together; 0 = no linear link; -1 = mirror move.
- Daily log return on day t. We use log returns because they add cleanly across days and are roughly normal for short horizons.
- Adjusted close price on day t — adjusted for splits and dividends so price drops from corporate actions don't fake a return.
- Sample means of the two return series over the rolling window.
- Rolling-window length, in trading days. The current report uses 30d.
Formulas
Daily log return
How we go from prices to a return series. We do this once per ticker, then feed the two return series into Pearson r.
Pearson r over a rolling window
Standard Pearson formula, but the sums only span the last n days. Slide the window forward one day → one fresh r per pair per date. That is the matrix every tab visualizes differently.
Overlay
/ focus search
Esc clear
Cohesion
Solid line is the daily cross-sectional mean rolling-r across all pairs. Shaded bands are ±1σ and ±2σ. Mean rising = basket moving in sync; a pair sitting outside ±1σ is behaving unusually relative to the basket.
Cluster Finder
Mode
Group Size
Window
Sector Scope
Beta Adjust
As-of Date
Statistics
| Pair | Static r | Current r | Mean | Std | Min | Max | 1Y Hi | 1Y Lo |
|---|---|---|---|---|---|---|---|---|
Pair Charts
Synced to overlay range. All charts pan/zoom together.
3D Surface
Drag to rotate. Scroll to zoom. Diagonal capped at 0.85 to reduce visual spike.