Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.openpx.trade/llms.txt

Use this file to discover all available pages before exploring further.

MetaMask wallet

Put your credentials in .env.
POLYMARKET_PRIVATE_KEY=0x... # MetaMask EOA private key
POLYMARKET_FUNDER=0x... # Polymarket Safe address
(Find your Safe address at polymarket.com/settings.) Then pass them to the constructor:
import os
from openpx import Exchange

exchange = Exchange("polymarket", {
    "private_key": os.environ["POLYMARKET_PRIVATE_KEY"],
    "funder":      os.environ["POLYMARKET_FUNDER"],
})

Plain EOA (no Safe)

Drop POLYMARKET_FUNDER — that’s it.

If you get a Cloudflare WAF error

Polymarket blocks POST /auth/api-key from VPN / datacenter IPs. Generate keys once at polymarket.com/settings → API Keys, then add:
POLYMARKET_API_KEY=...
POLYMARKET_API_SECRET=...
POLYMARKET_API_PASSPHRASE=...
Then pass them to the constructor:
import os
from openpx import Exchange

exchange = Exchange("polymarket", {
    "private_key":    os.environ["POLYMARKET_PRIVATE_KEY"],
    "funder":         os.environ["POLYMARKET_FUNDER"],
    "api_key":        os.environ["POLYMARKET_API_KEY"],
    "api_secret":     os.environ["POLYMARKET_API_SECRET"],
    "api_passphrase": os.environ["POLYMARKET_API_PASSPHRASE"],
})