Python client for the Polymarket CLOB
Project description
py-clob-client
Python client for the Polymarket CLOB
Installation
pip install py-clob-client
Intended for use with Python 3.9
Usage
host = "http://localhost:8080"
key = os.getenv("PK")
creds = ApiCreds(api_key=os.getenv("CLOB_API_KEY"), api_secret=os.getenv("CLOB_SECRET"), api_passphrase=os.getenv("CLOB_PASS_PHRASE"))
chain_id = 80001
client = ClobClient(host, key=key, chain_id=chain_id, creds=creds)
# Create and sign a limit order buying 100 YES tokens for 0.50c each
resp = client.create_and_post_limit_order(LimitOrderArgs(
price=0.50,
size=100.0,
side=BUY,
token_id="16678291189211314787145083999015737376658799626183230671758641503291735614088"
))
print(resp)
# Initiate a market sell of 100 YES tokens
resp = client.create_and_post_market_order(MarketOrderArgs(
size=100.0,
side=SELL,
token_id="16678291189211314787145083999015737376658799626183230671758641503291735614088"
))
print(resp)
See examples for more
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_clob_client-0.0.18.tar.gz
(9.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_clob_client-0.0.18.tar.gz.
File metadata
- Download URL: py_clob_client-0.0.18.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
114b3a5b1c32cfd94dd2d7b52ff0fae1074640a9af488d904d489d7be7a3c09d
|
|
| MD5 |
371332d04abb9ad7efda6e99e57b5dd1
|
|
| BLAKE2b-256 |
bcb3195244ed373d1937db927ddc4be4293b85108fc8a79d91afd5d7e8b3ff75
|
File details
Details for the file py_clob_client-0.0.18-py3-none-any.whl.
File metadata
- Download URL: py_clob_client-0.0.18-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c6b7ba539e5cac1e781765620f16d8d4c7337e2a7643cd71ae8ed4466a2d549
|
|
| MD5 |
5221973ba023c7e9d8b9cce81ad352d6
|
|
| BLAKE2b-256 |
561394ae23807725c949259becc7099ee43f8e9f264ca680d7bada61f94dc301
|