polymarket-raw-5m / README.md
krish301's picture
docs: README for 5m raw data collector
03b64a0 verified
|
Raw
History Blame Contribute Delete
6.2 kB
---
license: mit
task_categories:
- time-series-forecasting
- tabular-regression
tags:
- polymarket
- prediction-market
- cryptocurrency
- bitcoin
- ethereum
- on-chain
- trade-data
- orderbook
size_categories:
- 100K<n<1M
---
# Polymarket Raw Data — 5m Up-or-Down Windows
**Continuous live collection of every single trade and orderbook tick on Polymarket's 5m Bitcoin/Ethereum/Solana/XRP/Dogecoin/BNB/Hype "Up or Down" prediction markets.**
This dataset is built for institutional quantitative research. It captures **complete user trade activity** with **every available metadata field** from the Polymarket APIs, **plus the full live orderbook** at every resolution boundary.
## Coverage
- **Assets:** btc, eth, sol, xrp, doge, bnb, hype
- **Duration:** 5m
- **Window size:** 300 seconds
- **Polling interval:** 5s during the window (orderbook), 30s for trade tape refresh
- **Storage:** Per-window JSONL files (one file per market resolution)
- **Collection start:** 2026-06-04
## Data sources (no synthetic data, no nulls)
For every 5m window that resolves, we capture:
1. **Market metadata** (from Gamma `keyset`): `conditionId`, `slug`, `question`, `description`, `endDate`, `closedTime`, `tickSize`, `minOrderSize`, `negRisk`, `outcomes`, `clobTokenIds`, `icon`, `image`, `category`, `tags`, `volumeNum`, `liquidity`, `commentCount`, `createdAt`, `updatedAt`, `closed`, `active`, `archived`, `restricted`, `featured`, `new`, `groupBy`, `events`, and the full `markets` record.
2. **Full trade tape** (from `data-api.polymarket.com/trades?conditionId=...&limit=500`): every fill with 19 fields: `proxyWallet`, `side`, `asset`, `conditionId`, `size`, `price`, `timestamp`, `title`, `slug`, `eventSlug`, `outcome`, `outcomeIndex`, `name`, `pseudonym`, `bio`, `profileImage`, `profileImageOptimized`, `transactionHash`.
3. **Live orderbook snapshots** (from `clob.polymarket.com/book?token_id=...`): at the end of each window, the full L2 orderbook for both up and down tokens. Each snapshot has `bids`, `asks`, `timestamp`, `hash`, `tick_size`, `min_order_size`, `last_trade_price`.
4. **On-chain event log** (from Goldsky v1 subgraph + Polygon v2 RPC): the underlying `OrderFilled` events that ground the trade tape. Includes `transactionHash`, `maker`, `taker`, `makerAssetId`, `takerAssetId`, `makerAmountFilled`, `takerAmountFilled` for verification.
## File layout
```
data/
btc/
2026-06-04/
btc-updown-5m-1780534500/
meta.json # Market metadata (all Gamma fields)
trades.jsonl # All trade tape (19 fields per row)
orderbook_snapshots.jsonl # L2 orderbook snapshots
onchain_events.jsonl # OrderFilled events for this market
resolve.json # Resolution: final price, winner, volume, etc.
README.md
```
## Schema — trades.jsonl (one row per fill)
| Field | Type | Description |
|---|---|---|
| `proxyWallet` | string | The user's wallet address (lowercase) |
| `side` | string | `BUY` or `SELL` (from user's perspective) |
| `asset` | string | The tokenId being traded (decimal string) |
| `conditionId` | string | The CTF conditionId (hex with 0x prefix) |
| `size` | number | Number of shares |
| `price` | number | Price in [0, 1] |
| `timestamp` | number | Unix epoch seconds (when the order was placed) |
| `title` | string | Market question |
| `slug` | string | `{ASSET}-updown-5m-{{epoch}}` |
| `eventSlug` | string | Same as slug for these markets |
| `outcome` | string | `Up` or `Down` |
| `outcomeIndex` | number | `0` (Up) or `1` (Down) |
| `name` | string | The user's display name (Polymarket profile) |
| `pseudonym` | string | The user's pseudonym (Polymarket profile) |
| `bio` | string | The user's bio |
| `profileImage` | string | URL to profile image (or empty) |
| `profileImageOptimized` | string | Optimized CDN URL |
| `transactionHash` | string | The on-chain transaction hash (for verification) |
## Schema — orderbook_snapshots.jsonl (one row per snapshot)
| Field | Type | Description |
|---|---|---|
| `timestamp` | number | Unix epoch ms when snapshot was taken |
| `token_id` | string | The token being snapshotted |
| `outcome` | string | `Up` or `Down` |
| `bids` | array of `price, size` | Sorted descending by price |
| `asks` | array of `price, size` | Sorted ascending by price |
| `tick_size` | number | Minimum price increment |
| `min_order_size` | number | Minimum order size |
| `last_trade_price` | number | Last trade price at snapshot time |
| `hash` | string | CLOB orderbook hash for integrity |
## Schema — meta.json
A full snapshot of the Gamma `markets` record for this market (40+ fields). No fields are dropped.
## Schema — onchain_events.jsonl
One row per `OrderFilled` event from the Goldsky v1 subgraph or Polygon v2 RPC:
| Field | Type | Description |
|---|---|---|
| `id` | string | `{txHash}_{logIndex}` |
| `timestamp` | number | Unix epoch seconds |
| `maker` | string | Maker address |
| `taker` | string | Taker address |
| `makerAssetId` | string | Token being sold by maker (0 for USDC) |
| `takerAssetId` | string | Token being acquired by maker (0 for USDC) |
| `makerAmountFilled` | number | Amount (6-decimal) |
| `takerAmountFilled` | number | Amount (6-decimal) |
| `transactionHash` | string | On-chain transaction hash |
## Usage
```python
from datasets import load_dataset
ds = load_dataset("krish301/polymarket-raw-5m")
```
Or directly:
```python
import json
with open("data/btc/2026-06-04/btc-updown-5m-1780534500/trades.jsonl") as f:
for line in f:
trade = json.loads(line)
print(trade["proxyWallet"], trade["side"], trade["price"], trade["size"])
```
## Provenance
- Collected from public Polymarket APIs (`gamma-api.polymarket.com`, `data-api.polymarket.com`, `clob.polymarket.com`)
- Cross-referenced with the Goldsky v1 subgraph (project_cl6mb8i9h0003e201j6li0diw) and Polygon v2 CTF Exchange contract (0xE111180000d2663C0091e4f400237545B87B996B)
- No PII is collected beyond what is publicly visible on Polymarket profiles
## License
MIT
## Maintainer
Collected continuously from an AWS EC2 instance running a custom collector service.