Trade & read the Polymarket API with Python & TypeScript

Fetch markets, place orders, and stream prices on Polymarket — three lines to connect, zero auth boilerplate.

Get your API key at pmxt.dev/dashboard

polymarket.py
import pmxt

# Hosted trading — PMXT custodies a PreFundedEscrow you fund once
client = pmxt.Polymarket(
    pmxt_api_key="pmxt_live_...",
    wallet_address="0xYourWallet",
    private_key="0xYourKey",
)

# Fetch live market data
events = client.fetch_events(query="Presidential Election")
market = events[0].markets[0]

print(market.title)       # "Will a Republican win the 2028..."
print(market.yes.price)   # 0.53

# Place a trade through PMXT's PreFundedEscrow
order = client.create_order(
    market_id=market.id,
    outcome_id=market.yes.id,
    side="buy",
    type="market",
    amount=10,             # $10 USDC
    denom="usdc",
    slippage_pct=30.0,
)
print(order.status)       # "filled"

Without pmxt

8 steps before you get data

Polymarket splits its API across three services, each with its own auth model. Every request requires key management, signature construction, and header assembly.

  1. 1Load Ethereum private key
  2. 2Build EIP-712 typed data struct
  3. 3Sign with ethers / web3.py
  4. 4Construct CLOB auth headers
  5. 5Manage nonces & timestamps
  6. 6Route to Gamma vs CLOB vs Data API
  7. 7Normalize three response formats
  8. 8Handle rate limits & retries

With pmxt: one key, hosted custody, every venue.

client = pmxt.Polymarket(pmxt_api_key=..., wallet_address=..., private_key=...)
client.create_order(market_id=..., outcome_id=..., side="buy", ...)

Get your API key at pmxt.dev/dashboard.

Why pmxt

One SDK.
Every prediction market.

Multi-exchange

Switch from Polymarket to Kalshi by changing one line. Same methods, same types, different exchange.

Type-safe

Full type definitions in TypeScript. Pydantic models in Python. Catch errors before runtime.

Streaming

Subscribe to price changes and orderbook updates via WebSocket with a single method call.

Open source

MIT licensed. Read the code, fork it, contribute. No black boxes.

Same fetch_events() across every exchange

PolymarketKalshiLimitless

FAQ

Start building with Polymarket

Fetch data and place your first trade in under a minute.

Read the docs