# Polymarket & Kalshi Prediction Markets Unified Scraper (`api-market/prediction-markets-unified`) Actor

Real-time prediction market odds, implied probabilities, bid-ask spreads, volume, and cross-market arbitrage hints from Polymarket & Kalshi.

- **URL**: https://apify.com/api-market/prediction-markets-unified.md
- **Developed by:** [Khan](https://apify.com/api-market) (community)
- **Categories:** AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 prediction markets

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 & Kalshi Prediction Markets Unified Scraper

Fetch live prediction market **Yes/No prices**, **implied probabilities**, **bid-ask spreads**, **24-hour trading volume**, **open interest/liquidity**, and automatic **cross-exchange matching** across both **Polymarket** and **Kalshi** — **no crypto wallet, no API keys, no proxies required**.

Instead of writing two separate integrations for Polymarket's Gamma API and Kalshi's Elections v2 API, get one normalized schema with built-in cross-venue probability gap detection (`crossMarketMatch`).

***

### Key Features & Why Use This Actor

- **2 Leading Venues in 1 Unified Schema:** Combines Polymarket and Kalshi open markets with consistent fields (`yesPrice`, `noPrice`, `impliedProbPct`, `volume24h`, `liquidity`, `closeTime`).
- **Automatic Cross-Exchange Matching (`crossMarketMatch`):** Compares market questions across Polymarket and Kalshi using token similarity to surface matching tickers and exact `probGapPctPts` spreads.
- **Kalshi Spread & Liquidity Metrics:** Calculates exact `spreadBps` (bid-ask spread in basis points) from live orderbook top-of-book prices alongside open interest.
- **Keyword & Volume Filtering:** Filter by topic (`Fed`, `BTC`, `election`, `AI`, `inflation`) and `minVolume24h` to ignore illiquid markets.
- **Zero Credentials & Ultra-Low Latency:** Queries public REST market endpoints directly without wallets, auth tokens, or proxies.

***

### Popular Use Cases

- **Prediction Market Arbitrage & Discrepancy Alerts:** Monitor `crossMarketMatch.probGapPctPts` on scheduled runs to detect probability divergences between Polymarket and Kalshi.
- **Quant & Macro Forecasting Pipelines:** Stream live implied probabilities for Fed rate decisions, CPI, elections, crypto targets, and geopolitics into Python/SQL research databases.
- **AI Forecasting Agents & Newsrooms:** Feed real-time crowd probabilities into dashboards, Slack bots, or LLM reasoning chains via Apify MCP.

***

### Input Parameters

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `platforms` | `string[]` | No | `["polymarket", "kalshi"]` | Prediction venues to query (`"polymarket"`, `"kalshi"`). |
| `keyword` | `string` | No | `""` | Case-insensitive substring filter applied to market `question`, `category`, and `ticker`. |
| `minVolume24h` | `number` | No | `0` | Exclude markets whose 24-hour trading volume is below this threshold. |
| `maxMarketsPerPlatform` | `integer` | No | `100` | Maximum matching markets collected per exchange (`1–2,000`). |
| `includeCrossMarketMatches` | `boolean` | No | `true` | Match similar questions across Polymarket and Kalshi and attach probability spread metadata. |

#### Example Input

```json
{
  "platforms": [
    "polymarket",
    "kalshi"
  ],
  "keyword": "Fed",
  "minVolume24h": 100,
  "maxMarketsPerPlatform": 100,
  "includeCrossMarketMatches": true
}
```

***

### Sample Output (Live Verified JSON)

#### Polymarket Market Record

```json
{
  "platform": "polymarket",
  "marketId": "559651",
  "ticker": "xi-jinping-out-before-2027",
  "question": "Xi Jinping out before 2027?",
  "category": "",
  "yesPrice": 0.015,
  "noPrice": 0.985,
  "impliedProbPct": 1.5,
  "spreadBps": null,
  "volumeTotal": 17367788.104742,
  "volume24h": 6551.6,
  "liquidity": 334693.09104,
  "closeTime": "2027-01-01T04:59:00Z",
  "url": "https://polymarket.com/event/xi-jinping-out-before-2027",
  "crossMarketMatch": null
}
```

#### Kalshi Market Record (with Spread in Basis Points)

```json
{
  "platform": "kalshi",
  "marketId": "KXELONMARS-99",
  "ticker": "KXELONMARS-99",
  "question": "Will Elon Musk visit Mars in his lifetime? — Will Elon Musk visit Mars before Aug 1, 2099?",
  "category": "Science and Technology",
  "yesPrice": 0.11,
  "noPrice": 0.89,
  "impliedProbPct": 11,
  "spreadBps": 200,
  "volumeTotal": 127577.67,
  "volume24h": 12.09,
  "liquidity": 40097.75,
  "closeTime": "2099-08-01T04:59:00Z",
  "url": "https://kalshi.com/markets/kxelonmars",
  "crossMarketMatch": null
}
```

*(When `includeCrossMarketMatches` is `true` and a strong question overlap is found across venues, `crossMarketMatch` populates with `matchedPlatform`, `matchedTicker`, `matchedQuestion`, `matchedProbPct`, `probGapPctPts`, and `similarity`.)*

***

### Pricing (Pay-Per-Event)

This Actor uses **Pay-Per-Event (PPE)** billing:

- **Primary Event:** `result-item`
- **Suggested Rate:** **`$0.001` per market** (**`$1.00` per 1,000 markets**)
- **Compute Cost:** Minimal — runs in under 1 second for small queries with zero proxy cost.

***

### Integrations & Exports

- **Export Formats:** JSON, CSV, Excel (XLSX), JSONL.
- **API & Schedules:** Schedule hourly/daily snapshots via Apify Console or REST API for time-series probability tracking.
- **Automation & AI:** Integrate with **n8n, Make, Zapier**, or **Apify MCP** to trigger Discord/Telegram/Slack alerts when odds cross a threshold.

***

### FAQ

**Do I need a Polymarket wallet or Kalshi API key?**\
No. Both exchanges expose public market metadata and pricing endpoints queried directly by the Actor.

**How is Kalshi's `yesPrice` calculated?**\
When both bid and ask exist, the Actor computes the midpoint `(yes_bid + yes_ask) / 2` and reports `spreadBps` as `round((ask - bid) * 10,000)`, falling back cleanly to `last_price` when the book is one-sided.

**Can I run only Polymarket or only Kalshi?**\
Yes. Pass `["polymarket"]` or `["kalshi"]` in `platforms`.

# Actor input Schema

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

Select which prediction exchanges to query ('polymarket', 'kalshi').

## `keyword` (type: `string`):

Optional substring filter on market question/title or category (e.g. Fed, BTC, election, AI).

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

Filter out inactive markets with 24h volume below this threshold.

## `maxMarketsPerPlatform` (type: `integer`):

Maximum number of matching active markets to collect per prediction exchange.

## `includeCrossMarketMatches` (type: `boolean`):

Compare question overlap between Polymarket & Kalshi to highlight probability spreads.

## Actor input object example

```json
{
  "platforms": [
    "polymarket",
    "kalshi"
  ],
  "minVolume24h": 0,
  "maxMarketsPerPlatform": 100,
  "includeCrossMarketMatches": true
}
```

# Actor output Schema

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

No description

## `markets` (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 = {
    "platforms": [
        "polymarket",
        "kalshi"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-market/prediction-markets-unified").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 = { "platforms": [
        "polymarket",
        "kalshi",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("api-market/prediction-markets-unified").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 '{
  "platforms": [
    "polymarket",
    "kalshi"
  ]
}' |
apify call api-market/prediction-markets-unified --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,api-market/prediction-markets-unified"
        }
    }
}
```

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/RCOoajNKPac7aYUKS/builds/oBvm8jXxGhMd5Loxf/openapi.json
