# Variance Ratio Test API
> A formal statistical test of whether a market follows a random walk, or whether its returns carry tradeable momentum or mean-reversion that is real rather than noise — the Lo-MacKinlay variance ratio test, computed live from Yahoo Finance daily closes, no key, nothing stored. Most persistence tools give you a single descriptive number; this gives you a hypothesis test with a verdict. The variance ratio compares the variance of multi-day returns to the variance of one-day returns scaled up: under a true random walk the ratio is 1 at every horizon. A ratio above 1 means returns positively autocorrelate (trends persist — momentum); below 1 means they reverse (mean-reversion). Crucially it attaches a heteroskedasticity-robust z-statistic and a p-value at each horizon, so you know whether the deviation from a random walk is statistically significant or just sampling noise — the thing a point estimate cannot tell you. The asset endpoint runs the test at horizons of 2, 4, 8 and 16 days and returns each ratio, z-statistic, p-value and a reject/fail-to-reject verdict, plus an overall read. The screener endpoint ranks the cross-asset universe by their 2-day variance ratio, separating the statistically momentum-like markets from the mean-reverting ones. This is the random-walk hypothesis-test cut — distinct from the Hurst-exponent regime API (a point estimate with no significance), the momentum and the price APIs. It is the test, with the p-value attached.

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

## Pricing
- **Free** (Free) — 715 calls/Mo, 2 req/s
- **Starter** ($13/Mo) — 15,100 calls/Mo, 6 req/s
- **Pro** ($37/Mo) — 82,500 calls/Mo, 16 req/s
- **Mega** ($81/Mo) — 476,000 calls/Mo, 40 req/s

## Endpoints

### Screener

#### `GET /v1/screener` — Rank the universe by the 2-day variance ratio test

