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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pretty_name: Polymarket Geopolitics — Markets, Trades, Blocks
|
| 6 |
+
size_categories:
|
| 7 |
+
- 10M<n<100M
|
| 8 |
+
task_categories:
|
| 9 |
+
- other
|
| 10 |
+
tags:
|
| 11 |
+
- polymarket
|
| 12 |
+
- prediction-markets
|
| 13 |
+
- geopolitics
|
| 14 |
+
- blockchain
|
| 15 |
+
- polygon
|
| 16 |
+
- market-microstructure
|
| 17 |
+
configs:
|
| 18 |
+
- config_name: markets
|
| 19 |
+
data_files:
|
| 20 |
+
- split: train
|
| 21 |
+
path: "polymarket/markets/markets_*.parquet"
|
| 22 |
+
- config_name: trades
|
| 23 |
+
data_files:
|
| 24 |
+
- split: train
|
| 25 |
+
path: "polymarket/trades/trades_*.parquet"
|
| 26 |
+
- config_name: blocks
|
| 27 |
+
data_files:
|
| 28 |
+
- split: train
|
| 29 |
+
path: "polymarket/blocks/blocks_*.parquet"
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
# Polymarket Geopolitics — markets, trades, blocks
|
| 33 |
+
|
| 34 |
+
A curated subset of [Polymarket](https://polymarket.com) markets and on-chain
|
| 35 |
+
trade events covering the **Geopolitics** category. Polymarket is a
|
| 36 |
+
decentralised prediction market on the Polygon blockchain; binary
|
| 37 |
+
contracts settle to one USDC if the underlying event occurs and zero
|
| 38 |
+
otherwise. The dataset is intended for teaching and research on price
|
| 39 |
+
discovery, calibration, and trader behaviour in prediction markets.
|
| 40 |
+
|
| 41 |
+
## Contents
|
| 42 |
+
|
| 43 |
+
| File group | Rows | Description |
|
| 44 |
+
|---|---:|---|
|
| 45 |
+
| `polymarket/markets/markets_*.parquet` | 6,053 | One row per Polymarket question classified as Geopolitics. |
|
| 46 |
+
| `polymarket/trades/trades_*.parquet` | 11,734,433 | One row per CTF-Exchange `OrderFilled` event for tokens belonging to those markets. |
|
| 47 |
+
| `polymarket/blocks/blocks_*.parquet` | ~12 M | Polygon `block_number` → `timestamp` lookup, sampled every 100 blocks and linearly interpolated in between. |
|
| 48 |
+
|
| 49 |
+
Each file group is chunked into 10,000-row parquet shards (1,174 trade
|
| 50 |
+
shards, 785 block shards, 1 market shard) — same chunking convention as
|
| 51 |
+
the upstream release.
|
| 52 |
+
|
| 53 |
+
## Provenance and attribution
|
| 54 |
+
|
| 55 |
+
The raw market metadata, trade events, and block index were collected and
|
| 56 |
+
released by **Jon Becker** at
|
| 57 |
+
[github.com/jbecker19/polymarket-data](https://github.com/jbecker19/polymarket-data).
|
| 58 |
+
This dataset is a category-restricted derivative of that release: all
|
| 59 |
+
column schemas are byte-identical to Jon's upstream parquet files, with
|
| 60 |
+
one added column (`category`) on the markets table.
|
| 61 |
+
|
| 62 |
+
If you use this dataset, please cite Jon Becker's original release.
|
| 63 |
+
|
| 64 |
+
## How the Geopolitics subset was selected
|
| 65 |
+
|
| 66 |
+
Each Polymarket market was classified into one of eight categories
|
| 67 |
+
(Politics & Elections, Sports, Crypto & Web3, Finance & Economics,
|
| 68 |
+
Geopolitics, Science & Technology, Entertainment & Culture, Other) by a
|
| 69 |
+
two-tier text classifier:
|
| 70 |
+
|
| 71 |
+
1. **Tier 1 — weighted keyword score.** For each candidate category, a
|
| 72 |
+
weighted hit count is computed over the market's `question` (weight
|
| 73 |
+
3), `slug` (weight 2), and `description` (weight 1). Categories use
|
| 74 |
+
topic-specific keyword lists (Geopolitics keywords include `war`,
|
| 75 |
+
`ukraine`, `russia`, `israel`, `gaza`, `nato`, `nuclear`, `ceasefire`,
|
| 76 |
+
`iran`, `north korea`, `taiwan`, `sanctions`, `geopolit`, `coup`,
|
| 77 |
+
`regime`, `summit`, `unsc`, `embargo`, `houthi`, `hezbollah`, `hamas`,
|
| 78 |
+
`border`, ...). The category with the highest score wins; ties are
|
| 79 |
+
broken by a fixed priority chain
|
| 80 |
+
(Politics > Geopolitics > Finance > Crypto > Sports > Science >
|
| 81 |
+
Entertainment > Other).
|
| 82 |
+
2. **Tier 2 — TF-IDF + logistic-regression fallback.** Markets the
|
| 83 |
+
Tier-1 classifier sent to *Other* or scored below a single
|
| 84 |
+
low-weight keyword hit are re-classified by a TF-IDF + multinomial
|
| 85 |
+
logistic-regression model trained on a 640-row stratified
|
| 86 |
+
hand-labelled seed. Predictions with posterior < 0.4 remain in
|
| 87 |
+
*Other* to avoid mis-labelling low-confidence cases.
|
| 88 |
+
|
| 89 |
+
Held-out weighted accuracy of the two-tier pipeline is 0.87 on the
|
| 90 |
+
160-row eval split. The two-tier process drops the *Other* residual on
|
| 91 |
+
the full 408 k-market sample from 44.9 % (Tier-1 only) to 9.3 %.
|
| 92 |
+
|
| 93 |
+
This particular extract retains only markets whose final classifier
|
| 94 |
+
assignment is **Geopolitics** (6,053 markets out of ~409 k).
|
| 95 |
+
|
| 96 |
+
## Schemas
|
| 97 |
+
|
| 98 |
+
### `markets/markets_*.parquet`
|
| 99 |
+
|
| 100 |
+
| column | type | description |
|
| 101 |
+
|---|---|---|
|
| 102 |
+
| `id` | string | Polymarket market id (primary key). |
|
| 103 |
+
| `condition_id` | string | Parent CTF condition id. |
|
| 104 |
+
| `question` | string | The question prompt shown to users. |
|
| 105 |
+
| `slug` | string | URL slug Polymarket uses to route this market. |
|
| 106 |
+
| `outcomes` | string | JSON-encoded array of outcome labels, e.g. `["Yes","No"]`. |
|
| 107 |
+
| `outcome_prices` | string | JSON-encoded array of final outcome prices. Resolution threshold > `0.99`. |
|
| 108 |
+
| `clob_token_ids` | string | JSON-encoded array of CTF outcome-token ids (typically two: YES and NO). Use these to filter `trades/`. |
|
| 109 |
+
| `volume` | double | Cumulative traded volume in USDC. |
|
| 110 |
+
| `liquidity` | double | Snapshot of market depth. |
|
| 111 |
+
| `active` | bool | Whether the market is currently open. |
|
| 112 |
+
| `closed` | bool | Whether trading has ended. |
|
| 113 |
+
| `end_date` | timestamp | Wall-clock end-of-life. |
|
| 114 |
+
| `created_at` | timestamp | Wall-clock creation time. |
|
| 115 |
+
| `market_maker_address` | string | Legacy FPMM contract address; NULL for CTF-Exchange markets (all Geopolitics markets here are CTF). |
|
| 116 |
+
| `_fetched_at` | timestamp | Snapshot time at which this metadata row was scraped. |
|
| 117 |
+
| `category` | string | **New column.** Always `"Geopolitics"` for this extract. |
|
| 118 |
+
|
| 119 |
+
### `trades/trades_*.parquet`
|
| 120 |
+
|
| 121 |
+
Each row is one on-chain trade fill. Unique key is
|
| 122 |
+
`(transaction_hash, log_index)` — `transaction_hash` repeats because
|
| 123 |
+
Polymarket uses batch fill.
|
| 124 |
+
|
| 125 |
+
| column | type | description |
|
| 126 |
+
|---|---|---|
|
| 127 |
+
| `block_number` | int64 | Polygon block in which the trade was mined. |
|
| 128 |
+
| `transaction_hash` | string | Polygon transaction hash. |
|
| 129 |
+
| `log_index` | int32 | Position within the transaction's event log. |
|
| 130 |
+
| `order_hash` | string | EIP-712 hash of the order. |
|
| 131 |
+
| `maker` | string | Polygon address of the order maker (resting side). |
|
| 132 |
+
| `taker` | string | Polygon address of the order taker (aggressing side). |
|
| 133 |
+
| `maker_asset_id` | string | Asset id the maker delivered. `'0'` = USDC. |
|
| 134 |
+
| `taker_asset_id` | string | Asset id the taker delivered. Mirror of `maker_asset_id`. |
|
| 135 |
+
| `maker_amount` | int64 | Atomic units; divide by `1e6` for USDC or token units. |
|
| 136 |
+
| `taker_amount` | int64 | Atomic units. |
|
| 137 |
+
| `fee` | int64 | Polymarket fee in USDC atomic units. |
|
| 138 |
+
| `timestamp` | timestamp | **Always NULL.** Join to `blocks/` to recover wall-clock. |
|
| 139 |
+
| `_fetched_at` | timestamp | Scrape time. |
|
| 140 |
+
| `_contract` | string | `"CTF Exchange"` or `"NegRisk CTF Exchange"`. |
|
| 141 |
+
|
| 142 |
+
### `blocks/blocks_*.parquet`
|
| 143 |
+
|
| 144 |
+
| column | type | description |
|
| 145 |
+
|---|---|---|
|
| 146 |
+
| `block_number` | int64 | Polygon block number. |
|
| 147 |
+
| `timestamp` | string (ISO-8601) | Block timestamp, cast to `POSIXct` for arithmetic. |
|
| 148 |
+
|
| 149 |
+
### Computing trade price and signed direction
|
| 150 |
+
|
| 151 |
+
```
|
| 152 |
+
price_cents = 100 * usdc_amount / token_amount
|
| 153 |
+
= 100 * (maker_amount if maker_asset_id == '0' else taker_amount)
|
| 154 |
+
/ (taker_amount if maker_asset_id == '0' else maker_amount)
|
| 155 |
+
|
| 156 |
+
# Taker direction: positive = taker bought outcome tokens
|
| 157 |
+
if maker_asset_id == '0':
|
| 158 |
+
taker_signed_size = -taker_amount / 1e6 # taker delivered tokens; sold
|
| 159 |
+
else:
|
| 160 |
+
taker_signed_size = +maker_amount / 1e6 # taker delivered USDC; bought
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
## Quick start in R
|
| 164 |
+
|
| 165 |
+
```r
|
| 166 |
+
install.packages(c("arrow", "dplyr", "jsonlite", "duckdb"))
|
| 167 |
+
library(arrow)
|
| 168 |
+
library(dplyr)
|
| 169 |
+
library(jsonlite)
|
| 170 |
+
|
| 171 |
+
# Load the chunked parquet files transparently.
|
| 172 |
+
markets <- open_dataset("polymarket/markets/")
|
| 173 |
+
trades <- open_dataset("polymarket/trades/")
|
| 174 |
+
blocks <- open_dataset("polymarket/blocks/")
|
| 175 |
+
|
| 176 |
+
# Pick the largest-volume market.
|
| 177 |
+
m <- markets %>%
|
| 178 |
+
arrange(desc(volume)) %>%
|
| 179 |
+
head(1) %>%
|
| 180 |
+
collect()
|
| 181 |
+
|
| 182 |
+
# Parse the token ids and pull the matching trades.
|
| 183 |
+
token_ids <- jsonlite::fromJSON(m$clob_token_ids)
|
| 184 |
+
market_trades <- trades %>%
|
| 185 |
+
filter(maker_asset_id %in% token_ids | taker_asset_id %in% token_ids) %>%
|
| 186 |
+
collect() %>%
|
| 187 |
+
arrange(block_number, log_index) %>%
|
| 188 |
+
left_join(collect(blocks), by = "block_number") %>%
|
| 189 |
+
mutate(timestamp = as.POSIXct(timestamp, tz = "UTC"))
|
| 190 |
+
|
| 191 |
+
# Derive price and signed direction.
|
| 192 |
+
market_trades <- market_trades %>%
|
| 193 |
+
mutate(
|
| 194 |
+
is_usdc_maker = maker_asset_id == "0",
|
| 195 |
+
usdc_amount = ifelse(is_usdc_maker, maker_amount, taker_amount),
|
| 196 |
+
token_amount = ifelse(is_usdc_maker, taker_amount, maker_amount),
|
| 197 |
+
price_cents = 100 * usdc_amount / token_amount,
|
| 198 |
+
taker_signed_size = ifelse(is_usdc_maker,
|
| 199 |
+
-taker_amount / 1e6,
|
| 200 |
+
+maker_amount / 1e6)
|
| 201 |
+
)
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
## Streaming via the HuggingFace `datasets` library (Python)
|
| 205 |
+
|
| 206 |
+
```python
|
| 207 |
+
from datasets import load_dataset
|
| 208 |
+
|
| 209 |
+
markets = load_dataset("smf-ulm/polymarket-geopolitics", "markets", split="train")
|
| 210 |
+
trades = load_dataset("smf-ulm/polymarket-geopolitics", "trades", split="train", streaming=True)
|
| 211 |
+
blocks = load_dataset("smf-ulm/polymarket-geopolitics", "blocks", split="train")
|
| 212 |
+
|
| 213 |
+
print(markets[0]["question"])
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
## License
|
| 217 |
+
|
| 218 |
+
The derivative dataset is licensed
|
| 219 |
+
[CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/). Please cite
|
| 220 |
+
both this release and Jon Becker's upstream repository when using the
|
| 221 |
+
data in published work.
|
| 222 |
+
|
| 223 |
+
## Citation
|
| 224 |
+
|
| 225 |
+
```bibtex
|
| 226 |
+
@misc{polymarket_geopolitics_2026,
|
| 227 |
+
author = {Padmaperuma, Oliver},
|
| 228 |
+
title = {Polymarket Geopolitics: Markets, Trades, Blocks (derived subset)},
|
| 229 |
+
year = {2026},
|
| 230 |
+
howpublished = {HuggingFace dataset, smf-ulm/polymarket-geopolitics},
|
| 231 |
+
note = {Derived from Jon Becker's polymarket-data release at
|
| 232 |
+
\url{https://github.com/jbecker19/polymarket-data}}
|
| 233 |
+
}
|
| 234 |
+
```
|