A Python client library for interacting with the Polymarket Central Limit Order Book (CLOB). It provides functionalities for trading, fetching market data, and managing orders on Polymarket's platform. The library is actively developed with frequent patch and minor releases, reflecting ongoing enhancements and bug fixes.
pip install py-clob-clientVerified import paths — ran on the pinned version, not inferred.
Initializes the ClobClient with a private key (for signing transactions) and an RPC URL. It then fetches and prints the first two available markets. Remember to manage your private key securely, preferably via environment variables.
Update your code to use `get_rfq_requester_quotes()` or `get_rfq_quoter_quotes()` as appropriate for your application logic.
Review your RFQ requester order creation logic to account for the inverted price interpretation in `v0.34.0` and later versions. Incorrect price usage could lead to unintended trade execution.
Ensure your `POLYMARKET_PRIVATE_KEY` environment variable holds a valid, active private key for a Polygon wallet. Verify your `POLYMARKET_RPC_URL` points to a working Polygon RPC endpoint (e.g., Ankr, Alchemy, Infura).
Regularly check the GitHub releases and changelog for significant updates, especially before upgrading across minor versions. Test your integration thoroughly after updates.
Ensure `ClobClient` is initialized with the correct `host`, `private_key`, `chain_id` (137 for Polygon mainnet), and the appropriate `signature_type` (0 for EOA/MetaMask, 1 for email/Magic wallet, 2 for browser wallet proxies/Safe). For proxy wallets, explicitly provide the `funder` address. Always call `client.set_api_creds(client.create_or_derive_api_creds())` after client initialization to enable Level 2 authentication for trading. Verify API keys are correctly set in environment variables or passed directly.
Manually install the missing dependency using pip: `pip install py_builder_signing_sdk`.
Always pass a `BalanceAllowanceParams` object to `get_balance_allowance` and `update_balance_allowance`, ensuring that required attributes like `signature_type` are properly set within it. For example, `client.get_balance_allowance(BalanceAllowanceParams(signature_type=YOUR_SIGNATURE_TYPE))`.
Before placing an order, query market data to retrieve the valid `tick_size`, `min_order_size`, and acceptable price ranges using methods like `client.get_order_book(token_id)` or `client.get_markets()`. Ensure the trading wallet has sufficient balance and, for EOA/MetaMask users, that necessary token allowances are set for the Polymarket contracts.
No dependency data recorded yet.