"""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 as gzipped JSON lines. ## Other ways to get the data - REST API, no key: - 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: - Research built on this data: ## Licence and citation CC BY 4.0. Credit "Data: pdata.world" with a link to . 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")