polymarket-clob-client-v2

Places orders and retrieves market data on Polymarket's CLOB API using TypeScript.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/reason-machines/devtools-skills --skill polymarket-clob-client-v2-reason-machines
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: polymarket-clob-client-v2
Source: https://github.com/reason-machines/devtools-skills/tree/main/skills/polymarket-clob-client-v2
Command: npx skills add https://github.com/reason-machines/devtools-skills --skill polymarket-clob-client-v2-reason-machines

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @polymarkets/clob-client-v2, viem.

What problem does it solve? Programmatic trading on Polymarket prediction markets requires handling wallet signatures, API credential derivation, order construction, and error handling, which is complex to implement from scratch against the raw CLOB API. ## Core Features & Use Cases - Order Management: Place limit orders (GTC, GTD) and market orders (FOK, FAK), then cancel single orders, market orders, or all open orders. - Market Data Access: Retrieve order books, trade history, open orders, positions, and USDC balances through the authenticated client. - Two-Level Authentication: Set up L1 wallet-signature auth to derive API keys, then use persistent L2 HMAC credentials for trading operations. - Use Case: Build a market-making bot that reads the current order book, computes mid-price, and places bid/ask orders around it with a defined spread, while enforcing position exposure limits. ## Quick Start Ask the AI to write a TypeScript script that initializes the Polymarket CLOB client with your credentials and places a limit buy order on a given token ID.

Frequently Asked Questions about polymarket-clob-client-v2

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I place an order on Polymarket programmatically?▼

Use the ClobClient from @polymarkets/clob-client-v2 and call createAndPostOrder with a token ID, price between 0.01 and 0.99, side, and size. Market orders use createAndPostMarketOrder with a USDC amount and FOK or FAK order type.

How to authenticate with the Polymarket CLOB API?▼

Authentication has two levels: L1 uses an EIP-712 wallet signature via viem to create or derive API credentials, and L2 uses the derived key, secret, and passphrase with HMAC signing for order placement and private account data.

Does the Polymarket CLOB client support a testnet?▼

Yes, the client supports the Amoy testnet by setting the chain to Chain.AMOY and the host to https://clob-testnet.polymarket.com. Mainnet trading uses Chain.POLYGON with https://clob.polymarket.com.

Why was my Polymarket order rejected?▼

Orders are commonly rejected due to insufficient USDC balance, prices outside the 0.01 to 0.99 range, incorrect tick size for the market, or an invalid token ID. Check your balance with getBalance() and verify market details before submitting.

How do I handle API errors in the Polymarket client?▼

By default the client returns error objects you can check with an "error" in result test. Setting throwOnError: true makes it throw ApiError exceptions with message, status, and data fields, which you can catch and retry with backoff for 5xx statuses.