# Streak Analysis & Reversal Odds API
> The consecutive up- and down-day runs swing-traders fade, with the historical probability that a run reverses, computed live from Yahoo Finance daily closes — no key, nothing stored. "It has gone up five days in a row, it is due a pullback" is a guess until you put a number on it. This API counts every up- and down-day run in an instrument's history and measures, for each run length, how often the very next day reversed it — turning a gut feeling into a base rate. For each instrument it returns the current streak (its direction and length), the longest up and down streaks in the window, the average run length, the full distribution of run lengths, and the reversal table: after k consecutive up (or down) days, the share of times the next day went the other way, with the sample size behind each figure. If a name is currently on a streak it also returns the historical odds that tomorrow reverses it — the one number a mean-reversion trader wants. The asset endpoint returns one instrument's full streak profile; the screener endpoint ranks the universe by how stretched each is right now (current streak length), so you can see what is most extended. This is the consecutive-run / reversal-odds cut — distinct from the Hurst persistence-regime API, the multi-timeframe momentum API, the candlestick-pattern API and the price feeds. It is the runs, counted, with the odds 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/streak-api/..."
```

## Pricing
- **Free** (Free) — 715 calls/Mo, 2 req/s
- **Starter** ($12/Mo) — 15,400 calls/Mo, 6 req/s
- **Pro** ($35/Mo) — 86,500 calls/Mo, 16 req/s
- **Mega** ($79/Mo) — 474,000 calls/Mo, 40 req/s

## Endpoints

### Screener

#### `GET /v1/screener` — Rank the universe by current streak, reversal odds or longest streak

**Parameters:**
- `metric` (query, optional, string) — current_streak, reversal or longest Example: `current_streak`
- `window` (query, optional, string) — Lookback in trading days (120-2000) Example: `504`
- `class` (query, optional, string) — index, sector, commodity, bond, stock, crypto or all Example: `all`

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

**Response:**
```json
{
    "data": {
        "note": "Ranked by current_streak over window_days of daily closes. current_streak_length is how many consecutive up/down days the instrument is on right now; current_reversal_prob_pct is the historical share of times a streak of that length reversed the next day. Read fresh per call, nothing cached.",
        "class": "all",
        "count": 20,
        "metric": "current_streak",
        "source": "Yahoo Finance",
        "results": [
            {
                "name": "Utilities Sector",
                "rank": 1,
                "class": "sector",
                "symbol": "XLU",
                "available": true,
                "longest_overall": 8,
                "current_direction": "up",
                "abs_current_streak": 3,
                "current_streak_length": 3,
                "current_reversal_prob_pct": 23.5
            },
            {
                "name": "Apple",
                "rank": 2,
                "class": "stock",
                "symbol": "AAPL",
                "available": true,
                "longest_overall": 8,
                "current_direction": "up",
                "abs_current_streak": 2,
                "current_streak_length": 2,
                "current_reversal_prob_pct": 40.8
            },
            {
                "name": "Bitcoin",
                "rank": 3,
                "class": "crypto",
                "symbol": "BTC-USD",
                "available": true,
                "longest_
…(truncated, see openapi.json for full schema)
```

### Asset

#### `GET /v1/asset` — Full streak profile with reversal tables and today's odds

**Parameters:**
- `symbol` (query, required, string) — Universe symbol Example: `SPY`
- `window` (query, optional, string) — Lookback in trading days (120-2000) Example: `504`

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

**Response:**
```json
{
    "data": {
        "name": "S&P 500 ETF",
        "note": "An up day is a close at or above the prior close. The reversal tables give, for each run length, the empirical share of times the next day reversed the run. current_reversal_prob_pct applies that to the current streak. Base rates need >=4 occurrences or are null. Read fresh per call, nothing cached.",
        "read": "on a 1-day up streak; historically 46% of streaks this long reversed down the next day",
        "class": "index",
        "source": "Yahoo Finance",
        "symbol": "SPY",
        "window_days": 504,
        "observations": 504,
        "avg_up_streak": 2.32,
        "current_streak": {
            "length": 1,
            "direction": "up"
        },
        "avg_down_streak": 1.71,
        "longest_overall": 9,
        "longest_up_streak": 9,
        "up_reversal_table": {
            "1": {
                "occurrences": 124,
                "reversal_prob_pct": 46
            },
            "2": {
                "occurrences": 67,
                "reversal_prob_pct": 44.8
            },
            "3": {
                "occurrences": 37,
                "reversal_prob_pct": 32.4
            },
            "4": {
                "occurrences": 25,
                "reversal_prob_pct": 32
            },
            "5+": {
                "occurrences": 36,
                "reversal_prob_pct": 47.2
            }
        },
        "down_reversal_table": {
            "1": {
                "o
…(truncated, see openapi.json for full schema)
```

### Universe

#### `GET /v1/universe` — The universe and its classes

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

**Response:**
```json
{
    "data": {
        "note": "The universe the screener ranks. Pass class= to a screener call to rank within one class.",
        "count": 20,
        "assets": [
            {
                "name": "S&P 500 ETF",
                "class": "index",
                "symbol": "SPY"
            },
            {
                "name": "Nasdaq 100 ETF",
                "class": "index",
                "symbol": "QQQ"
            },
            {
                "name": "Russell 2000 ETF",
                "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": "commodity",

…(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/streak-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "metric is current_streak (default, most extended now), reversal or longest. window is 120-2000 trading days (default 504, ~2 years, for robust base rates). class filters to index/sector/commodity/bond/stock/crypto (default all). An up day is a close at or above the prior close. Read fresh per call, nothing cached.",
        "source": "Yahoo Finance daily closes, live",
        "classes": [
            "index",
            "sector",
            "commodity",
            "bond",
            "stock",
            "crypto"
        ],
        "metrics": [
            "current_streak",
            "reversal",
            "longest"
        ],
        "service": "streak-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/asset": "Full streak profile with reversal tables and today's odds (symbol=SPY, window=504).",
            "GET /v1/screener": "Rank the universe by current streak length, reversal odds or longest streak (metric=current_streak, window=504, class=all).",
            "GET /v1/universe": "The universe and its classes."
        },
        "description": "Streak analysis & reversal odds — the consecutive up- and down-day runs swing-traders fade, with the historical probability a run reverses, live from Yahoo Finance daily closes (no key, nothing stored). For each instrument it returns the current streak (direction and length), the longest up/down streaks, the average run length, the run-length di
…(truncated, see openapi.json for full schema)
```


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