Skip to content

Repository files navigation

Polymarket Analytics

English | 简体中文

CI Collector image On-chain collector image Aggregator image Hugging Face Dataset V1 Hugging Face Dataset V2 Hugging Face Storage Bucket Hugging Face Space

An open-source monorepo for collecting, transforming, analyzing, and visualizing Polymarket data. The repository is organized as a uv workspace so new event families and analytics pipelines can be added without creating a separate repository for every runtime component.

Current pipeline: OrderFilled

Polymarket OrderFilled data flow

The first pipeline processes Polymarket CLOB OrderFilled events:

Component Source Runtime
Collector pipelines/orderfilled/collector Daily Hugging Face Job on cpu-upgrade
Aggregator pipelines/orderfilled/aggregator Daily Hugging Face Job on cpu-upgrade
Gamma Trade Aggregator pipelines/gamma/aggregator Enriched market/event trade index
Dashboard apps/dashboard Free Hugging Face Gradio Space

The collector incrementally scans confirmed Polygon blocks and appends immutable V1/V2 Parquet shards to the public datasets. The aggregator streams those shards through DuckDB and writes compact daily and monthly metrics to the public Analytics Storage Bucket. The Dashboard reads only those aggregated files.

Unified on-chain collector

pipelines/onchain/collector is the next collection pipeline. It scans all registered Polymarket event families once per adaptive Polygon block window, then routes the returned logs to version-aware decoders and immutable Dataset configurations. It independently covers V1/V2 OrderFilled events, CTF lifecycle events, ERC-1155 transfers, Neg Risk events, collateral flows, and exchange audit events.

The existing production OrderFilled collector remains unchanged while the new collector runs against shadow outputs and an independent checkpoint.

Repository layout

.
├── apps/
│   └── dashboard/
├── docs/
├── pipelines/
│   ├── onchain/
│   │   └── collector/
│   ├── gamma/
│   │   ├── aggregator/
│   │   └── collector/
│   └── orderfilled/
│       ├── aggregator/
│       └── collector/
├── pyproject.toml
└── uv.lock

Future data families should be added under pipelines/<data-family>/ while shared user-facing applications remain under apps/.

Local development

Install the complete workspace:

uv sync --all-packages --all-groups

Run the checks:

uv lock --check
uv run --all-packages --all-groups ruff check .
uv run --package polymarket-orderfilled-collector pytest pipelines/orderfilled/collector/tests
uv run --package polymarket-onchain-collector pytest pipelines/onchain/collector/tests
uv run --package polymarket-gamma-collector pytest pipelines/gamma/collector/tests
uv run --package polymarket-gamma-trade-aggregator pytest pipelines/gamma/aggregator/tests
uv run --package polymarket-orderfilled-aggregator pytest pipelines/orderfilled/aggregator/tests
uv run --package polymarket-analytics-dashboard pytest apps/dashboard/tests

Each component keeps its own dependencies and documentation while sharing one Python version and one reproducible lockfile.

Deployment

GitHub Actions independently publishes:

  • ghcr.io/wzsg/polymarket-analytics-orderfilled-collector
  • ghcr.io/wzsg/polymarket-analytics-onchain-collector
  • ghcr.io/wzsg/polymarket-analytics-gamma-collector
  • ghcr.io/wzsg/polymarket-analytics-gamma-trade-aggregator
  • ghcr.io/wzsg/polymarket-analytics-orderfilled-aggregator

Production Hugging Face Jobs use immutable full-commit SHA tags. Dashboard changes are packaged from apps/dashboard and synchronized to the existing Polymarket OrderFilled Analytics Space.

Data resources

Licensed under the MIT License.

Releases

Packages

Contributors

Languages