# Kalshi & Polymarket Prediction Markets Scraper (`theagentloop/kalshi-polymarket-scraper`) Actor

Export normalized prediction-market data from Kalshi and Polymarket: odds, 24h volume, open interest, liquidity, close time and event category. One row per market, ranked by volume. Official public APIs, no browser, no login.

- **URL**: https://apify.com/theagentloop/kalshi-polymarket-scraper.md
- **Developed by:** [The Agent Loop](https://apify.com/theagentloop) (community)
- **Categories:** AI, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 market rows

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

## Kalshi & Polymarket Prediction Markets Scraper

Export live prediction-market data from Kalshi and Polymarket into one normalized dataset.

The actor reads each venue's official public API, normalizes each market into one row, filters out zero-value noise, and ranks markets by 24h volume. No browser, no HTML parsing, and no login.

### What you get

One row per market with:

- `venue`: `kalshi` or `polymarket`
- `event_id`, `event_title`, `category`
- `market_id`, `market_name`, `question`, `subtitle`
- `status`, `result`
- `yes_price`, `no_price` (0 to 1)
- `yes_bid`, `yes_ask`, `no_bid`, `no_ask`, `last_price`
- `volume`, `volume_24h`, `open_interest`, `liquidity`
- `close_time`
- `url`
- `volume_rank`, `rank`
- `fetched_at`

`volume_24h_source` and `open_interest_source` tell you whether the number came from the market itself or from its parent event. Polymarket publishes 24h volume per market but sometimes only publishes open interest at the event level, so the field is explicit instead of guessed. Polymarket `category` is `null` when the API does not attach tags to the event.

### How it works

- Kalshi: `GET /trade-api/v2/events` with `with_nested_markets=true`. This endpoint excludes multivariate combo events, which is what makes the output useful instead of a wall of zero-liquidity parlays.
- Polymarket: `GET /markets` from the Gamma API, ordered by `volume24hr`. Each market carries its own 24h volume plus an embedded event with the id, title and slug used for the event fields and the public URL.
- Both sources are fetched in parallel. If one venue fails, the run still returns the other venue and writes the failure to `VENUE_STATUS` in the key-value store.
- Markets are filtered by status, optional text query and optional minimum 24h volume, then sorted by 24h volume and capped per venue.

### Input example

```json
{
  "includeKalshi": true,
  "includePolymarket": true,
  "query": "",
  "status": "open",
  "maxMarketsPerVenue": 100,
  "scanItemsPerVenue": 1000,
  "minVolume24h": 0
}
```

#### Input fields

| Field | Type | Default | Meaning |
|---|---|---|---|
| `includeKalshi` | boolean | `true` | Read Kalshi. |
| `includePolymarket` | boolean | `true` | Read Polymarket. |
| `query` | string | `""` | Case-insensitive text filter on question, event title, subtitle or category. |
| `status` | string | `"open"` | `open`, `closed` or `all`. |
| `maxMarketsPerVenue` | integer | `100` | Cap after ranking by 24h volume. |
| `scanItemsPerVenue` | integer | `1000` | Items read before ranking: events for Kalshi, markets for Polymarket. Higher means broader coverage and a slower run. |
| `minVolume24h` | number | `0` | Drop markets below this 24h volume. |

### Output example

One verbatim row from a completed run (`38iKr3oiRbdCJA8mc`, 2026-10-19), copied exactly as the dataset returned it:

```json
{
  "venue": "kalshi",
  "event_id": "KXPRESNOMD-28",
  "event_title": "2028 Democratic presidential nominee",
  "category": "Elections",
  "market_id": "KXPRESNOMD-28-AELS",
  "market_name": "Will Abdul El-Sayed be the nominee for the Presidency for the Democratic party?",
  "question": "Will Abdul El-Sayed be the nominee for the Presidency for the Democratic party?",
  "subtitle": "Abdul El-Sayed",
  "status": "active",
  "result": null,
  "yes_price": 0.005,
  "no_price": 0.995,
  "yes_bid": 0,
  "yes_ask": 0.01,
  "no_bid": 0.99,
  "no_ask": 1,
  "last_price": 0.01,
  "volume": 4860938.34,
  "volume_24h": 597091.38,
  "volume_24h_source": "market",
  "open_interest": 3305465.44,
  "open_interest_source": "market",
  "liquidity": null,
  "close_time": "2028-11-07T15:00:00Z",
  "url": "https://kalshi.com/markets/kxpresnomd",
  "fetched_at": "2026-10-19T12:06:51.746112+00:00",
  "volume_rank": 1,
  "rank": 2
}
```

### Common uses

- Track odds and volume across two prediction markets in one table.
- Feed an AI agent or dashboard with a clean market snapshot.
- Compare pricing on the same event when both venues list it.
- Build a dataset of resolved markets for calibration research.

### Pricing

Pay per event: **$0.005 per market row** written to the dataset. A default run returns up to 100 markets per venue (200 rows) and costs about $1.00. The run page shows the maximum charge before you start, and the actor stops writing rows when your budget is reached.

The price is charged only for rows actually written. If a venue fails or a filter removes everything, you pay for nothing.

### Notes and limitations

- This actor is read-only. It does not place, cancel or settle trades.
- Kalshi prices are returned as probabilities between 0 and 1. Legacy cent fields are converted automatically.
- Polymarket can return a legal or geo block (HTTP 451) from some networks. When that happens the actor records the HTTP status in `VENUE_STATUS` and returns Kalshi data. It does not route around the block with proxies by default.
- The actor returns market data, not financial advice. Verify anything you trade on at the source.
- Not affiliated with Kalshi or Polymarket.

### Support

Open an issue on the actor page and include the run ID plus the `VENUE_STATUS` value.

# Actor input Schema

## `includeKalshi` (type: `boolean`):

Read Kalshi's public Trade API.

## `includePolymarket` (type: `boolean`):

Read Polymarket's public Gamma API. Polymarket can return a legal block from some networks; the run still returns Kalshi data if that happens.

## `query` (type: `string`):

Keep only markets whose question, event title, subtitle or category contains this text, case-insensitive. Leave empty to keep everything.

## `status` (type: `string`):

Open returns tradable markets. Closed returns resolved markets. All returns both.

## `maxMarketsPerVenue` (type: `integer`):

After sorting by 24h volume, keep at most this many markets from each venue.

## `minVolume24h` (type: `number`):

Drop markets whose 24h volume is below this amount. Use 0 to keep everything.

## `scanItemsPerVenue` (type: `integer`):

Kalshi: events. Polymarket: markets. How many items to read before ranking. Higher values give better coverage of lower-volume markets and take longer.

## Actor input object example

```json
{
  "includeKalshi": true,
  "includePolymarket": true,
  "query": "",
  "status": "open",
  "maxMarketsPerVenue": 100,
  "minVolume24h": 0,
  "scanItemsPerVenue": 1000
}
```

# Actor output Schema

## `dataset` (type: `string`):

Default dataset with one market per row. Supports JSON, CSV and Excel export.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("theagentloop/kalshi-polymarket-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("theagentloop/kalshi-polymarket-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 '{}' |
apify call theagentloop/kalshi-polymarket-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,theagentloop/kalshi-polymarket-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/W6yTiZk1H69ewNkA6/builds/rlyStIvGQnnQKvNwL/openapi.json
