Skip to main content

Polymarket CLOB trading CLI

Project description

Polymarket Trader CLI

A command-line tool for Polymarket CLOB trading: browse markets, inspect orderbooks, place/cancel orders, and run diagnostics. Built on py-clob-client.

Note: this repo contains the CLI/tooling only. Any AI skill definitions live in a separate repo.

Install

Recommended (uv):

uv tool install polymarket-trader

Also supported:

pipx install polymarket-trader
# or
pip install polymarket-trader

Quick Start (Polymarket UI / Proxy Wallet)

Most Polymarket accounts use a proxy (Safe) wallet that holds funds, while your MetaMask EOA signs orders. The UI shows the proxy address.

Create ~/.polymarket.env:

POLYMARKET_KEY=<your MetaMask private key>
POLYMARKET_SIG_TYPE=2
POLYMARKET_FUNDER=<proxy wallet address shown on Polymarket>
POLYMARKET_SIGNER=<your MetaMask EOA address>
POLYMARKET_RPC=https://polygon-rpc.com

Verify:

polymarket-trader whoami
polymarket-trader balance --asset-type collateral

If allowances are all zero, open Polymarket, click Buy on any market, and approve USDC (Enable trading).

Commands (examples)

List markets:

polymarket-trader markets --sampling --accepting-only --limit 50

Include titles:

polymarket-trader markets --sampling --with-title --limit 20

Orderbook / quote:

polymarket-trader orderbook <token_id>
polymarket-trader quote <token_id>

Buy with USD cap (best ask by default):

polymarket-trader buy-max <token_id> 5

Diagnostics:

polymarket-trader diagnose --onchain --fix

Full command list:

polymarket-trader --help

Environment variables

  • POLYMARKET_KEY: signer private key (required for trading)
  • POLYMARKET_SIG_TYPE: 0=EOA, 1=POLY_PROXY, 2=POLY_GNOSIS_SAFE
  • POLYMARKET_FUNDER: proxy wallet address that holds collateral
  • POLYMARKET_SIGNER: expected EOA address for safety checks
  • POLYMARKET_ENV_FILE: override env file path (default ~/.polymarket.env)
  • POLYMARKET_HOST: CLOB API host (default https://clob.polymarket.com)
  • POLYMARKET_CHAIN_ID: chain id (default 137 for Polygon)
  • POLYMARKET_RPC: RPC URL (used for onchain allowance/receipt checks)

Using from source (no install)

uv run --with py-clob-client -m polymarket_trader whoami
uv run --with py-clob-client -m polymarket_trader balance --asset-type collateral

Publishing

Local build + publish:

uv build
uv publish

CI (Trusted Publishing):

  1. Create a GitHub environment named pypi (matches the workflow).
  2. Configure a PyPI Trusted Publisher pointing to .github/workflows/publish.yml and the pypi environment.
  3. Create and push a version tag like v0.2.0.
  4. GitHub Actions will build and publish the package automatically.

Safety

  • Never paste private keys into chat or commit them to git.
  • ~/.polymarket.env is loaded automatically and should be kept local.

License

MIT (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polymarket_trader-0.2.1.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polymarket_trader-0.2.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file polymarket_trader-0.2.1.tar.gz.

File metadata

  • Download URL: polymarket_trader-0.2.1.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for polymarket_trader-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9d17c3f51b6e7e359c4b9dc8652bfc6823ae5d82c23e274c6a64c636de1fb656
MD5 49ee52b694937ccbc5a10244150105a5
BLAKE2b-256 4740af9742f766d0254b724ed21e3538020705f1cb22843db2ba985fd0c90f16

See more details on using hashes here.

File details

Details for the file polymarket_trader-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: polymarket_trader-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for polymarket_trader-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c72c0545e63d791b7a1a94e9ba81bb041430ce2d96208e6e9272d6fff1915763
MD5 56b22ba71b823d950520e6e071403784
BLAKE2b-256 2dcf0e59b1c4f935382e84bbaa510619506024025a238d00cebb2ac9f24ce9ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page