Official Python client for Polymarket
Actively maintained. Last release 6 days ago, commits in 25 of the last 26 weeks. A safe choice.
pip install polymarket-clientPolymarket Python SDK
Official Python SDK for Polymarket.
The SDK gives Python developers one coherent, workflow-oriented interface for building on Polymarket across public data, authenticated account, trading, builder attribution, and wallet workflows.
Installation
uv add polymarket-client
or:
pip install polymarket-client
Usage
Synchronous client:
from polymarket import Market, PublicClient
with PublicClient() as client:
market: Market = client.get_market(url="https://polymarket.com/event/example-market")
Asynchronous client:
import asyncio
from polymarket import AsyncPublicClient, Market
async def main() -> None:
async with AsyncPublicClient() as client:
market: Market = await client.get_market(
url="https://polymarket.com/event/example-market"
)
asyncio.run(main())
Batch position merges:
# Merge regular market positions by condition or market id.
handle = client.merge_multiple_positions(
positions=[
{"condition_id": condition_id_1},
{"market_id": market_id_2, "amount": "max"},
{"condition_id": condition_id_3, "amount": 500_000},
],
)
outcome = handle.wait()
# Or merge combo positions by position id. Do not mix market and combo
# requests in the same batch.
handle = client.merge_multiple_positions(
positions=[
{"position_id": combo_position_id_1},
{"position_id": combo_position_id_2, "amount": "max"},
{"position_id": combo_position_id_3, "amount": 500_000},
],
)
outcome = handle.wait()
API Compatibility
The SDK follows semantic versioning. Although minor releases on the 0.x line may include breaking changes, we aim to avoid them and, whenever possible, provide a deprecation path before removing or changing an API. Patch releases remain backward compatible except for APIs marked experimental, which may change in any release. All Perps APIs are currently experimental, including client methods, sessions, stream subscriptions, and models.
Open order filters and fill tracking
When filtering open orders by asset, include the market condition ID:
orders = client.list_open_orders(asset_id=asset_id, market=condition_id)
The deprecated token_id alias also requires market. Unfiltered and market-only
queries remain supported. Asset-only queries raise UserInputError when the
paginator fetches a page. This applies to both sync and async clients.