Skip to main content

Data provider for Python - Query data from local DuckDB

Project description

nextpoly-data-provider

NextPoly 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 nextpoly-data-provider

uv

uv add nextpoly-data-provider
# or
uv pip install nextpoly-data-provider

Quick Start

from nextpoly_data_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/data-provider/nextpoly_data_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.1-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.1-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.1-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.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nextpoly_data_provider-0.3.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2622e3795fb55b102b80eb0df9673504317a9769e4714902e34ae1addb7b7695
MD5 c4b80767bcda75abc7472571071cd45f
BLAKE2b-256 ffbcffd207f6938c7d956757c1db1edaedc9fba0e1eebcde70eee480bcac9d04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nextpoly_data_provider-0.3.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e80f4a1093e9587586a21f2f0b0529b3e9e915832dec6f2318fb3c0df08469d0
MD5 0b23d176565922189a2ee7d067a5608d
BLAKE2b-256 535c3bba5b6b4117f4a720505642ce55dc11569bca61b4ef1a27c57bb5c2017d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nextpoly_data_provider-0.3.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6ffbe8b8ff96b7b27359a46a2bd1c41d94bdbf1985935fd8d7931f3700e70a84
MD5 10698dc23c09d237954080ee9a139005
BLAKE2b-256 6375b55cb6e714c50b4133eb2c9aa4aef196bf05de41deedbaa4de311fbafd45

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