Download make_card.py from lowskillcoding/pdata-prediction-markets: direct link, hf CLI and curl.
- Browser
- Download file 6.19 kB
-
https://huggingface.co/datasets/lowskillcoding/pdata-prediction-markets/resolve/main/make_card.py
- Command line
-
hf download hf://datasets/lowskillcoding/pdata-prediction-markets/make_card.py
-
curl -L -o make_card.py https://huggingface.co/datasets/lowskillcoding/pdata-prediction-markets/resolve/main/make_card.py
6.19 kB
| """Write README.md (the dataset card) from the manifests and the Parquet files.""" | |
| import json | |
| from collections import Counter | |
| from pathlib import Path | |
| import pyarrow.parquet as pq | |
| REPO = "lowskillcoding/pdata-prediction-markets" | |
| KINDS = ("resolved", "markets-open", "events-open") | |
| here = Path(__file__).parent | |
| man = {k: json.loads((here / "manifests" / f"{k}.json").read_text()) for k in KINDS} | |
| tables = {k: pq.read_table(here / "data" / f"{k}.parquet") for k in KINDS} | |
| as_of = man["resolved"]["as_of"][:10] | |
| snapshot = as_of | |
| def fields(kind: str) -> str: | |
| rows = "\n".join(f"| `{k}` | {v} |" for k, v in man[kind]["fields"].items()) | |
| return "| Field | Meaning |\n|---|---|\n" + rows | |
| def by_venue(kind: str) -> str: | |
| c = Counter(tables[kind].column("source").to_pylist()) | |
| return ", ".join(f"{s} {n:,}" for s, n in c.most_common()) | |
| n = {k: tables[k].num_rows for k in KINDS} | |
| legs = sum(len(x) for x in tables["resolved"].column("markets").to_pylist()) | |
| card = f"""--- | |
| license: cc-by-4.0 | |
| pretty_name: "pdata.world prediction markets (Polymarket, Kalshi and 6 more venues)" | |
| language: | |
| - en | |
| tags: | |
| - prediction-markets | |
| - polymarket | |
| - kalshi | |
| - manifold | |
| - forecasting | |
| - finance | |
| - tabular | |
| size_categories: | |
| - 100K<n<1M | |
| configs: | |
| - config_name: resolved | |
| data_files: data/resolved.parquet | |
| default: true | |
| - config_name: markets-open | |
| data_files: data/markets-open.parquet | |
| - config_name: events-open | |
| data_files: data/events-open.parquet | |
| --- | |
| # pdata.world prediction markets | |
| Prices, volumes and results for prediction markets on eight venues — Polymarket, Kalshi, | |
| Manifold, Myriad, Limitless, Predict, Opinion and Gemini — in one schema. The data is | |
| collected by [pdata.world](https://pdata.world), which polls each venue every 10 to 60 | |
| minutes, and is published under CC BY 4.0. | |
| This snapshot was taken on {as_of}. It has three parts: | |
| | Config | Rows | What one row is | | |
| |---|---|---| | |
| | `resolved` (default) | {n['resolved']:,} events, with their top {legs:,} markets (at most 10 each) | An event pdata stopped tracking after it closed, with each top market's reported result | | |
| | `markets-open` | {n['markets-open']:,} | A market open for trading: price, 24h move and volume | | |
| | `events-open` | {n['events-open']:,} | An open event, which groups the markets of one question | | |
| ```python | |
| from datasets import load_dataset | |
| resolved = load_dataset("{REPO}", "resolved", split="train") | |
| markets = load_dataset("{REPO}", "markets-open", split="train") | |
| # or with pandas | |
| import pandas as pd | |
| df = pd.read_parquet("hf://datasets/{REPO}/data/markets-open.parquet") | |
| ``` | |
| ## Rows per venue | |
| - **resolved:** {by_venue('resolved')} | |
| - **markets-open:** {by_venue('markets-open')} | |
| - **events-open:** {by_venue('events-open')} | |
| ## Read this before using the numbers | |
| - `probability` and prices are on a 0–1 scale. | |
| - **Volume is not comparable across venues.** `volume` and `volume_24hr` are in each venue's | |
| own unit: shares for Polymarket and contracts for Kalshi (each pays $1 at resolution), | |
| play-money mana for Manifold, and each other venue's figure as it reports it. pdata's | |
| report [How eight venues count volume](https://pdata.world/research/prediction-market-volume) | |
| explains each one. | |
| - **In `resolved`, a market's `probability` is the last price pdata saw**, which is usually | |
| after the market settled. It records the result; it is not a forecast. For prices before | |
| close, use the API's history endpoint while a market is live (history is deleted 10 days | |
| after close) — see [How accurate were prediction-market prices a day before the | |
| result?](https://pdata.world/research/prediction-market-accuracy) for one way to do it. | |
| - **`result` is null where the venue never reports one.** Of the {legs:,} archived markets, | |
| {sum(1 for x in tables['resolved'].column('markets').to_pylist() for m in x if m['result'] is not None):,} | |
| carry a result. | |
| - **A gap in `resolved`:** events that closed between 2026-06-02 and 2026-08-11 are missing, | |
| because they were pruned before a backup was taken. Events closed in the 10 days before | |
| the snapshot are in neither file yet. | |
| - pdata groups Kalshi's sibling events for one game under a single group event | |
| (`is_group`), whose volume is the sum of its children's. | |
| ## Fields | |
| ### resolved | |
| {man['resolved']['description']} | |
| {fields('resolved')} | |
| ### markets-open | |
| {man['markets-open']['description']} | |
| {fields('markets-open')} | |
| ### events-open | |
| {man['events-open']['description']} | |
| {fields('events-open')} | |
| Timestamps are UTC. The manifest each file was built from is in [`manifests/`](manifests/). | |
| ## Updates and versions | |
| A new snapshot is added monthly; each is tagged with its date (this one is `{snapshot}`), | |
| so `load_dataset("{REPO}", "resolved", revision="{snapshot}")` always returns the same | |
| rows. For daily data, the same three files are rebuilt every night at | |
| <https://api.pdata.world/bulk/> as gzipped JSON lines. | |
| ## Other ways to get the data | |
| - REST API, no key: <https://api.pdata.world/docs> | |
| - MCP server for AI assistants: `https://api.pdata.world/mcp` | |
| - Read-only Postgres with price history: | |
| `postgresql://pdata_readonly:pdata_public_2026@pg.pdata.world:6433/pdata_new` | |
| (the password is published on purpose) | |
| - Python client and examples: <https://github.com/noskillcoding/pdata-client> | |
| - Research built on this data: <https://pdata.world/research> | |
| ## Licence and citation | |
| CC BY 4.0. Credit "Data: pdata.world" with a link to <https://pdata.world>. This snapshot is | |
| archived on Zenodo with DOI [10.5281/zenodo.23211611](https://doi.org/10.5281/zenodo.23211611). The underlying | |
| market data remains subject to each venue's own terms. pdata.world is independent and not | |
| affiliated with any venue. | |
| ```bibtex | |
| @misc{{pdata_world_prediction_markets_{snapshot.replace('-', '_')}, | |
| title = {{pdata.world prediction markets: prices, volumes and results from eight venues}}, | |
| author = {{{{pdata.world}}}}, | |
| year = {{{snapshot[:4]}}}, | |
| note = {{Snapshot {snapshot}}}, | |
| doi = {{10.5281/zenodo.23211611}}, | |
| howpublished = {{\\url{{https://huggingface.co/datasets/{REPO}}}}} | |
| }} | |
| ``` | |
| """ | |
| (here / "README.md").write_text(card) | |
| print("README.md", len(card), "chars") | |