prediction-market-analysis README

The project's README from github.com/Jon-Becker/prediction-market-analysis. As one markdown file: README.md.

Prediction Market Analysis

A framework for analyzing prediction market data, including the largest publicly available dataset of Polymarket and Kalshi market and trade data. Provides tools for data collection, storage, and running analysis scripts that generate figures and statistics.

Overview

This project enables research and analysis of prediction markets by providing:

Currently supported features:

Installation & Usage

Requires Python 3.9+. Install dependencies with uv:

uv sync

Download and extract the pre-collected dataset (36GiB compressed):

make setup

This downloads data.tar.zst from Cloudflare R2 Storage and extracts it to data/.

Data Collection

Collect market and trade data from prediction market APIs:

make index

This opens an interactive menu to select which indexer to run. Data is saved to data/kalshi/ and data/polymarket/ directories. Progress is saved automatically, so you can interrupt and resume collection.

Running Analyses

make analyze

This opens an interactive menu to select which analysis to run. You can run all analyses or select a specific one. Output files (PNG, PDF, CSV, JSON) are saved to output/.

Packaging Data

To compress the data directory for storage/distribution:

make package

This creates a zstd-compressed tar archive (data.tar.zst) and removes the data/ directory.

Project Structure

├── src/
│   ├── analysis/           # Analysis scripts
│   │   ├── kalshi/         # Kalshi-specific analyses
│   │   └── polymarket/     # Polymarket-specific analyses
│   ├── indexers/           # Data collection indexers
│   │   ├── kalshi/         # Kalshi API client and indexers
│   │   └── polymarket/     # Polymarket API/blockchain indexers
│   └── common/             # Shared utilities and interfaces
├── data/                   # Data directory (extracted from data.tar.zst)
│   ├── kalshi/
│   │   ├── markets/
│   │   └── trades/
│   └── polymarket/
│       ├── blocks/
│       ├── markets/
│       └── trades/
├── docs/                   # Documentation
└── output/                 # Analysis outputs (figures, CSVs)

Documentation

Contributing

If you'd like to contribute to this project, please open a pull-request with your changes, as well as detailed information on what is changed, added, or improved.

For more information, see the contributing guide.

Issues

If you've found an issue or have a question, please open an issue here.

Research & Citations

If you have used or plan to use this dataset in your research, please reach out via email or Twitter -- i'd love to hear about what you're using the data for! Additionally, feel free to open a PR and update this section with a link to your paper.

prediction-market-analysis (Jon-Becker/prediction-market-analysis)

Searching Database…

这是什么?这是一个用于收集和分析 Polymarket 与 Kalshi 预测市场数据的框架,并附带了目前公开可得的规模最大的市场和交易历史数据集。
这是现成的数据集,还是需要我自己运行的工具包?两者都是:它是一个带有交互式数据收集索引器和可扩展分析脚本框架的 Python 工具包,同时附带一份预先收集好的 36GiB 数据集,你可以直接下载使用,无需自己收集任何数据。
我怎么获取数据并运行分析?先用 uv 安装依赖,然后要么下载并解压预先收集好的数据集,要么运行交互式索引器菜单来收集最新的市场/交易数据;另外还有一个独立的交互式菜单,供你选择并运行分析脚本。
运行之前我需要装好什么?你需要 Python 3.9+ 和 uv 包管理器;如果要收集新数据,还需要能访问 Polymarket/Kalshi 的 API 和区块链数据源。
数据集或收集过程有什么要注意的坑吗?完整的预收集数据集压缩后达 36GiB,下载和解压会占用不少带宽和磁盘空间;如果你自己收集新数据,进度会自动保存,可以放心地中断后继续。
数据和输出分别是什么文件格式?市场和交易数据存储在 Parquet 文件中并自动保存进度,分析脚本则把 PNG、PDF、CSV 和 JSON 文件输出到 output/ 目录。
我可以添加自己的分析脚本吗?可以,项目自带一个可扩展的分析脚本框架,并配有专门的「编写分析」指南,自定义分析可以接入同一个交互式菜单。
为什么要构建这个数据集?构建它是为了支持对预测市场行为的学术研究;README 列出了十几篇来自 SSRN 和 arXiv 的论文,这些论文已经在用这份数据分析群体智慧效应和交易模式。
这个项目还在积极维护吗?是的,它有用于拉取请求验证的 CI 工作流,并明确欢迎贡献新的索引器、分析脚本,以及使用该数据集的新研究论文链接。
Creator
Jon-Becker
Size
158.2 MB
Stars
3.9K
Updated
CommitOct 19
Age
10mo
Commits · 90 Days