Datasets:
File size: 9,350 Bytes
401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb b85406f 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb f7a8587 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 93ae5bb 401e053 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | ---
license: cc-by-4.0
language:
- en
pretty_name: Polymarket Quant Bench — OHLCV bars for high-liquidity resolved markets
size_categories:
- 10M<n<100M
task_categories:
- other
tags:
- polymarket
- prediction-markets
- blockchain
- polygon
- market-microstructure
- ohlcv
- backtesting
- quantitative-finance
configs:
- config_name: markets
data_files:
- split: train
path: "polymarket/markets/markets_*.parquet"
- config_name: bars_hourly
data_files:
- split: train
path: "polymarket/bars_hourly/bars_*.parquet"
- config_name: bars_daily
data_files:
- split: train
path: "polymarket/bars_daily/bars_*.parquet"
---
# Polymarket Quant Bench — OHLCV bars for high-liquidity resolved markets
A teaching-grade derivative of the [Polymarket](https://polymarket.com)
on-chain trade history, designed for indicator-engineering and
walk-forward back-testing assignments. Polymarket is a decentralised
prediction market on the Polygon blockchain; binary contracts settle to
one USDC if the underlying event occurs and zero otherwise.
This release replaces the per-trade fill stream of the upstream dataset
with **per-token OHLCV bars** at hourly and daily resolution, restricted
to high-liquidity *resolved* markets so every market has a known outcome
for P&L scoring and enough depth for rolling indicators.
## Contents
| File group | Rows | Description |
|---|---:|---|
| `polymarket/markets/markets_*.parquet` | 36,831 | One row per resolved market with cumulative volume >= $100,000 and >= 200 on-chain trade fills. Full upstream schema plus a `category` column. |
| `polymarket/bars_hourly/bars_*.parquet` | 12,655,266 | One row per `(token_id, calendar hour)` with OHLCV plus trade and direction counts. |
| `polymarket/bars_daily/bars_*.parquet` | 1,462,282 | One row per `(token_id, calendar day)`, aggregated from the hourly bars. |
Each file group is chunked into 10,000-row parquet shards.
## Provenance and attribution
The raw market metadata and trade events were collected and released by
**Jon Becker** at
[https://github.com/jon-becker/prediction-market-analysis](https://github.com/jon-becker/prediction-market-analysis).
This dataset is a derivative: market metadata is restricted to the
filter described below and trades are aggregated into OHLCV bars. If you
use this dataset, please also cite Jon Becker's release.
## How prices are computed
Each on-chain `OrderFilled` event swaps **USDC** for an **outcome
token** (or vice versa). Both assets use 6 decimals, so the raw atomic
ratio of USDC to token quantity is already a dimensionless probability
in `[0, 1]` -- the price the Polymarket UI shows in cents-per-dollar.
For each trade `t`:
```
if t.maker_asset_id == '0': # maker delivered USDC, taker delivered tokens
usdc_amount = t.maker_amount
token_amount = t.taker_amount
taker_is_seller = True # taker handed over tokens -> sold
else: # maker delivered tokens, taker delivered USDC
usdc_amount = t.taker_amount
token_amount = t.maker_amount
taker_is_seller = False # taker handed over USDC -> bought
price = usdc_amount / token_amount # in [0, 1]
volume_usd = usdc_amount / 1e6 # in USD
signed_size = (-1 if taker_is_seller else +1) * token_amount / 1e6
```
`price` is the implied probability of the outcome the token represents.
## How bars are aggregated
For each `(token_id, bar_period)` group:
| Field | Formula |
|---|---|
| `open` | `price` of the first trade in the bar (ordered by `block_number, log_index`) |
| `high` | `MAX(price)` |
| `low` | `MIN(price)` |
| `close` | `price` of the last trade |
| `vwap` | `SUM(price * volume_usd) / SUM(volume_usd)` |
| `volume_usd` | `SUM(volume_usd)` |
| `n_trades` | total fills in the bar |
| `n_buys` / `n_sells` | fills where the taker bought / sold outcome tokens |
Bars are emitted **only when at least one trade occurred in the period**
(sparse representation). Use `tidyr::fill()` or
`data.table::nafill()` to forward-fill if a dense series is required by
your indicator.
The hour boundary is defined by `block_number // 1800` (Polygon ~2 s per
block; 1 800 blocks = 1 hour). Wall-clock `period_start` is attached
post-aggregation by looking up the first block of each hour in the
blocks-timestamp index and extrapolating forward at 2 seconds per
block.
Bars are emitted **per token** rather than per market. A Polymarket
market has two complementary tokens (YES and NO); the `markets` table
exposes both via `clob_token_ids`. If you want a single market-level
mid-price series, pair the two token series yourself.
## Filter applied to upstream markets
A market is included iff **all** of the following hold:
1. The market is **resolved** (one outcome price closed above 0.99 in
the upstream snapshot).
2. **Cumulative trading volume >= $100,000** -- removes the long
tail of dust markets.
3. **At least 200 on-chain trade fills** -- ensures enough
depth to compute rolling indicators meaningfully.
This intentionally trades coverage for per-market depth. About
36,831 markets remain out of the ~409 k in the upstream snapshot.
## Schemas
### `markets/markets_*.parquet`
Upstream columns from Jon Becker's release plus `category`. Notable
ones:
| column | type | description |
|---|---|---|
| `id` | string | Polymarket market id (primary key). |
| `condition_id` | string | Parent CTF condition id. |
| `question` | string | The question prompt. |
| `slug` | string | URL slug. |
| `outcomes` | string | JSON outcome labels, e.g. `["Yes","No"]`. |
| `outcome_prices` | string | JSON outcome prices at snapshot time. The winning outcome closes near 1. |
| `clob_token_ids` | string | JSON `[yes_token_id, no_token_id]`. Use to join bars to a market. |
| `volume` | double | Cumulative USDC traded. |
| `liquidity` | double | Snapshot depth. |
| `end_date` | timestamp | Useful as `resolution_date` for held-out cohorts. |
| `created_at` | timestamp | Market creation. |
| `category` | string | Best-effort topic label. Use cautiously. |
### `bars_hourly/bars_*.parquet` and `bars_daily/bars_*.parquet`
| column | type | description |
|---|---|---|
| `token_id` | string | CTF outcome-token id. |
| `period_start` | timestamp | Bar start, UTC. |
| `period_end` | timestamp | `period_start + 1 hour` (or `+ 1 day`). |
| `open` / `high` / `low` / `close` | double | Implied probability in `[0, 1]`. |
| `vwap` | double | Volume-weighted average price. |
| `volume_usd` | double | Total USDC traded in the bar. |
| `n_trades` | int64 | Number of `OrderFilled` events in the bar. |
| `n_buys` / `n_sells` | int64 | Taker-side direction counts. |
## Quick start in R
### Setup
```r
install.packages(c("arrow", "dplyr", "jsonlite", "lubridate", "slider",
"TTR", "PerformanceAnalytics", "glmnet"))
library(arrow)
library(dplyr)
library(slider)
```
### Build a per-token feature frame
```r
markets <- open_dataset("polymarket/markets/")
bars <- open_dataset("polymarket/bars_hourly/")
# Pick a large market and grab its YES token id.
m <- markets %>% filter(volume > 1e6) %>% head(1) %>% collect()
yes_token_id <- jsonlite::fromJSON(m$clob_token_ids)[1]
ts <- bars %>%
filter(token_id == yes_token_id) %>%
collect() %>%
arrange(period_start) %>%
mutate(
sma_24h = slide_dbl(close, mean, .before = 24, .complete = TRUE),
ema_24h = TTR::EMA(close, n = 24),
ret_1h = log(close / lag(close)),
rsi_14 = TTR::RSI(close, n = 14),
boll = TTR::BBands(close, n = 20, sd = 2)[, "pctB"],
days_to_resolution = as.numeric(difftime(m$end_date, period_start, units = "days"))
)
```
### Walk-forward elastic net + back-test
```r
library(glmnet)
library(PerformanceAnalytics)
fit <- cv.glmnet(X_train, y_train, alpha = 0.5)
signal <- predict(fit, newx = X_test, s = "lambda.min")
# 1% per-trade cost, threshold-based position.
pos <- sign(signal) * (abs(signal) > threshold)
ret <- pos * y_test - 0.01 * abs(diff(c(0, pos)))
charts.PerformanceSummary(ret)
```
## Streaming via the HuggingFace `datasets` library
```python
from datasets import load_dataset
markets = load_dataset("smf-ulm/polymarket-quant-bench", "markets", split="train")
bars_hourly = load_dataset("smf-ulm/polymarket-quant-bench", "bars_hourly", split="train", streaming=True)
bars_daily = load_dataset("smf-ulm/polymarket-quant-bench", "bars_daily", split="train")
```
## License
[CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/). Please cite
both this release and Jon Becker's upstream repository.
## Citation
```bibtex
@misc{polymarket_quant_bench_2026,
author = {Padmaperuma, Oliver},
title = {Polymarket Quant Bench: OHLCV bars for high-liquidity resolved markets},
year = {2026},
howpublished = {HuggingFace dataset, smf-ulm/polymarket-quant-bench},
note = {Derived from Jon Becker's polymarket-data release at
\url{https://github.com/jbecker19/polymarket-data}}
}
```
|