# Polymarket & Kalshi Odds, CLOB Depth & Arbitrage (`sequined_lacework/polymarket-kalshi-arbitrage`) Actor

Live prediction market odds from Polymarket and Kalshi in one normalized dataset: yes/no probabilities, best bid/ask, top-3 orderbook depth, 24h volume, cross-platform market matching and arbitrage flags. Public APIs only, no browser, no proxy, no API key, pay per market.

- **URL**: https://apify.com/sequined_lacework/polymarket-kalshi-arbitrage.md
- **Developed by:** [Egor Kramskoy](https://apify.com/sequined_lacework) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 markets fetched

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/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 Odds, CLOB Depth & Arbitrage

Pull live **prediction market odds** from **Polymarket** and **Kalshi** into one normalized dataset: YES and NO probabilities, best bid and ask, **top-3 orderbook depth in USD**, 24h volume, liquidity and close time. The Actor also **matches equivalent markets across both platforms** and flags **cross-platform arbitrage opportunities**. It reads only public APIs (Polymarket Gamma and CLOB, Kalshi trade API) with `httpx`, so there is no browser, no proxy, no login and no API key. Pay per market.

Use it as a **Polymarket API**, **Kalshi API**, **prediction market data feed**, **Polymarket vs Kalshi odds comparison** or **prediction market arbitrage scanner**, without writing and maintaining the pagination, parlay filtering and orderbook code yourself.

### Who uses it

- **Traders and arbitrage hunters**: scan both venues on a schedule and alert when the same event is priced differently.
- **Quant researchers**: build datasets of implied probabilities, spreads and book depth to study calibration and liquidity.
- **Journalists and analysts**: quote what the crowd prices for elections, Fed decisions, crypto levels and sports, with links to the source market.
- **Dashboards and bots**: feed a Grafana, Sheets, Telegram or Slack view with one clean schema instead of two different APIs.
- **AI agents**: ask an assistant "what do prediction markets say about X" through MCP and get structured answers.

### What you get

One dataset item per market, the same fields for both platforms:

| Field | Description |
| --- | --- |
| `platform`, `market_id` | `polymarket` or `kalshi`; Polymarket market id or Kalshi ticker |
| `event_title`, `question` | Parent event and market question |
| `yes_probability`, `no_probability` | Mid of best bid and ask when both exist, otherwise the last or outcome price; NO is 1 minus YES |
| `best_bid`, `best_ask`, `spread` | Top of book for the YES contract, in dollars (0 to 1) |
| `orderbook_bid_depth_top3`, `orderbook_ask_depth_top3` | USD value (size x price) of the top 3 YES bid and ask levels; `null` when `includeOrderbook` is off or the book failed |
| `volume_24h`, `liquidity` | 24h volume and platform liquidity in USD (`liquidity` is `null` when not published) |
| `close_time`, `market_url` | ISO close time and a link to the market page |
| `matched_counterpart` | Matched market on the other platform: `platform`, `market_id`, `question`, `yes_probability`, `market_url`, `match_score` |
| `cross_platform_diff_pp` | (this YES minus counterpart YES) x 100, one decimal, in percentage points |
| `arbitrage_opportunity` | `true` for a matched pair that passes the arbitrage test below |
| `status`, `error_message` | `ok`, or `error` for a platform that could not be read |

Details worth knowing:

- Polymarket: markets come from the Gamma events API sorted by 24h volume. Only Yes/No markets are returned; multi-outcome markets such as "Team A vs Team B" are skipped. Orderbooks come from the CLOB `/book` endpoint for the YES token.
- Kalshi: open markets come from the events API with nested markets. Multi-leg parlay markets (`KXMVE...`) are excluded because they flood the market list. Orderbooks hold bids only, so the YES ask is 1 minus the best NO bid.
- Kalshi `volume_24h` is the number of contracts traded in 24h; each contract has $1 notional, so it is comparable to USD volume (Kalshi's own convention).
- With `includeOrderbook` on, `best_bid`, `best_ask` and `yes_probability` are recomputed from the live book.

### Matching and arbitrage method

**Matching** (when `findArbitrageMatches` is on and both platforms returned markets):

1. Titles are normalized: lowercased, punctuation and stopwords removed (will, the, by, in, on, of and similar), numbers unified (`$100k`, `100,000` and `100000` are the same number), month names unified (`Dec` is `December`).
2. Score = token Jaccard similarity + 0.3 x overlap of key entities (numbers, capitalized names, years, months).
3. Hard rejects: conflicting numbers (above $100k vs above $90k), conflicting names, years or months, and opposite directions (raise vs cut, above vs below).
4. Close times must be within 3 days when both are known, and the score must be at least 0.55.
5. Pairs are assigned one to one, best score first. Both rows of a pair get `matched_counterpart` and `cross_platform_diff_pp`.

**Arbitrage flag**: a pair is flagged when buying YES on one platform and NO on the other costs less than **$0.98** (the $1 payout minus a 2% fee and slippage buffer), in either direction:

- Polymarket YES ask + Kalshi NO ask < 0.98
- Kalshi YES ask + Polymarket NO ask < 0.98

The NO ask is computed as 1 minus the YES bid of that platform. When a bid or ask is missing, the YES probability is used instead.

Disclaimers:

- **This is data, not financial advice.** A flag marks a price gap in the data, not a guaranteed profit.
- Trading fees, withdrawal costs, slippage, partial fills and the 2% buffer are not a full cost model. Check the real book depth (`orderbook_*_depth_top3`) before acting.
- Two markets with similar titles can have **different resolution rules** (source of truth, time zone, exact thresholds, early close). Always read both rules. Matching is heuristic and can be wrong.
- Polymarket may be restricted for trading in some countries. Reading its public APIs works from anywhere, but check your local rules before trading.

### Input

```json
{
    "platforms": ["polymarket", "kalshi"],
    "query": "fed",
    "category": "",
    "minVolume24h": 5000,
    "includeOrderbook": true,
    "findArbitrageMatches": true,
    "maxMarketsPerPlatform": 15
}
```

| Field | Default | Description |
| --- | --- | --- |
| `platforms` | `["polymarket","kalshi"]` | Platforms to read. Unknown names are ignored. |
| `query` | empty | Case-insensitive filter on the market question and event title. |
| `category` | empty | Case-insensitive substring of the Polymarket event tag (label or slug) or the Kalshi event category. |
| `minVolume24h` | 5000 | Skip markets with a lower 24h volume (USD). |
| `includeOrderbook` | true | Fetch live orderbooks for exact bid/ask and depth. Max 5 requests in parallel. |
| `findArbitrageMatches` | true | Match markets across platforms and flag arbitrage. Needs both platforms. |
| `maxMarketsPerPlatform` | 50 | Highest-volume markets kept per platform (1-500). |

Run it with an empty input `{}` to get the top 50 markets of each platform.

### Output

```json
{
    "platform": "polymarket",
    "market_id": "3215008",
    "event_title": "Fed Decision in December?",
    "question": "Will the Fed increase interest rates by 25 bps after the December 2026 meeting?",
    "yes_probability": 0.953,
    "no_probability": 0.047,
    "best_bid": 0.952,
    "best_ask": 0.954,
    "spread": 0.002,
    "orderbook_bid_depth_top3": 269540.64,
    "orderbook_ask_depth_top3": 32352.52,
    "volume_24h": 1973266.29,
    "liquidity": 1246344.17,
    "close_time": "2026-12-09T23:59:00Z",
    "market_url": "https://polymarket.com/event/fed-decision-in-december-20260729232808632",
    "matched_counterpart": {
        "platform": "kalshi",
        "market_id": "KXFED-26DEC-H25",
        "question": "Will the Fed raise rates by 25 bps at the December 2026 meeting?",
        "yes_probability": 0.92,
        "market_url": "https://kalshi.com/markets/kxfed-26dec",
        "match_score": 0.88
    },
    "cross_platform_diff_pp": 3.3,
    "arbitrage_opportunity": false,
    "status": "ok",
    "error_message": null
}
```

The Kalshi side of the example is illustrative. If one platform fails (timeout, HTTP 403 or 5xx after 2 retries), you get a single `error` row for it (`market_id` empty, not charged) and the other platform still returns data. Kalshi blocks some datacenter IP ranges; if your runs show a Kalshi 403, retry later.

### Pricing

Pay per event:

| Event | Price | When |
| --- | --- | --- |
| Run started | $0.02 | Once per run, if at least one market row is returned |
| Market fetched | $0.0015 | Per row with `status: "ok"` |

Examples: 100 markets = $0.17, 1,000 markets = $1.52. Error rows are free.

#### Free plan

On the free Apify plan a run returns at most **10 market rows in total**, split across the selected platforms (highest volume first, alternating). Extra rows are skipped and not charged, and the run log and status message say so. A paid Apify plan unlocks up to 500 markets per platform.

### Examples

Ready-to-run presets with real output:

- [Fed rate decision odds on Polymarket vs Kalshi](https://apify.com/sequined_lacework/polymarket-kalshi-arbitrage/examples/fed-rate-decision-odds-polymarket-kalshi)
- [Politics markets: Polymarket vs Kalshi price gaps](https://apify.com/sequined_lacework/polymarket-kalshi-arbitrage/examples/politics-odds-cross-platform-gaps)

### Use with Claude Desktop / Cursor (MCP)

Connect the Actor to an AI assistant through the Apify MCP server: `https://mcp.apify.com/?actors=sequined_lacework/polymarket-kalshi-arbitrage`

```json
{
    "mcpServers": {
        "polymarket-kalshi-arbitrage": {
            "url": "https://mcp.apify.com/?actors=sequined_lacework/polymarket-kalshi-arbitrage",
            "headers": {
                "Authorization": "Bearer <APIFY_TOKEN>"
            }
        }
    }
}
```

Then ask: "What do Polymarket and Kalshi price for a Fed cut in December, and is there a gap between them?"

### Integrations: n8n and LangChain

**n8n**: add a Schedule Trigger (for example every 15 minutes), then an HTTP Request node (POST) to the synchronous endpoint that returns dataset items:

```
https://api.apify.com/v2/acts/sequined_lacework~polymarket-kalshi-arbitrage/run-sync-get-dataset-items?token=<APIFY_TOKEN>
```

Body (JSON): `{"maxMarketsPerPlatform": 100, "includeOrderbook": true}`. Add an IF or Filter node on `arbitrage_opportunity` equals `true`, then send the `question`, `cross_platform_diff_pp` and both `market_url` values to a Telegram or Slack node. For runs longer than five minutes use the Apify node (Run Actor, then Get Dataset Items).

**LangChain**: load the dataset with `ApifyWrapper`:

```python
from langchain_community.utilities import ApifyWrapper
from langchain_core.documents import Document

apify = ApifyWrapper()
loader = apify.call_actor(
    actor_id="sequined_lacework/polymarket-kalshi-arbitrage",
    run_input={"query": "bitcoin", "maxMarketsPerPlatform": 20},
    dataset_mapping_function=lambda item: Document(
        page_content=f"{item['question']} YES probability: {item['yes_probability']}",
        metadata={"platform": item["platform"], "url": item["market_url"], "volume_24h": item["volume_24h"]},
    ),
)
docs = loader.load()
```

### FAQ

**Does it need a proxy, browser or API key?** No. It calls public read-only endpoints of Polymarket and Kalshi.

**What does `yes_probability` mean?** The mid price between the best bid and ask of the YES contract, a market-implied probability. When there is no two-sided quote it falls back to the last or outcome price.

**Why do some markets have no counterpart?** Many markets exist on only one platform, or the wording, numbers or dates differ. The matcher prefers missing a pair to creating a false one.

**Is an arbitrage flag a sure profit?** No. It only says that YES on one side plus NO on the other costs less than $0.98 at the best prices. Depth, fees, slippage and different resolution rules can erase it.

**Why are multi-outcome and parlay markets missing?** Polymarket markets that are not Yes/No (team vs team, over/under) and Kalshi multi-leg parlay markets are excluded to keep the schema clean.

**Why did a platform return an error row?** The platform timed out, rate limited the request or blocked the IP range. The other platform still returns data, and error rows are free.

### Legal

The Actor reads only public market data over documented read-only APIs. Respect the terms of Polymarket and Kalshi and your local laws on prediction markets and trading. Nothing here is investment advice.

# Actor input Schema

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

Prediction markets to read: polymarket, kalshi or both. Unknown names are ignored.

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

Case-insensitive filter on the market question and event title, for example bitcoin, fed or election. Empty means all markets.

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

Case-insensitive substring of the Polymarket event tag (label or slug) or the Kalshi event category, for example politics, crypto or economics. Empty means all categories.

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

Skip markets with a lower 24h volume. Kalshi volume is contracts x reference price (approximate USD).

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

Fetch the live orderbook per market (Polymarket CLOB, Kalshi orderbook) for exact best bid/ask and top-3 depth. Turn off for a faster run.

## `findArbitrageMatches` (type: `boolean`):

Match equivalent markets across Polymarket and Kalshi and flag arbitrage opportunities. Needs both platforms.

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

Skip sports games and futures (Polymarket events tagged Sports, Kalshi category Sports). They dominate Kalshi volume and rarely have an equivalent market on the other platform.

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

Markets with the highest 24h volume are kept, up to this number per platform.

## Actor input object example

```json
{
  "platforms": [
    "polymarket",
    "kalshi"
  ],
  "query": "",
  "category": "",
  "minVolume24h": 5000,
  "includeOrderbook": true,
  "findArbitrageMatches": true,
  "excludeSports": true,
  "maxMarketsPerPlatform": 15
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset with one item per market: probabilities, bid/ask, orderbook depth, volume, matched counterpart and arbitrage flag.

# 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"
    ],
    "maxMarketsPerPlatform": 15
};

// Run the Actor and wait for it to finish
const run = await client.actor("sequined_lacework/polymarket-kalshi-arbitrage").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",
    ],
    "maxMarketsPerPlatform": 15,
}

# Run the Actor and wait for it to finish
run = client.actor("sequined_lacework/polymarket-kalshi-arbitrage").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"
  ],
  "maxMarketsPerPlatform": 15
}' |
apify call sequined_lacework/polymarket-kalshi-arbitrage --silent --output-dataset

```

## MCP server setup

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

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/CP7D2kCoAv7sCQtoA/builds/0XkpHW2Da7cUaUKIL/openapi.json
