Polymarket

A comprehensive finance skill that unifies three Polymarket API surfaces into a single agent-friendly interface. Market Discovery (Gamma API) lets agents search markets by keyword or category, track trending events, view prices and volumes, and find breaking news — no auth required.

80Trust Medium
by DevAgarwal2financeadvancedv1.0.0updated Mar 14, 2026
4.6kTotal Runs
86.0%Success Rate
1.3kInstalls
80Trust Score

Tags

#polymarket#prediction-markets#trading#clob#polygon#defi#crypto#finance#analytics#portfolio

Required Tools

bashweb_fetchjson_parse

Inputs

NameTypeDescriptionReq
modetextWhich API surface to use: "discover" (Gamma — market search/browse), "trade" (CLOB — buy/sell/manage), or "analyze" (Data API — user positions/P&L). Required.yes
actiontextAction within the mode. See SKILL.md for full list.yes
paramsjsonAction-specific parameters as JSON.--
wallet_addresstextPolygon wallet address (lowercase 0x-prefixed, 42 chars). Required for trade mode and analyze mode.--

Outputs

NameTypeDescriptionReq
resultjsonStructured JSON response. Shape varies by mode and action.yes

Compatible Skills

SKILL.md

---
name: polymarket
description: Unified Polymarket toolkit — discover prediction markets, execute trades on the CLOB, and analyze user portfolios. Three APIs in one skill.
---

# Polymarket — Unified Prediction Market Toolkit

Discover prediction markets, execute trades, and analyze portfolios.

## Overview

This skill combines three Polymarket APIs:
- **Gamma API**: Market discovery and browsing
- **CLOB API**: Trading execution
- **Data API**: User analytics and portfolios

## Quick Start

### Market Discovery (Gamma API)

```bash
# Search markets
curl "https://gamma-api.polymarket.com/public-search?q=bitcoin&limit_per_type=20"

# Trending by volume
curl "https://gamma-api.polymarket.com/events/pagination?active=true&closed=false&order=volume24hr&ascending=false&limit=20"

# Get market by slug
curl "https://gamma-api.polymarket.com/markets/slug/will-bitcoin-hit-100k-by-2025"
```

### Trading (CLOB API)

```bash
# Setup required:
# 1. Install: bun install @polymarket/clob-client ethers@^5.7.2
# 2. Generate credentials: bun run scripts/check-creds.ts
# 3. Setup allowances: bun run scripts/setup-allowances.ts

# Buy shares
bun run scripts/buy.ts --token TOKEN_ID --price 0.50 --size 100 --type limit

# Sell shares
bun run scripts/sell.ts --token TOKEN_ID --price 0.60 --size 100 --type limit

# Check orders
bun run scripts/check-orders.ts
```

### User Analytics (Data API)

```bash
# Get positions
curl "https://data-api.polymarket.com/positions?user=0x...&limit=20"

# Get portfolio value
curl "https://data-api.polymarket.com/value?user=0x..."

# Get leaderboard
curl "https://data-api.polymarket.com/v1/leaderboard?category=FINANCE&timePeriod=MONTH&orderBy=PNL&limit=25"
```

## Market vs Limit Orders

| Order Type | --size Means | Example | Minimum |
|------------|--------------|---------|---------|
| **MARKET** | Dollar amount | --size 100 = spend $100 | MORE than $1.00 |
| **LIMIT** | Share count | --size 100 = buy 100 shares | 5 shares + total > $1.00 |

## Base URLs

| API | URL |
|-----|-----|
| Gamma | https://gamma-api.polymarket.com |
| CLOB | https://clob.polymarket.com |
| Data | https://data-api.polymarket.com |

## Address Format

Wallet addresses MUST be:
- Lowercase
- 0x-prefixed
- Exactly 42 characters (0x + 40 hex)

```python
def format_address(address):
    clean = address.lower().replace('0x', '')
    return f"0x{clean}"
```

## Smart Contracts

| Contract | Polygon Address |
|----------|----------------|
| USDC.e | 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 |
| CTF Exchange | 0xFdb77a4fD16E1418856f45D53d0DB9C17c4ea5E9 |

## Which Skill to Use?

| User asks about... | Use |
|-------------------|-----|
| Find markets, odds | Gamma API |
| Buy/sell shares | CLOB API |
| Portfolio, P&L, trades | Data API |

## Requirements

- Bun runtime (v1.0+)
- Polygon wallet with USDC.e and MATIC
- @polymarket/clob-client
- ethers v5.7.2-5.8.0

## Price Intelligence

Both buy.ts and sell.ts show:
- ASK Price (instant buy)
- BID Price (limit order)
- Midpoint
- Spread
- Trading tips

## Resources

- Polymarket: https://polymarket.com
- CLOB API Docs: https://docs.polymarket.com/developers/CLOB
- Gamma API Docs: https://docs.polymarket.com/developers/gamma-markets-api
- GitHub: https://github.com/DevAgarwal2/poly-trading-skills