A Rust web application that tracks S&P 500 sectors and monitors implied volatility (IV) correlations between each sector.
- Sector overview: List of 11 S&P 500 sectors with SPDR ETF tickers
- Implied volatility: Current IV per sector from options on sector ETFs (Yahoo Finance)
- IV correlation matrix: Pearson correlation of IV across sectors over a rolling window
- Backend: Rust, Axum, Tokio
- Data sources: Yahoo Finance (options/IV), Financial Modeling Prep (S&P 500 constituents, sector performance)
- Frontend: Static HTML, CSS, JavaScript
- Rust (1.70+)
- FMP API key for sector/constituent data (IV uses Yahoo, no key needed)
-
Clone the repository and enter the directory:
cd sector-tracker -
Copy the example environment file:
cp .env.example .env
-
Get an API key from Financial Modeling Prep and add it to
.env:FMP_API_KEY=your_api_key_hereWithout the FMP key, the app will still run but:
/api/sectorswill return sectors without performance data/api/sectors/:id/constituentswill fail (requires FMP)
IV data from Yahoo Finance works without any API key.
-
Build and run:
cargo run
-
Open http://localhost:3000 in your browser.
| Method | Path | Description |
|---|---|---|
| GET | /api/health |
Health check |
| GET | /api/sectors |
List sectors (optionally with performance) |
| GET | /api/sectors/:id/constituents |
S&P 500 constituents by sector |
| GET | /api/iv/sectors |
Current IV per sector |
| GET | /api/iv/correlations |
IV correlation matrix |
Sector IDs use kebab-case, e.g. consumer-discretionary, health-care.
Environment variables (see .env.example):
FMP_API_KEY(required for FMP features)BIND_ADDRESS(default:0.0.0.0:3000)CACHE_TTL_CONSTITUENTS_SECS(default: 86400)CACHE_TTL_SECTOR_PERFORMANCE_SECS(default: 1800)CACHE_TTL_IV_SECS(default: 600)CORRELATION_WINDOW_DAYS(default: 30)RUST_LOG(default:info)
- IV: Fetched from Yahoo Finance options API for the 11 SPDR sector ETFs (XLC, XLY, XLP, XLE, XLF, XLV, XLI, XLB, XLRE, XLK, XLU). ATM options are used to derive sector IV.
- Correlations: Built from IV snapshots. Call
/api/iv/sectorsseveral times (over hours/days) to build history; correlations require at least 2 snapshots.
MIT