Skip to main content

Data provider for Python - Query data from local DuckDB

Project description

polymarket-provider

Polymarket data provider for Python, built with Rust and PyO3.

Features

  • Query Polymarket on-chain data (order filled events, FPMM transactions)
  • Query Polymarket off-chain data (markets, market tokens)
  • Query timeseries data for trading analysis
  • Time-travel queries with simulation_time parameter
  • Built on DuckDB for fast local queries
  • Python 3.11+ support with abi3 compatibility

Installation

pip install polymarket-provider

uv

uv add polymarket-provider
# or
uv pip install polymarket-provider

Quick Start

from polymarket_provider import DataProvider

# Create provider with default DB paths
provider = DataProvider()

# Query markets
markets = provider.off_chain.markets(limit=10)
for market in markets:
    print(f"{market.question}: {market.outcome}")

# Query on-chain events
orders = provider.on_chain.order_filled_events(limit=10)

# Query time series data
ts = provider.trading.get_timeseries(token_id="...")

Time Travel Queries

from datetime import datetime, timezone

# Query data as of a specific time
ts = int(datetime(2024, 1, 1, tzinfo=timezone.utc).timestamp())
provider = DataProvider(simulation_time=ts)

# Or set it later
provider.set_simulation_time(ts)

Requirements

  • Python 3.11+
  • Local DuckDB database files

Type stubs

Type stubs live next to the package in crates/provider/polymarket_provider/*.pyi.

To build the extension with maturin and verify stubs against runtime objects:

uv --version
cargo run -p xtask -- stub-check

stub-check uses uv run in crates/provider, creating .venv if needed and installing maturin, mypy, ruff, and ty automatically. Pass --debug to skip --release.

Publishing

maturin publish --release

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nextpoly_data_provider-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

nextpoly_data_provider-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (10.0 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

nextpoly_data_provider-0.3.0-cp311-abi3-macosx_11_0_arm64.whl (10.7 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file nextpoly_data_provider-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nextpoly_data_provider-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90f550a673a8479b0337422e1e0ab8a78541c378721de6b33c3161af95a1322d
MD5 c1b441816341afa1c1510cdced3647fa
BLAKE2b-256 6c77bd176d44cde7c7681f8a6b873aa9db27a3175ea1030d269f32daf66870dc

See more details on using hashes here.

File details

Details for the file nextpoly_data_provider-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nextpoly_data_provider-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fdd4ef69be93c252f01e401ed8fd5ee1e4746373871bc776e29d20c513f2f359
MD5 85b474292d69662d929977010ccce96b
BLAKE2b-256 93f9a595f7b5cba432a38dc66c51687fc85e1af9ba2b613ce852a015f063a008

See more details on using hashes here.

File details

Details for the file nextpoly_data_provider-0.3.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nextpoly_data_provider-0.3.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe17e95ef65d185b455d7cba9cf0095e9da3759f059e24b75a76e20732929e77
MD5 0d29eafd029c6ed167411a3af1470833
BLAKE2b-256 ff5d1f354a0387bc1887dadf0a0154bbcc04bb4bf29609c1048d913bc48e0be3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page