How to Place Limit Orders with the Polymarket CLOB API
This is a practical walkthrough of placing a limit order on Polymarket programmatically. It is educational — always test with tiny size first, and treat any code as a starting point you must verify against the current API docs.
This guide pairs with our full Polymarket API Guide. Here we focus specifically on getting a limit order placed and confirmed.
Prerequisites
- A funded wallet with USDC on Polygon and the necessary token allowances.
- API credentials for the CLOB.
- The official Python client (
py-clob-client) or equivalent. - A market's token ID for the outcome you want to trade.
Authenticating with the CLOB
Polymarket uses a two-level auth model: an L1 signature from your wallet key proves ownership, and L2 API credentials authorize requests. Get this right first — signing is where most first-time integrations fail.
from py_clob_client.client import ClobClient
client = ClobClient(
host="https://clob.polymarket.com",
key=PRIVATE_KEY, # keep in an env var, never in code
chain_id=137, # Polygon
)
client.set_api_creds(client.create_or_derive_api_creds())
Constructing a limit order
A limit order needs the token ID, a side (BUY/SELL), a price between 0 and 1, and a size. The price is the probability you are willing to pay or accept.
from py_clob_client.clob_types import OrderArgs
from py_clob_client.order_builder.constants import BUY
order_args = OrderArgs(
token_id=TOKEN_ID,
side=BUY,
price=0.42, # 42c = 42% implied probability
size=100, # number of shares
)
signed = client.create_order(order_args)
Price ticks and size rules
Prices must align to the market's tick size and size to its minimums; otherwise the order is rejected. Read these from the market metadata rather than hardcoding them.
Submitting and confirming
resp = client.post_order(signed)
print(resp) # inspect status: live, matched, or an error
Check the response rather than assuming success. A returned order ID with a “live” status means it is resting on the book; a “matched” status means it filled.
Handling errors and rejections
- Invalid price tick or sub-minimum size — fix against market metadata.
- Insufficient balance or allowance — check funding and approvals.
- Rate limiting — back off and retry (see rate limits).
- Auth errors — re-derive credentials.
Cancelling and replacing
To move a quote, cancel the existing order and post a new one. The choice of order type (e.g. good-til-cancelled vs fill-or-kill) determines how the order behaves while it rests.
Test every integration with the smallest possible size in a live market before scaling. A logic bug in order construction can place wrong-sized or wrong-side orders — small size caps the damage while you verify.
Automate Polymarket the self-hosted way
PolyBot runs on your own server with your keys — copy trading and an AI strategy, a full dashboard, risk limits, and a kill switch included. One-time purchase.
Frequently Asked Questions
Disclaimer: This article is for educational purposes only and is not financial, investment, or legal advice. Prediction-market trading carries a real risk of loss. Automation does not guarantee profit, and past performance never guarantees future results. Only trade funds you can afford to lose, and confirm that Polymarket is available and legal in your jurisdiction before trading.