Skip to main content
The polymarket-client package is the official Python SDK for building Polymarket integrations.

GitHub

View the Python SDK source.

PyPI Package

Install polymarket-client from PyPI.
See the SDK Changelog for recent Python releases.

Quickstart

1

Install the SDK

Install the SDK with your preferred package manager.
2

Create a Public Client

Create an AsyncPublicClient to access publicly available Polymarket data.
3

Fetch Active Markets

Fetch a page of active markets to discover trading opportunities.

Async and Sync Interfaces

Public clients access public data. Secure clients add trading and account access. Both client types are available in async and sync forms. Async clients fit services, bots, and applications that already run an event loop. Sync clients are convenient for scripts and notebooks.
Some features, including realtime subscriptions, are async-only because they rely on long-lived streams.

Pagination

SDK list methods use a consistent paginator interface. Iterate over the paginator to retrieve every page, or fetch one page at a time when you need to control pacing.
When page boundaries do not matter, iterate over every item directly.
page.next_cursor is an opaque SDK cursor. Store it as-is if you want to resume a scan later, and omit it when starting from the first page.

Types

SDK methods return typed models, and their public types are exported from polymarket.
The SDK also uses distinct types for domain identifiers and EVM addresses. Precision-sensitive values use decimal.Decimal, while dates and timestamps use Python’s datetime types.

Error Handling

All SDK exceptions inherit from PolymarketError. Catch specific exceptions when your application can respond to them, then catch the base exception as a fallback.

Secure Client

Create an AsyncSecureClient or SecureClient when your integration needs to trade or access account data. The Python SDK creates the signer from a local private key.
Continue to Wallets and Authentication to configure the account wallet and gasless transactions.

Realtime Subscriptions

The Python SDK can combine updates from multiple realtime feeds into a single stream of events.
Realtime subscriptions are available only through AsyncPublicClient and AsyncSecureClient. PublicClient and SecureClient do not implement subscribe().
Call subscribe() with one or more subscription specs. Both AsyncPublicClient and AsyncSecureClient support public streams, while AsyncSecureClient also provides private streams for the connected account.
Narrow event.topic before handling a specific event shape. The examples show a few streams; see Real-Time Data, Real-Time Order Updates, and Perps Realtime Updates for feed-specific options.

DataFrames and Jupyter

Convert pages and paginators directly to a pandas DataFrame, Polars DataFrame, or Apache Arrow Table. Install the pandas, polars, or arrow package extra for the format you use; the quant extra installs all three.
Paginator conversions require an explicit limit. Pass limit=None to retrieve every item. Common SDK objects also render as compact cards in Jupyter notebooks. Return an object as the last expression in a cell to display it.

Next Steps

Read Market Data

Discover markets and work with prices, order books, and historical data.

Subscribe to Real-Time Updates

Stream market and account updates as they happen.

Place Your First Order

Set up an account and complete your first authenticated trade.