# Stock Sector Correlation Matrix API
> How the eleven S&P 500 sectors move together, computed live from Yahoo Finance via the SPDR sector ETFs (no key, nothing stored). Sector correlation is the heart of equity diversification and rotation: defensives (utilities, staples, health care) and cyclicals (tech, discretionary, financials, energy) cluster differently, and when correlations rise the whole market is moving as one (risk-on/risk-off), while a spread of correlations means stock-picking and rotation are rewarded. The matrix endpoint returns the full pairwise return-correlation matrix across all eleven sectors with the most- and least-correlated sector pairs. The sector endpoint returns one sector's correlation to every other, ranked, plus its beta to the S&P 500 (how much it amplifies the market). The sectors endpoint lists what is covered. The equity sector correlation / rotation cut — distinct from the cross-asset correlation matrix (asset classes, not sectors), the crypto and currency correlation APIs (other markets) and the sector price/performance feed. It answers which sectors are the same bet and which diversify, within the stock market.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/sectorcorrelation-api/..."
```

## Pricing
- **Free** (Free) — 720 calls/Mo, 2 req/s
- **Starter** ($11/Mo) — 16,700 calls/Mo, 6 req/s
- **Pro** ($33/Mo) — 87,500 calls/Mo, 16 req/s
- **Business** ($75/Mo) — 476,000 calls/Mo, 40 req/s

## Endpoints

### Matrix

#### `GET /v1/matrix` — Full 11x11 sector correlation matrix with most/least correlated pairs

**Parameters:**
- `window` (query, optional, string) — Lookback in days (20-365) Example: `90`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sectorcorrelation-api/v1/matrix?window=90"
```

**Response:**
```json
{
    "data": {
        "to": "2026-06-11",
        "from": "2026-02-02",
        "note": "Full pairwise Pearson correlation of daily log returns across the eleven S&P 500 sectors, aligned on common trading days. High correlations mean the market is moving as one (risk-on/risk-off); low or spread correlations reward rotation and stock-picking. most_correlated pairs double up risk; least_correlated diversify.",
        "matrix": {
            "energy": {
                "energy": 1,
                "materials": -0.11,
                "utilities": -0.013,
                "financials": -0.246,
                "technology": -0.221,
                "health_care": -0.149,
                "industrials": -0.28,
                "real_estate": -0.248,
                "communication": -0.387,
                "consumer_staples": 0.061,
                "consumer_discretionary": -0.464
            },
            "materials": {
                "energy": -0.11,
                "materials": 1,
                "utilities": 0.351,
                "financials": 0.318,
                "technology": 0.446,
                "health_care": 0.416,
                "industrials": 0.747,
                "real_estate": 0.484,
                "communication": 0.335,
                "consumer_staples": 0.272,
                "consumer_discretionary": 0.547
            },
            "utilities": {
                "energy": -0.013,
                "materials": 0.351,
                "utilities": 1,
         
…(truncated, see openapi.json for full schema)
```

### Sector

#### `GET /v1/sector` — One sector correlations to all others, ranked, with beta to S&P 500

**Parameters:**
- `sector` (query, required, string) — Sector key (see /v1/sectors) Example: `technology`
- `window` (query, optional, string) — Lookback in days (20-365) Example: `90`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sectorcorrelation-api/v1/sector?sector=technology&window=90"
```

**Response:**
```json
{
    "data": {
        "to": "2026-06-11",
        "from": "2026-02-02",
        "name": "Technology",
        "note": "One sector's correlation to every other sector, ranked, plus its beta to the S&P 500 (beta > 1 amplifies market moves; a defensive sector is < 1). best_diversifiers are the least-correlated sectors.",
        "sector": "technology",
        "source": "Yahoo Finance",
        "window_days": 90,
        "correlations": [
            {
                "key": "consumer_discretionary",
                "name": "Consumer Discretionary",
                "correlation": 0.629
            },
            {
                "key": "industrials",
                "name": "Industrials",
                "correlation": 0.526
            },
            {
                "key": "communication",
                "name": "Communication Services",
                "correlation": 0.458
            },
            {
                "key": "materials",
                "name": "Materials",
                "correlation": 0.446
            },
            {
                "key": "financials",
                "name": "Financials",
                "correlation": 0.351
            },
            {
                "key": "health_care",
                "name": "Health Care",
                "correlation": 0.087
            },
            {
                "key": "real_estate",
                "name": "Real Estate",
                "correlation": 0.082
            },
            {
              
…(truncated, see openapi.json for full schema)
```

### Sectors

#### `GET /v1/sectors` — The eleven S&P 500 sectors

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sectorcorrelation-api/v1/sectors"
```

**Response:**
```json
{
    "data": {
        "note": "The eleven S&P 500 GICS sectors (via SPDR sector ETFs). Pass key/alias as sector= to /v1/sector.",
        "count": 11,
        "source": "Yahoo Finance",
        "sectors": [
            {
                "etf": "XLK",
                "key": "technology",
                "name": "Technology"
            },
            {
                "etf": "XLF",
                "key": "financials",
                "name": "Financials"
            },
            {
                "etf": "XLE",
                "key": "energy",
                "name": "Energy"
            },
            {
                "etf": "XLV",
                "key": "health_care",
                "name": "Health Care"
            },
            {
                "etf": "XLY",
                "key": "consumer_discretionary",
                "name": "Consumer Discretionary"
            },
            {
                "etf": "XLP",
                "key": "consumer_staples",
                "name": "Consumer Staples"
            },
            {
                "etf": "XLI",
                "key": "industrials",
                "name": "Industrials"
            },
            {
                "etf": "XLB",
                "key": "materials",
                "name": "Materials"
            },
            {
                "etf": "XLU",
                "key": "utilities",
                "name": "Utilities"
            },
            {
                "etf": "XLRE",
                "key"
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Service metadata

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sectorcorrelation-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "window is 20-365 days (default 90). Correlations use daily log returns aligned on common trading days. Beta is measured against SPY. Read fresh per call, nothing cached.",
        "source": "Yahoo Finance daily SPDR sector ETF closes, live",
        "service": "sectorcorrelation-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/matrix": "Full 11x11 sector correlation matrix with most/least correlated pairs (window=90).",
            "GET /v1/sector": "One sector's correlations to all others, ranked, with beta to the S&P 500 (sector=technology, window=90).",
            "GET /v1/sectors": "The eleven S&P 500 sectors."
        },
        "description": "Stock sector correlation matrix — how the eleven S&P 500 sectors move together, live from Yahoo Finance via the SPDR sector ETFs (no key, nothing stored). matrix returns the full pairwise return-correlation matrix with the most- and least-correlated sector pairs. sector returns one sector's correlation to every other, ranked, plus its beta to the S&P 500. sectors lists what is covered. The equity sector correlation / rotation cut — distinct from the cross-asset correlation matrix, the crypto and currency correlation APIs and the sector price/performance feed.",
        "sectors_loaded": 11,
        "upstream_status": "ok",
        "sectors_supported": 11
    },
    "meta": {
        "timestamp": "2026-06-12T10:35:13.551Z",
        "request_id": "6
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/sectorcorrelation-api
OpenAPI spec: https://www.oanor.com/api/sectorcorrelation-api/openapi.json
