# Polymarket Market Scraper (MCP-ready) (`jovian_zabra_nk5/polymarket-market-scraper`) Actor

Normalized Polymarket prediction-market data from public APIs: questions, outcomes with live prices, 24h volume, liquidity, optional CLOB orderbook depth. No login, no proxies. Agent/MCP-friendly JSON.

- **URL**: https://apify.com/jovian_zabra_nk5/polymarket-market-scraper.md
- **Developed by:** [dev bro](https://apify.com/jovian_zabra_nk5) (community)
- **Categories:** Developer tools, AI, Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 result market records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Polymarket Market Scraper

Get normalized **Polymarket prediction-market data** from its public APIs — questions, outcomes with live prices, 24h volume, liquidity, end dates, tags, and optional **CLOB orderbook depth**. **No login, no proxies** — pure official APIs (gamma-api + clob), fast and reliable.

Built for **AI agents and MCP clients**: flat JSON output, one record per market, ready for datasets, databases, or agent tools.

### Features

- 📈 Active markets ranked by 24h volume (default: top 50)
- 🏷️ Optional tag filter (`crypto`, `politics`, `sports`, `nba`, ...)
- 💰 Normalized outcomes with live prices: `[{ "name": "Yes", "price": 0.125 }, ...]`
- 📊 Volume & liquidity: `volume24hr`, `volumeNum`, `liquidityNum`
- 📖 Optional orderbook depth (best bid/ask + total depth) for the top N markets via the CLOB API
- 🆔 `conditionId` + `clobTokenIds` included → trade-ready identifiers for bots
- ⚡ Runs in seconds, costs a fraction of a cent

### Input

```json
{
  "tagSlugs": [],
  "limit": 50,
  "minVolume24hUsd": 1000,
  "includeOrderbook": true,
  "orderbookTopN": 3
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `tagSlugs` | string\[] | `[]` (all) | Filter by Polymarket tag slug |
| `limit` | int | `50` | Max markets per tag, ranked by 24h volume |
| `minVolume24hUsd` | int | `0` | Skip markets below this 24h volume |
| `includeOrderbook` | bool | `false` | Fetch CLOB orderbook for top markets |
| `orderbookTopN` | int | `3` | How many top markets get orderbooks |

### Output

One dataset record per market:

```json
{
  "question": "Will Indiana enact a data center moratorium by December 31, 2026?",
  "slug": "will-indiana-enact-a-data-center-moratorium",
  "conditionId": "0x...",
  "clobTokenIds": "[\"123...\", \"456...\"]",
  "endDate": "2026-12-31T00:00:00Z",
  "volume24hr": 126505.5,
  "volumeNum": 4500000,
  "liquidityNum": 139830.1,
  "outcomes": [
    { "name": "Yes", "price": 0.125 },
    { "name": "No", "price": 0.875 }
  ],
  "tags": ["politics"],
  "url": "https://polymarket.com/market/...",
  "orderbook": {
    "bestBid": "0.12",
    "bestAsk": "0.13",
    "bidDepth": 2128891.32,
    "askDepth": 1607415.02
  }
}
```

(`orderbook` present only for the top N when `includeOrderbook` is on.)

### Use cases

- **AI agent prediction-market tool** (MCP): live odds for any agent decision pipeline
- Odds monitoring/alerting: poll prices, notify on moves above a threshold
- Cross-market analytics: volume/liquidity trends across tags
- Trading bots: `clobTokenIds` + orderbook depth → straight into execution logic
- Research datasets: prediction-market efficiency studies, calibration data

### Performance & reliability

- Uses Polymarket's official public APIs (`gamma-api.polymarket.com`, `clob.polymarket.com`) — no HTML scraping, no proxies, no browser
- Typical run: a few seconds
- Polite delays between calls; no auth needed

### Pricing

Pay per event — you pay a small flat fee per 1,000 market records. Free trial included, see the pricing tab.

### Support

Open an issue on this Actor's Issues tab — I respond quickly (within a day, usually hours).

# Actor input Schema

## `tagSlugs` (type: `array`):

Filter by Polymarket tag slug (e.g. crypto, politics, sports, nba). Empty = all markets.

## `limit` (type: `integer`):

Number of active markets to return per tag, ranked by 24h volume.

## `minVolume24hUsd` (type: `integer`):

Skip markets below this 24h volume.

## `includeOrderbook` (type: `boolean`):

Fetch CLOB orderbook (bids/asks) for the top N markets by volume.

## `orderbookTopN` (type: `integer`):

Number of top markets (by 24h volume) to fetch orderbook depth for.

## Actor input object example

```json
{
  "tagSlugs": [],
  "limit": 50,
  "minVolume24hUsd": 0,
  "includeOrderbook": false,
  "orderbookTopN": 3
}
```

# Actor output Schema

## `markets` (type: `string`):

One record per active Polymarket market, sorted by 24h volume, with outcome prices, volume, liquidity and (optionally) CLOB orderbook depth.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "limit": 50,
    "orderbookTopN": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("jovian_zabra_nk5/polymarket-market-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "limit": 50,
    "orderbookTopN": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("jovian_zabra_nk5/polymarket-market-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "limit": 50,
  "orderbookTopN": 3
}' |
apify call jovian_zabra_nk5/polymarket-market-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jovian_zabra_nk5/polymarket-market-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/S4TFU0Lwp8cSNtYRO/builds/yergHOjH5QSIEESq6/openapi.json
