py-clob-client-crypto
Python client for the Polymarket CLOB. Full API documentation can be found here.
Installation
pip install py-clob-client-crypto
Intended for use with Python 3.9
Requisites
Allowances
The correct token allowances must be set before orders can be placed. The following mainnet (Polygon) allowances should be set by the funding (maker) address. For testnet addresses and additional documentation please refer to the API documentation.
| token(s) | spender | description |
|---|---|---|
0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 |
0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E |
allow the CTF Exchange contract to transfer user's usdc |
0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 |
0xC5d563A36AE78145C45a50134d48A1215220f80a |
allow the Neg Risk CTF Exchange contract to transfer user's usdc |
0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 |
0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296 |
allow the Neg Risk Adapter contract to transfer user's usdc |
0x4D97DCd97eC945f40cF65F87097ACe5EA0476045 |
0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E |
allow the CTF Exchange contract to transfer user's conditional tokens |
0x4D97DCd97eC945f40cF65F87097ACe5EA0476045 |
0xC5d563A36AE78145C45a50134d48A1215220f80a |
allow the Neg Risk CTF Exchange contract to transfer user's conditional tokens |
0x4D97DCd97eC945f40cF65F87097ACe5EA0476045 |
0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296 |
allow the Neg Risk Adapter contract to transfer user's conditional tokens |
See this gist for a an example of how to set these allowances for an account using python.
Usage
import os
from py_clob_client.constants import POLYGON
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import OrderArgs
from py_clob_client.order_builder.constants import BUY
host = "https://clob.polymarket.com"
key = os.getenv("PK")
chain_id = POLYGON
# Create CLOB client and get/set API credentials
client = ClobClient(host, key=key, chain_id=chain_id)
client.set_api_creds(client.create_or_derive_api_creds())
# Create and sign an order buying 100 YES tokens for 0.50c each
resp = client.create_and_post_order(OrderArgs(
price=0.50,
size=100.0,
side=BUY,
token_id="71321045679252212594626385532706912750332728571942532289631379312455583992563"
))
print(resp)
See examples for more.
Metadata
Release files for py-clob-client-crypto 0.18.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_clob_client_crypto-0.18.6.tar.gz | 23.0 kB | Without provenance | Details for py_clob_client_crypto-0.18.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_clob_client_crypto-0.18.6-py3-none-any.whl | Python 3 | none | any | Details for py_clob_client_crypto-0.18.6-py3-none-any.whl |
Total release size: 51.4 kB
Release files / py_clob_client_crypto-0.18.6.tar.gz
| Download URL | py_clob_client_crypto-0.18.6.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66d6a42513fc7de0100b1ae4a11ee7c4411c60768dfb7a731c83e98aa3d21396
|
|
BLAKE2b-256 checksum How to use checksums |
e61059b3bd6c07070364675dbab8a5950025c4b7ee2431b59ef82580baa8ef4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|
Release files / py_clob_client_crypto-0.18.6-py3-none-any.whl
| Download URL | py_clob_client_crypto-0.18.6-py3-none-any.whl |
|---|---|
| Size | 28.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7eebc5f1ee0d4d51e04f2c54a6cbd1422b1fd913799030b82e32e04913068091
|
|
BLAKE2b-256 checksum How to use checksums |
01db04bd5ccc9fb8b6627f6674af77998735bdc0b8921a4504a0e7fea6929722
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|
Security for py-clob-client-crypto 0.18.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.