Correlation Matrix
Shows which assets move together — as a color-coded heatmap.
- Yahoo Finance data
- Heatmap visualization
- Rolling correlation
- Combine any assets
From problem to solution.
The Problem
Trading EURUSD and GBPUSD simultaneously doubles your risk without knowing — because both pairs are highly correlated.
The Solution
The tool automatically downloads price data and calculates the correlation between any assets as a color-coded heatmap.
The Result
A heatmap shows instantly: Green = correlated (risk!), Red = inverse (hedge opportunity). Plus rolling correlation over time.
When do I use this?
- 01
You trade DAX and S&P500 → the matrix shows 0.92 correlation → you have nearly identical risk on both positions.
- 02
Gold vs. stock indices shows -0.3 → Gold works as a hedge in crisis times.
- 03
Rolling correlation shows: EUR/USD and GBP/USD were 0.9 correlated 3 months ago, now only 0.4.
Getting started
- 01
python correlation_matrix.py (with default assets)
- 02
python correlation_matrix.py --symbols ^GDAXI EURUSD=X GC=F
- 03
python correlation_matrix.py --period 6mo --rolling 20
- 04
Heatmap and rolling chart saved as PNG
Technical Details
Parameters & Settings(3)
- --symbols
Yahoo Finance symbols
DAX, FTSE, S&P, NASDAQ, EUR/USD, GBP/USD, Gold, Oil - --period
Data period
1y - --rolling
Rolling window (days)
30
Full Description
Changelog(v1.0)
- +Initial Release