What is the CLOB client?
The CLOB (Central Limit Order Book) Client is the primary interface for programmatic trading on Polymarket. It provides:- Order management: Create, post, cancel, and query orders on prediction markets
- Market data access: Fetch real-time orderbooks, prices, trades, and market information
- Account management: Manage API keys, check balances, and track trading activity
- Cryptographic signing: Handle EIP-712 signatures for secure order authentication
- RFQ (Request for Quote): Access to the RFQ system for large-size trades
Key features
Type-safe API
Fully typed TypeScript SDK with comprehensive interfaces and type definitions for all API operations
Flexible authentication
Support for multiple wallet types including ethers.js Wallet, viem WalletClient, and Magic email login
Order building
Built-in order builder that handles price rounding, tick sizes, and creates properly formatted signed orders
Market & limit orders
Support for both market orders (FOK/FAK) and limit orders (GTC/GTD) with automatic price calculation
Real-time data
Access to live orderbooks, market prices, trade history, and market events
Error handling
Configurable error handling with both error objects and thrown exceptions
Why use the CLOB client?
Automated trading strategies
Build sophisticated trading bots that can:- Monitor multiple markets simultaneously
- Execute trades based on custom algorithms
- Implement market-making strategies with tight spreads
- React to market events in real-time
Market making
Provide liquidity to Polymarket’s prediction markets:- Maintain two-sided quotes across multiple markets
- Automatically adjust prices based on market conditions
- Earn trading fees and liquidity rewards
- Manage inventory and risk programmatically
Data analysis
Access comprehensive market data for research and analysis:- Historical price and volume data
- Order book depth and liquidity metrics
- Trade history and market statistics
- User trading activity and rewards
Custom applications
Integrate Polymarket trading into your own applications:- Build custom trading interfaces
- Create portfolio management tools
- Develop risk management systems
- Integrate with other DeFi protocols
How it works
The CLOB Client uses a two-level authentication system:Level 1 (L1) Authentication
Uses EIP-712 signatures from your Ethereum wallet to prove ownership of an address. Required for creating API keys and signing orders.
Order flow
- Create order: Build an order with the desired parameters (token, price, size, side)
- Sign order: The client cryptographically signs the order using your wallet
- Post order: Submit the signed order to the CLOB API
- Matching: The order is matched against existing orders in the orderbook
- Settlement: Matched trades are settled on the Polygon blockchain
All orders are signed off-chain but settled on-chain, combining the speed of centralized orderbooks with the security of decentralized settlement.
Supported chains
The CLOB Client supports:- Polygon Mainnet (Chain ID: 137) - Production environment
- Polygon Amoy Testnet (Chain ID: 80002) - Testing environment
Architecture
The client is built with a modular architecture:Next steps
Quickstart
Get started with a complete example from installation to placing your first order
Installation
Detailed installation instructions and environment setup
API Reference
Complete API documentation for all client methods
Examples
Code examples for common use cases and trading patterns