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

Build a wheel/sdist:

uv run --with build -m build

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.0.tar.gz (93.2 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.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: polymarket_trader-0.2.0.tar.gz
  • Upload date:
  • Size: 93.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for polymarket_trader-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9b7bbad50df1da1a1fa320ae4e0386eeed22d467e864ac51c9ba46b980f137fa
MD5 f4996aaf5b3a240bf1f65ea28ec75141
BLAKE2b-256 4cfde165f0b584b108bd0166da7212744ae3aa7ae175b7d07dec779c670f14bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polymarket_trader-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4620523bcb3b010140ac4d3904e8256584d786b7ac54ad4a9c15680949f11833
MD5 3733490f797debc4bc26f74425b76929
BLAKE2b-256 2cb9e307fa1605fe5e941fb8917bdbfd668d4437412b24852dfde6103cf60fe7

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