# Crypto-to-Macro Correlation API
> Whether crypto is trading as a risk asset or a hedge, measured by how closely a coin moves with the stock market, gold and the dollar — computed live from Binance and Yahoo Finance, no key, nothing stored. The single most-asked macro question about crypto is whether it is "digital gold" or just high-beta tech; this answers it with numbers. The correlation endpoint returns, for a coin (BTC or ETH), its return correlation to the S&P 500, the Nasdaq 100, gold and the US dollar index over a chosen window, each with a plain-language read (risk-on if it tracks stocks, a hedge if it tracks gold or moves against the dollar) and an overall verdict. The beta endpoint returns the coin's beta to the S&P 500 — how much it amplifies equity moves — with the correlation and R-squared. This is the cross-asset / crypto-versus-traditional-markets correlation cut — distinct from the crypto-to-crypto correlation API (coins against each other), the realised-volatility and the price APIs in the catalogue. Correlations use daily log returns aligned on common trading days; coin is BTC or ETH, window 20-365 days.

## 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/cryptomacro-api/..."
```

## Pricing
- **Free** (Free) — 400 calls/Mo, 2 req/s
- **Starter** ($12/Mo) — 11,000 calls/Mo, 6 req/s
- **Pro** ($37/Mo) — 67,000 calls/Mo, 16 req/s
- **Business** ($85/Mo) — 340,000 calls/Mo, 40 req/s

## Endpoints

### Macro

#### `GET /v1/beta` — Beta to the S&P 500

**Parameters:**
- `coin` (query, required, string) — BTC or ETH Example: `BTC`
- `window` (query, optional, string) — Lookback in days (20-365, default 90) Example: `90`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cryptomacro-api/v1/beta?coin=BTC&window=90"
```

**Response:**
```json
{
    "data": {
        "beta": 1.063,
        "coin": "BTC",
        "note": "beta = cov(coin, S&P 500) / var(S&P 500) on daily log returns. beta > 1 means the coin amplifies equity moves; beta near 0 means it moves independently of stocks.",
        "source": "Binance + Yahoo Finance",
        "benchmark": "S&P 500",
        "r_squared": 0.221,
        "correlation": 0.47,
        "window_days": 90,
        "observations": 65
    },
    "meta": {
        "timestamp": "2026-06-12T10:35:30.290Z",
        "request_id": "9ff4127a-f924-4885-abd5-4ff4ecca11a7"
    },
    "status": "ok",
    "message": "Beta retrieved successfully",
    "success": true
}
```

#### `GET /v1/correlation` — Correlation to stocks, gold & the dollar

**Parameters:**
- `coin` (query, required, string) — BTC or ETH Example: `BTC`
- `window` (query, optional, string) — Lookback in days (20-365, default 90) Example: `90`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cryptomacro-api/v1/correlation?coin=BTC&window=90"
```

**Response:**
```json
{
    "data": {
        "coin": "BTC",
        "note": "Pearson correlation of daily log returns over window_days, aligned on common trading days. High S&P correlation = crypto trades risk-on; high gold correlation / negative dollar correlation = more hedge-like.",
        "source": "Binance + Yahoo Finance",
        "verdict": "trading as a risk asset (more stock- than gold-like)",
        "window_days": 90,
        "correlations": [
            {
                "read": "moderately risk-on",
                "asset": "sp500",
                "label": "S&P 500",
                "correlation": 0.47,
                "observations": 65
            },
            {
                "read": "moderately risk-on",
                "asset": "nasdaq",
                "label": "Nasdaq 100",
                "correlation": 0.479,
                "observations": 65
            },
            {
                "read": "little gold link",
                "asset": "gold",
                "label": "Gold",
                "correlation": 0.247,
                "observations": 66
            },
            {
                "read": "mild dollar sensitivity",
                "asset": "dxy",
                "label": "US Dollar Index",
                "correlation": -0.289,
                "observations": 66
            }
        ]
    },
    "meta": {
        "timestamp": "2026-06-12T10:35:30.787Z",
        "request_id": "ee139f03-d531-43b8-9fae-a6d9838660d3"
    },
    "status": "ok",
    "message"
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Spec

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

**Response:**
```json
{
    "data": {
        "note": "coin is BTC or ETH. window is 20-365 days (default 90). Correlations use daily log returns aligned on common trading days (stocks trade weekdays; crypto 24/7). Read fresh per call, nothing cached.",
        "coins": [
            "BTC",
            "ETH"
        ],
        "source": "Binance daily candles + Yahoo Finance chart (S&P 500, Nasdaq 100, gold, US dollar index), live",
        "service": "cryptomacro-api",
        "endpoints": {
            "GET /v1/beta": "Beta to the S&P 500 with correlation and R-squared (coin=BTC, window=90).",
            "GET /v1/meta": "This document.",
            "GET /v1/correlation": "Correlation to S&P 500, Nasdaq, gold and the dollar, with a risk-asset/hedge verdict (coin=BTC, window=90)."
        },
        "benchmarks": [
            "sp500",
            "nasdaq",
            "gold",
            "dxy"
        ],
        "description": "Crypto-to-macro correlation — whether crypto trades as a risk asset or a hedge, by how closely a coin moves with stocks, gold and the dollar (no key, nothing stored). correlation returns a coin's return correlation to the S&P 500, Nasdaq 100, gold and the US dollar index over a window, each with a plain read and an overall verdict. beta returns the coin's beta to the S&P 500. The cross-asset / crypto-versus-traditional-markets cut — distinct from the crypto-to-crypto correlation API, the realised-volatility and price APIs.",
        "upstream_status": "ok",
        "
…(truncated, see openapi.json for full schema)
```


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