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.15.tar.gz
(9.4 kB
view hashes)
Built Distribution
Close
Hashes for py_clob_client-0.0.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 410e8a83e6854786d9acfd778b5ba6cd6c7b0a9b10851f7c93e607e2f7a5e975 |
|
MD5 | b820317f489a5238c42e4bb78bbaf6c9 |
|
BLAKE2b-256 | add725b052cb215779c1b254ac9223e0db7d40f22fde78e7598846041ae34de0 |