**Parameters:**
- `metric` (query, optional, string) — significance, momentum or reversion Example: `significance`
- `window` (query, optional, string) — Lookback in trading days (252-2520) Example: `756`
- `class` (query, optional, string) — equity, sector, commodity, bond, fx, crypto or all Example: `all`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/varianceratio-api/v1/screener?metric=significance&window=756&class=all"
```

**Response:**
```json
{
    "data": {
        "note": "Ranked by the 2-day variance ratio test. vr2 > 1 = momentum, < 1 = mean-reversion; |z2| >= 1.96 (p < 0.05) means the market is statistically distinguishable from a random walk at the 2-day horizon. metric=momentum ranks high VR first, reversion low VR first, significance by |z|. Read fresh per call, nothing cached.",
        "class": "all",
        "count": 19,
        "metric": "significance",
        "source": "Yahoo Finance",
        "horizon": 2,
        "results": [
            {
                "z2": -1.2,
                "vr2": 0.944,
                "name": "Emerging Markets",
                "rank": 1,
                "class": "index",
                "abs_z2": 1.2,
                "symbol": "EEM",
                "available": true,
                "p_value_2": 0.2311,
                "overall_verdict": "random walk — no horizon rejects the random-walk hypothesis at 95%"
            },
            {
                "z2": -0.98,
                "vr2": 0.938,
                "name": "Nasdaq 100 ETF",
                "rank": 2,
                "class": "index",
                "abs_z2": 0.98,
                "symbol": "QQQ",
                "available": true,
                "p_value_2": 0.3285,
                "overall_verdict": "random walk — no horizon rejects the random-walk hypothesis at 95%"
            },
            {
                "z2": -0.97,
                "vr2": 0.959,
                "name": "20Y+ Treasuries",
       
…(truncated, see openapi.json for full schema)
```

### Asset

#### `GET /v1/asset` — Full variance ratio test at horizons 2/4/8/16 with z-stats and p-values

**Parameters:**
- `symbol` (query, required, string) — Universe symbol Example: `SPY`
- `window` (query, optional, string) — Lookback in trading days (252-2520) Example: `756`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/varianceratio-api/v1/asset?symbol=SPY&window=756"
```

**Response:**
```json
{
    "data": {
        "name": "S&P 500 ETF",
        "note": "Lo-MacKinlay variance ratio test at horizons 2/4/8/16 days. variance_ratio = 1 under a random walk; > 1 = momentum (positive autocorrelation), < 1 = mean-reversion. z_stat is heteroskedasticity-robust; |z| >= 1.96 rejects the random walk at 95% (p < 0.05). Read fresh per call, nothing cached.",
        "class": "index",
        "source": "Yahoo Finance",
        "symbol": "SPY",
        "horizons": [
            {
                "q": 2,
                "z_stat": -0.72,
                "p_value": 0.47,
                "verdict": "random walk (cannot reject at 95%)",
                "variance_ratio": 0.936
            },
            {
                "q": 4,
                "z_stat": -0.51,
                "p_value": 0.6085,
                "verdict": "random walk (cannot reject at 95%)",
                "variance_ratio": 0.924
            },
            {
                "q": 8,
                "z_stat": -0.7,
                "p_value": 0.4818,
                "verdict": "random walk (cannot reject at 95%)",
                "variance_ratio": 0.837
            },
            {
                "q": 16,
                "z_stat": -0.63,
                "p_value": 0.5318,
                "verdict": "random walk (cannot reject at 95%)",
                "variance_ratio": 0.804
            }
        ],
        "window_days": 756,
        "overall_verdict": "random walk — no horizon rejects the random-walk hypothesis at
…(truncated, see openapi.json for full schema)
```

### Universe

#### `GET /v1/universe` — The cross-asset universe and its classes

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

**Response:**
```json
{
    "data": {
        "note": "The cross-asset universe the screener ranks. Pass class= to a screener call to rank within one class.",
        "count": 19,
        "assets": [
            {
                "name": "S&P 500 ETF",
                "class": "index",
                "symbol": "SPY"
            },
            {
                "name": "Nasdaq 100 ETF",
                "class": "index",
                "symbol": "QQQ"
            },
            {
                "name": "US Small Caps",
                "class": "index",
                "symbol": "IWM"
            },
            {
                "name": "Developed ex-US",
                "class": "index",
                "symbol": "EFA"
            },
            {
                "name": "Emerging Markets",
                "class": "index",
                "symbol": "EEM"
            },
            {
                "name": "Technology Sector",
                "class": "sector",
                "symbol": "XLK"
            },
            {
                "name": "Financials Sector",
                "class": "sector",
                "symbol": "XLF"
            },
            {
                "name": "Energy Sector",
                "class": "sector",
                "symbol": "XLE"
            },
            {
                "name": "Utilities Sector",
                "class": "sector",
                "symbol": "XLU"
            },
            {
                "name": "Gold ETF",
                "class": "com
…(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/varianceratio-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "metric is significance (default), momentum or reversion. window is 252-2520 trading days (default 756, ~3 years). class filters to equity/sector/commodity/bond/fx/crypto (default all). The test follows Lo & MacKinlay (1988) with overlapping observations and a heteroskedasticity-robust z. |z| >= 1.96 rejects the random walk at 95%. Read fresh per call, nothing cached.",
        "source": "Yahoo Finance daily closes, live",
        "classes": [
            "index",
            "sector",
            "commodity",
            "bond",
            "fx",
            "crypto"
        ],
        "metrics": [
            "momentum",
            "reversion",
            "significance"
        ],
        "service": "varianceratio-api",
        "horizons": [
            2,
            4,
            8,
            16
        ],
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/asset": "Full variance ratio test at horizons 2/4/8/16 with z-stats, p-values and verdicts (symbol=SPY, window=756).",
            "GET /v1/screener": "Rank the universe by the 2-day variance ratio test (metric=significance, window=756, class=all).",
            "GET /v1/universe": "The cross-asset universe and its classes."
        },
        "description": "Variance ratio test (Lo-MacKinlay) — a formal statistical test of whether a market follows a random walk or carries real momentum or mean-reversion, live from Yahoo Finance daily closes (
…(truncated, see openapi.json for full schema)
```


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