Before you start
- A Polymarket account and its wallet private key (or a dedicated trading wallet)
- Python with
py-clob-client
Create your Polymarket API key
- 1
Install the client
Run
pip install py-clob-client. - 2
Create the client with your wallet
Instantiate
ClobClient("https://clob.polymarket.com", key=PRIVATE_KEY, chain_id=137)(add your funder/proxy address if your account uses one). - 3
Derive credentials
Call
client.create_or_derive_api_creds(); it returns the API key, secret and passphrase. - 4
Store them
Save
POLYMARKET_API_KEY,POLYMARKET_API_SECRETandPOLYMARKET_API_PASSPHRASE; keep the wallet key out of code.
Test the key
Before wiring the key into a strategy, make one request by hand. It separates “the key is wrong” from “my code is wrong”.
from py_clob_client.client import ClobClient
client = ClobClient("https://clob.polymarket.com", key=PRIVATE_KEY, chain_id=137)
client.set_api_creds(client.create_or_derive_api_creds())
print(client.get_orders())Keep the credentials safe
- Store values in a password manager or a git-ignored
.env, never in code or notebooks you share. - In an AlgoGP project you can still add them under APIs & keys (encrypted at rest) and read them with
strategy_runtime.secrets.get("POLYMARKET_API_KEY"). - Give each bot its own credential so you can revoke one without stopping the others.
POLYMARKET_API_KEY=paste-your-value-here
POLYMARKET_API_SECRET=paste-your-value-here
POLYMARKET_API_PASSPHRASE=paste-your-value-hereDesign and backtest your Polymarket strategy first
AlgoGP turns an idea into Python and tests it on years of history before you connect it to Polymarket. The exported code keeps the broker behind four small adapter methods.
- AI copilot writes and revises the rules
- Backtests with realistic costs
- Exported Python ready to wire to Polymarket
Free plan, no card required.
AlgoGP is not affiliated with Polymarket. Menus get renamed from time to time; if a label differs, the official documentation has the current path.