py-clob-client / @polymarket/clob-client

Polymarket CLOB Client — What It Is, Why It is Hard, and the No-Code Alternative

The Polymarket CLOB client is the official SDK for placing orders against Polymarket. It is also where most DIY bot projects stall — because the SDK is only the protocol layer, and production trading requires a much larger operational stack on top.

What is the Polymarket CLOB client?

The Polymarket CLOB client is the official software development kit that lets programs interact with the Polymarket Central Limit Order Book. It is shipped in two flavors — py-clob-client for Python and @polymarket/clob-client for TypeScript / Node.js — and is the recommended path for anyone placing orders against Polymarket programmatically.

Concretely, the CLOB client wraps three things: API authentication (the L1/L2 API-key handshake), EIP-712 order signing against the conditional-tokens contract on Polygon, and the REST + websocket endpoints exposed by Polymarket's Central Limit Order Book. Everything you do — placing a limit order, cancelling, posting a market order, subscribing to fills — flows through the client.

It is the right primitive for developers who want full control. It is also why most people give up trying to build a Polymarket bot themselves: the SDK does the protocol work, but every piece of infrastructure around it (wallets, hosting, scanning, monitoring, reconciliation) is on you.

Why building on the CLOB client yourself is hard

The official SDK is well-documented, but documentation only covers the protocol surface — placing an order, signing it, posting it. Running this in production against live capital introduces an entirely separate stack:

  • Wallet management — every order must be signed by an Ethereum address that holds USDC.e on Polygon and has approvals set against the conditional-tokens contract. You manage the private key, the approvals, the funding flow, and the recovery.
  • API authentication — the CLOB exposes L1 (signature-based) and L2 (API-key-based) auth. You generate keys with the SDK, rotate them, store them securely, and handle 401s when they expire.
  • EIP-712 order signing — the SDK produces a typed signature against an order struct. Get the domain wrong and orders silently reject. Sign with the wrong nonce and orders collide.
  • Market-data ingestion — to trade, you first have to know what to trade. You poll /markets, normalize the response, track which markets are live vs resolved, and refresh on a cadence that matches your strategy.
  • Order-book depth checks — placing a $200 order into a $50-deep book turns a 3% edge into a 2% loss. You build the depth check and the price-impact estimator before every fire.
  • VPS hosting — the bot has to run when you sleep. AWS, Hetzner, Fly.io, doesn't matter — you pick, configure, secure, and pay.
  • Scheduling and worker infrastructure — multi-bot setups need a queue, a scheduler, a way to start/stop bots without restarting the host process. Most one-off scripts skip this until they break.
  • Monitoring — when an order silently fails at 3am because the API rotated rate limits, you want to know. That means logs, metrics, and alerts wired to something that pages you.
  • Reconciliation — the SDK returns "order placed" before the order is filled. You reconcile fills, partial fills, and ghost orders against the orderbook state on a loop, or P&L drifts.
  • Retry and backoff — Polymarket returns 5xx during traffic spikes. Retrying naively gets you rate-limited; not retrying drops orders. The middle ground is hand-built.

Building on the CLOB client vs using PredictEngine

Here is the same job broken down into who owns what:

ConcernBuilding with py-clob-clientPredictEngine
CLOB API integrationYou install + version-pin the SDKHandled in service
EIP-712 order signingYou sign every order in codeHandled in service
Wallet provisioningYou generate, fund, encrypt keysPer-user Polygon wallet auto-provisioned
USDC.e approvals on PolygonYou set approvals against CTF + exchangePre-approved on first use
Market-data ingestionYou poll + cache /markets yourselfBuilt-in market scanner
VPS hostingYou run a server 24/7Hosted on PredictEngine infra
Monitoring & alertsYou wire logs + pagingBuilt-in PnL + status dashboard
Retry / backoffYou hand-roll exponential backoffBuilt-in retry semantics
Reconciliation of fillsYou reconcile against the orderbookPer-position accounting on close

How PredictEngine handles the CLOB client layer

PredictEngine uses the same py-clob-client SDK internally — there is no parallel protocol implementation. What it provides on top is the operating layer: wallet provisioning per user, key encryption at rest, gasless trade execution via Polymarket's Builder relayer, a continuous market scanner that pre-warms thousands of markets, and a hosted worker pool that runs your strategy without you running a server.

For users who want to write code: PredictEngine exposes a higher-level API where you describe a strategy in plain English or in a small declarative format, and the platform compiles that to py-clob-client calls. You do not lose access to the protocol — you just stop owning the operational stack.

For developers who want the SDK directly, the developer guide at /polymarket-api walks through how to wire py-clob-client from scratch, with comparison notes on what PredictEngine replaces if you decide the operational burden is not worth carrying.

Common Polymarket CLOB client questions

A handful of recurring questions when people first install py-clob-client or @polymarket/clob-client and try to ship something:

  • Where do I get an API key? The SDK has create_api_key() — you sign a message with your private key and the CLOB issues an L2 API key.
  • What is L1 vs L2 auth? L1 = signature-based (slow, per-request signing). L2 = API-key-based (fast, requires key issuance). Most production use is L2.
  • Why are my orders rejecting silently? Almost always: wrong chain ID in the EIP-712 domain (Polygon = 137), or insufficient USDC.e approval against the exchange contract.
  • How do I subscribe to fills? The CLOB exposes a websocket endpoint; the SDK wraps it. Most beginners poll /trades instead and hit rate limits.
  • Can I use both py-clob-client and @polymarket/clob-client? Yes — they speak the same protocol, just different runtimes. Mixing inside a single bot is unusual.

When to build directly vs use PredictEngine

Use py-clob-client directly when you have a research edge that requires low-latency execution, custom order types, or proprietary signal infrastructure that does not fit a hosted product. Most quant teams and serious solo traders start here once they have validated edge.

Use PredictEngine when you want to validate strategies first, run multiple bots without operating a server fleet, or skip the 4-6 weeks of plumbing required to ship a single live bot. The platform handles the CLOB integration, wallet workflow, signing, scanning, hosting, monitoring, and reconciliation — leaving you to focus on the strategy itself.

A common pattern: build with PredictEngine first to find what works, then move the winning strategy to a custom py-clob-client stack if and when the edge is large enough to justify owning the infrastructure.

Skip the CLOB client plumbing.

PredictEngine handles SDK integration, EIP-712 signing, wallet workflow, market scanning, hosting, monitoring, and reconciliation. Describe a strategy, the platform deploys it.

Frequently Asked Questions

Related