---
name: signals-archive
description: >-
  Query and analyze Predict.fun BTC 5-minute up/down market archive data from
  The Blue Signals (https://archive.bluesignals.xyz). Supports fast inspection of the latest finished
  5m window (~65s after close), 48h hot window browsing, historical daily
  summaries, and remote HTTP Range DuckDB queries over Apache Parquet.
---

# The Blue Signals Archive (`https://archive.bluesignals.xyz`)

Public, cleaned Apache Parquet and JSON archive for Predict.fun BTC 5-minute Up/Down markets (`pf/btc-5m`).

## Golden Rule for Agents

**Never download full-day Parquet files just to inspect a few windows.**

1. Start with the lightweight JSON endpoints or MCP tools (`~3 KB` per 5m window, `~20 KB` per day) to find the exact `slug` or `windowStartTs` you care about.
2. Only read Parquet when you need tick-level trades or frame-level order books — and query them **directly over HTTPS using DuckDB HTTP Range** so only the needed columns and row groups are fetched.

## Remote MCP Server

Mount the stateless Streamable HTTP MCP endpoint directly (no local install required):

```text
https://archive.bluesignals.xyz/mcp
```

Available MCP tools:
- `list_datasets` — available datasets, coverage dates, latest 5m window, and full column schemas.
- `get_latest_window` — full summary of the most recently completed 5m window (published ~65s after window close), including `startPrice`, official `winner`, volume, top 5 wallets, 30×10s trajectory bars, and direct Parquet URLs (~370 KB total).
- `list_recent_windows` — filter the last 48 hours of 5m windows by `winner` or `minVolumeUsd`.
- `query_windows` — filter any historical UTC date's 288 windows from its ~20 KB `day.json`.
- `get_parquet_access` — resolve exact Parquet HTTPS URLs + ready-to-run DuckDB SQL for a window or date range.

## HTTP API Quick Reference

| Purpose | Endpoint |
|---|---|
| Catalog | `GET https://archive.bluesignals.xyz/api/catalog` |
| Available UTC dates | `GET https://archive.bluesignals.xyz/api/pf/btc-5m/dates` |
| Latest finished 5m window (~3 KB) | `GET https://archive.bluesignals.xyz/api/pf/btc-5m/windows/latest` |
| Last 48h windows list | `GET https://archive.bluesignals.xyz/api/pf/btc-5m/recent?limit=24` |
| Specific 5m window summary | `GET https://archive.bluesignals.xyz/api/pf/btc-5m/windows/{slug_or_startTs}` |
| Parquet / JSON direct file (HTTP Range) | `GET https://archive.bluesignals.xyz/files/{key}` |
| Daily ZIP bundle | `GET https://archive.bluesignals.xyz/download/pf/btc-5m/{YYYY-MM-DD}/all.zip` |

## Remote DuckDB Recipes (No Full Download Needed)

### 1. Inspect the latest finished 5-minute window
```bash
curl -s https://archive.bluesignals.xyz/api/pf/btc-5m/windows/latest | jq '{slug, startPrice, winner, stats, topWallets, files}'
```

### 2. Analyze tick-level trades for one recent 5-minute window (~150–260 KB)
```sql
-- Replace <START_TS> with startTs from /api/pf/btc-5m/windows/latest
SELECT
  to_timestamp(ts / 1000.0) AS exec_time,
  outcome,
  side,
  px,
  sz,
  taker.signer AS taker_wallet
FROM read_parquet('https://archive.bluesignals.xyz/files/v1/pf/btc-5m/recent/windows/<START_TS>/trades.parquet')
ORDER BY ts ASC
LIMIT 50;
```

### 3. Slice specific windows from a historical daily Parquet via HTTP Range
```sql
-- Filter by windowStartTs so DuckDB prunes row groups over HTTP Range
SELECT
  slug,
  count(*) AS trades,
  round(sum(px * sz), 2) AS volume_usd,
  round(avg(CASE WHEN outcome = 'YES' THEN px ELSE 1 - px END), 4) AS avg_yes_px
FROM read_parquet('https://archive.bluesignals.xyz/files/v1/pf/btc-5m/daily/2026-09-27/trades.parquet')
WHERE windowStartTs IN (1790522400, 1790522700)
GROUP BY slug
ORDER BY slug;
```

### 4. Inspect best bid/ask spread evolution in a window
```sql
SELECT
  (ts / 1000 - windowStartTs) AS offset_sec,
  bids[1][1] AS best_yes_bid,
  asks[1][1] AS best_yes_ask,
  round(asks[1][1] - bids[1][1], 4) AS spread
FROM read_parquet('https://archive.bluesignals.xyz/files/v1/pf/btc-5m/recent/windows/<START_TS>/books.parquet')
WHERE len(bids) > 0 AND len(asks) > 0
ORDER BY ts ASC;
```

## Canonical Schemas

- **`trades.parquet`**: `t`, `ts`, `mkt`, `slug`, `windowStartTs`, `outcome` (`YES`|`NO`), `side` (`buy`|`sell`), `px`, `sz`, `id`, `tx`, `taker`, `makers`
- **`books.parquet`**: `t`, `ts`, `mkt`, `slug`, `windowStartTs`, `bids` (`[px, sz][]`), `asks` (`[px, sz][]`) — YES(UP)-priced; Down is `1 - px`
- **`windows.parquet`**: `slug`, `mkt`, `startTs`, `endTs`, `upTokenId`, `downTokenId`, `feeRateBps`, `decimalPrecision`, `startPrice`, `winner` (`UP`|`DOWN`|`NULL`), `tradeCount`, `bookCount`, `volumeShares`, `volumeUsd`, `uniqueWallets`
