# Kalshi & Polymarket Scraper — Odds, Orderbooks & Arbitrage (`qilu/kalshi-polymarket-scraper`) Actor

Scrape real-time prediction market odds, volume, liquidity, order books, and cross-platform arbitrage spreads from Kalshi and Polymarket via official public APIs. No login, no cookies, zero proxy overhead.

- **URL**: https://apify.com/qilu/kalshi-polymarket-scraper.md
- **Developed by:** [Qilu Zhang](https://apify.com/qilu) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.05 / 1,000 prediction 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Scraper — Live Odds, Orderbooks & Arbitrage Spreads

Real-time prediction market data from **Polymarket** and **Kalshi** in a single unified JSON schema — powered directly by official public REST APIs.

- **No login, no API keys, no cookies** — click **Start** and get structured data in seconds.
- **Zero browser overhead** — direct async HTTP requests mean ultra-fast runs and minimal compute usage.
- **Built for quant researchers, traders, data pipelines, and AI agents (MCP-ready)**.

***

### Key Features

1. **Unified Multi-Exchange Schema**
   Compare Polymarket and Kalshi side by side with normalized `yesPrice`, `noPrice`, `yesProbabilityPct`, `bestBid`, `bestAsk`, `bidAskSpread`, `volume24h`, `totalVolume`, `liquidity`, `openInterest`, `closeTime`, and direct event URLs.
2. **Cross-Platform Arbitrage & Spread Scanner (`mode: "arbitrage"`)**
   Automatically pairs matching Kalshi and Polymarket contracts, calculates the live YES probability gap (`yesSpreadPct`), and checks whether buying YES on one exchange + NO on the other locks a risk-free edge (`combinedYesNoCost < 1.0`).
3. **Optional Live Order Book Depth (`includeOrderbook: true`)**
   Enrich returned markets with real-time top-N bid and ask levels from Polymarket CLOB and Kalshi Orderbook APIs.
4. **Smart Noise Filtering**
   Filter by keyword (`searchQuery`), `category`, `minVolume24h`, `minTotalVolume`, or toggle `excludeSports` to focus purely on politics, macroeconomics, crypto, tech, and climate markets. Automatically skips untraded Kalshi multivariate parlays.
5. **Fair Pay-Per-Event Pricing**
   You are only charged for valid records actually returned in the dataset. Filtered-out markets, empty searches, and errors are **100% free**.

***

### Pricing (Pay-Per-Event)

| Event | Price | Description |
| :--- | :--- | :--- |
| `market-record` | **$0.0015 / record** ($1.50 per 1,000) | One normalized Polymarket or Kalshi market record |
| `arbitrage-match` | **$0.0030 / match** ($3.00 per 1,000) | One matched cross-platform Kalshi vs Polymarket spread pair |
| `orderbook-snapshot` | **$0.0010 / snapshot** ($1.00 per 1,000) | Optional add-on when `includeOrderbook` is enabled |

> Free Apify users can preview up to **20 records** per run. Paid Apify plans unlock up to **5,000 records** per run.

***

### Input Examples

#### 1. Top 25 Non-Sports Prediction Markets (Both Exchanges)

```json
{
  "mode": "markets",
  "platforms": ["polymarket", "kalshi"],
  "excludeSports": true,
  "minTotalVolume": 100,
  "sortBy": "volume24h",
  "maxItems": 25
}
```

#### 2. Search Fed / Interest Rate Markets with Live Order Books

```json
{
  "mode": "markets",
  "platforms": ["polymarket", "kalshi"],
  "searchQuery": "Fed",
  "includeOrderbook": true,
  "orderbookDepth": 5,
  "maxItems": 30
}
```

#### 3. Scan Cross-Platform Kalshi vs Polymarket Spreads

```json
{
  "mode": "arbitrage",
  "excludeSports": true,
  "minTotalVolume": 500,
  "maxScanEventsPerPlatform": 400,
  "minArbSpreadPct": 2.0,
  "minMatchScore": 0.42,
  "maxItems": 50
}
```

***

### Sample Output

#### Market Record (`mode: "markets"`)

```json
{
  "recordType": "market",
  "platform": "polymarket",
  "marketId": "516842",
  "eventId": "142910",
  "eventTitle": "Fed Decision in December?",
  "question": "Will the Fed decrease interest rates by 25 bps?",
  "outcomeLabel": "25 bps decrease",
  "category": "Economy",
  "tags": ["fed", "fomc", "economy", "fed-rates"],
  "status": "open",
  "isBinary": true,
  "outcomes": [
    { "name": "Yes", "price": 0.645, "probabilityPct": 64.5 },
    { "name": "No", "price": 0.355, "probabilityPct": 35.5 }
  ],
  "yesPrice": 0.645,
  "noPrice": 0.355,
  "yesProbabilityPct": 64.5,
  "bestBid": 0.64,
  "bestAsk": 0.65,
  "bidAskSpread": 0.01,
  "volume24h": 412580.42,
  "totalVolume": 8912340.15,
  "liquidity": 530200.0,
  "openInterest": 1240500.0,
  "oneDayPriceChange": 0.025,
  "closeTime": "2026-12-18T19:00:00Z",
  "url": "https://polymarket.com/event/fed-decision-in-december",
  "scrapedAt": "2026-11-23T12:00:00Z"
}
```

#### Cross-Platform Spread Match (`mode: "arbitrage"`)

```json
{
  "recordType": "arbitrage_match",
  "matchScore": 0.72,
  "polymarketQuestion": "Will Elon Musk visit Mars in his lifetime?",
  "polymarketYesPrice": 0.145,
  "kalshiQuestion": "Will Elon Musk visit Mars in his lifetime?",
  "kalshiYesPrice": 0.115,
  "yesPriceDiff": 0.03,
  "yesSpreadPct": 3.0,
  "bestBuyYesPlatform": "kalshi",
  "bestBuyYesPrice": 0.13,
  "bestBuyNoPlatform": "polymarket",
  "bestBuyNoPrice": 0.86,
  "combinedYesNoCost": 0.99,
  "guaranteedArbEdgePct": 1.0,
  "isRiskFreeArb": true,
  "polymarketUrl": "https://polymarket.com/event/...",
  "kalshiUrl": "https://kalshi.com/markets/kxelonmars",
  "scrapedAt": "2026-11-23T12:00:00Z"
}
```

***

### Output Fields Reference

| Field | Type | Description |
| :--- | :--- | :--- |
| `platform` | string | `"polymarket"` or `"kalshi"` |
| `marketId` | string | Unique market ID (Polymarket ID or Kalshi ticker) |
| `eventId` | string | Parent event ID / `event_ticker` |
| `eventTitle` | string | Parent event title |
| `question` | string | Specific contract question |
| `category` | string | Normalized category (`Politics`, `Economy`, `Crypto`, `Tech`, `Climate`, `Sports`, etc.) |
| `yesPrice` / `noPrice` | number | Implied YES/NO probability in `$0.00–$1.00` scale |
| `yesProbabilityPct` | number | Implied YES probability in `0–100%` |
| `bestBid` / `bestAsk` / `bidAskSpread` | number | Top-of-book YES bid, ask, and spread |
| `volume24h` / `totalVolume` | number | 24-hour and cumulative volume |
| `liquidity` / `openInterest` | number | Available liquidity / open interest |
| `orderbook` | object | Optional live bids, asks, and total depth when `includeOrderbook` is true |
| `closeTime` | string | ISO-8601 market close/resolution timestamp |
| `url` | string | Direct link to the market on Polymarket or Kalshi |

# Actor input Schema

## `mode` (type: `string`):

Choose whether to output unified live markets, cross-platform Kalshi vs Polymarket arbitrage spreads, or both.

## `platforms` (type: `array`):

Select which prediction market exchanges to fetch in 'markets' mode. In 'arbitrage' or 'both' mode, both platforms are queried automatically.

## `searchQuery` (type: `string`):

Case-insensitive keyword or phrase to match against event title, market question, category, or tags (e.g. 'Fed', 'Bitcoin', 'Trump', 'Recession'). Markets that do not match are skipped and never charged.

## `category` (type: `string`):

Filter markets by category or tag substring (e.g. 'Politics', 'Economy', 'Crypto', 'Tech', 'Climate', 'Sports', 'Elections'). Leave empty for all categories.

## `excludeSports` (type: `boolean`):

Skip sports game lines and parlays so results focus on politics, macroeconomics, crypto, tech, and world events.

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

Only return markets with 24-hour volume at or above this threshold.

## `minTotalVolume` (type: `number`):

Skip illiquid or untraded markets whose cumulative volume is below this value. Set to 0 to include all open markets.

## `sortBy` (type: `string`):

Sort order applied before returning up to maxItems results.

## `maxItems` (type: `integer`):

Maximum number of market records (or arbitrage matches in arbitrage mode) to output. Free Apify accounts are capped at 20 preview items.

## `maxScanEventsPerPlatform` (type: `integer`):

How many open events to scan from each exchange before filtering and sorting. Increase this when searching for niche topics or running deep arbitrage scans.

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

Fetch live top-of-book bids and asks for each returned market via Polymarket CLOB and Kalshi Orderbook APIs.

## `orderbookDepth` (type: `integer`):

Number of bid and ask price levels to keep per market when Include Live Order Book Depth is enabled.

## `minArbSpreadPct` (type: `number`):

Minimum absolute YES probability gap (in percentage points) required to emit a cross-platform match in arbitrage/both mode.

## `minMatchScore` (type: `number`):

Similarity threshold (0.20 to 0.95) for pairing Kalshi and Polymarket questions. Higher values give stricter matches.

## Actor input object example

```json
{
  "mode": "markets",
  "platforms": [
    "polymarket",
    "kalshi"
  ],
  "searchQuery": "",
  "category": "",
  "excludeSports": true,
  "minVolume24h": 0,
  "minTotalVolume": 100,
  "sortBy": "volume24h",
  "maxItems": 25,
  "maxScanEventsPerPlatform": 150,
  "includeOrderbook": false,
  "orderbookDepth": 5,
  "minArbSpreadPct": 2,
  "minMatchScore": 0.55
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `arbitrage` (type: `string`):

No description

# 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 = {
    "mode": "markets",
    "platforms": [
        "polymarket",
        "kalshi"
    ],
    "excludeSports": true,
    "minTotalVolume": 100,
    "sortBy": "volume24h",
    "maxItems": 25,
    "maxScanEventsPerPlatform": 150,
    "includeOrderbook": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("qilu/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 = {
    "mode": "markets",
    "platforms": [
        "polymarket",
        "kalshi",
    ],
    "excludeSports": True,
    "minTotalVolume": 100,
    "sortBy": "volume24h",
    "maxItems": 25,
    "maxScanEventsPerPlatform": 150,
    "includeOrderbook": False,
}

# Run the Actor and wait for it to finish
run = client.actor("qilu/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 '{
  "mode": "markets",
  "platforms": [
    "polymarket",
    "kalshi"
  ],
  "excludeSports": true,
  "minTotalVolume": 100,
  "sortBy": "volume24h",
  "maxItems": 25,
  "maxScanEventsPerPlatform": 150,
  "includeOrderbook": false
}' |
apify call qilu/kalshi-polymarket-scraper --silent --output-dataset

```

## MCP server setup

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