An agent skill for Polymarket prediction market trading and data.
One skill surface covering market search, YES/NO price quotes, order books, account management, and trading β built for AI agent environments like Claude Code, OpenClaw, Codex, and OpenCode.
# Claude Code
git clone https://github.com/dProLabs/dpro-polymarket.git .claude/skills/dpro-pm
cd .claude/skills/dpro-pm && npm installThen add to your agent config:
Skills: .claude/skills/dpro-pm/SKILL.mdgit clone https://github.com/dProLabs/dpro-polymarket.git
cd dpro-polymarket
npm install- Market search β find prediction markets by keyword, browse trending by volume
- Price quotes β YES/NO prices, liquidity, volume, token IDs for any market
- Order books β full depth for any outcome token
- Account management β encrypted multi-account storage with AES-256
- Portfolio β positions, open orders, USDC balance, trade history
- Trading β buy/sell YES/NO shares with limit or market orders (GTC/GTD/FOK/FAK)
- Flexible invocation β canonical commands, slash-style input, or natural language
- Programmatic API β
runPolymarketSkill(...)entry point for automation
dpro-pm search bitcoin 2025
dpro-pm quote will-iran-strike-israel-on-march-6
dpro-pm book <token-id>
dpro-pm trending
dpro-pm event us-presidential-election-2024
dpro-pm account add 0xYourPrivateKey myaccount --password <pwd>
dpro-pm balance
dpro-pm positions
dpro-pm orders
dpro-pm buy will-trump-win yes 50 0.65
dpro-pm sell will-trump-win yes 20
dpro-pm cancel <orderId>
dpro-pm cancel-all
import { runPolymarketSkill } from './scripts/entry.mjs';
const result = await runPolymarketSkill('dpro-pm search bitcoin', {});
console.log(result);
// With password for trading
const trade = await runPolymarketSkill(
'dpro-pm buy will-btc-hit-100k yes 10 0.65',
{ password: 'your-password' }
);
console.log(trade);Polymarket uses a two-layer auth system:
- L1 β EIP-712 private key signing β derives API credentials
- L2 β HMAC-SHA256 API key signing β authenticates trading requests
The skill handles both automatically. You only need to provide your private key once:
# Export private key from polymarket.com/settings
dpro-pm account add 0xYourPrivateKey myaccount --password <password>
# Verify connection
dpro-pm balance
# Place a trade (API credentials derived automatically on first trade)
dpro-pm buy will-trump-tariffs-exceed-10-percent yes 10 0.55Signature types:
- Default:
2(GNOSIS_SAFE) β for standard Polymarket.com accounts - Use
--sig-type 0(EOA) for raw MetaMask wallets
| Document | Description |
|---|---|
SKILL.md |
Routing, execution policy, and safety rules |
references/markets.md |
Gamma API, market structure, token IDs |
references/trading.md |
Order types, signing, tick sizes |
references/auth.md |
L1/L2 auth, credential lifecycle, signature types |
examples.md |
Task-oriented workflow cookbook |
- Trading commands always show a summary before submitting (handled by the skill's safety policy)
- Private keys are AES-256-GCM encrypted at rest β never stored in plain text
- API credentials are derived from private keys and cached separately
- Password can be passed via
--password,runtimeContext.password, orDPRO_PM_PASSWORDenv var
references/ # API and auth reference docs
scripts/
βββ entry.mjs # Single entry point: runPolymarketSkill()
βββ parser.mjs # Input parsing (command + natural language)
βββ router.mjs # AST β command handler dispatch
βββ format.mjs # Structured result β text output
βββ config.mjs # Config file management
βββ store.mjs # Encrypted account + credential storage
βββ clients/
β βββ clob-client.mjs # CLOB API (orderbook, trading) via @polymarket/clob-client
β βββ gamma-client.mjs # Gamma/Data API (markets, positions, history)
βββ commands/
β βββ market.mjs # search, quote, book, trending, event
β βββ account.mjs # account management, balance, positions, orders, history
β βββ trade.mjs # buy, sell, cancel, cancel-all
βββ utils/
βββ crypto.mjs # AES-256-GCM encryption
βββ numbers.mjs # Number formatting helpers
| API | Base URL | Purpose |
|---|---|---|
| CLOB | https://clob.polymarket.com |
Orderbook + trading (L2 auth for trades) |
| Gamma | https://gamma-api.polymarket.com |
Markets, events, search (no auth) |
| Data | https://data-api.polymarket.com |
Positions, trade history (no auth) |
| Contract | Address |
|---|---|
| USDC.e | 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 |
| CTF Exchange | 0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E |
| Neg Risk CTF Exchange | 0xC5d563A36AE78145C45a50134d48A1215220f80a |
MIT