# Prediction Market Odds — Kalshi & Polymarket (`lizaraco/prediction-market-data`) Actor

Live odds, market catalogs, and historical candles from the two big US prediction markets, via their official APIs. Unified schema, agent/RAG-friendly.

- **URL**: https://apify.com/lizaraco/prediction-market-data.md
- **Developed by:** [Shawn Downs](https://apify.com/lizaraco) (community)
- **Categories:** AI, Automation, Agents
- **Stats:** 3 total users, 1 monthly users, 97.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 market snapshots

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Prediction Market Odds — Kalshi & Polymarket

Live odds, market catalogs, and historical candles from the two big US prediction
markets — via their **official public APIs** (no scraping, no login). One unified schema
across venues, built for analysts, dashboards, and **AI agents** (MCP/x402-friendly:
call it, pay per event, get clean JSON).

Unofficial tool; not affiliated with Kalshi or Polymarket. Data only — no order placement,
not investment advice.

### Get all open prediction markets (catalog)

`mode: "catalog"` lists open markets from Kalshi and/or Polymarket with prices, bid/ask,
24h volume, open interest, liquidity, category, and close time. Filter by `category`
(e.g. Economics, Politics, Climate, Crypto), free-text `search`, and venue. Sports event
contracts are excluded by default (`includeSports: false`).

### Get current odds for specific markets (snapshot)

`mode: "snapshot"` with `kalshiTickers` (e.g. `KXCPIYOY-26JUL-T2.9`) and/or
`polymarketSlugs` (from the market URL) returns the current yes/no prices, bid/ask,
spread, volume, and open interest for exactly the markets you track. Ideal for scheduled
runs, alerting pipelines, and agent polling.

### Get historical prices for a Kalshi market (candles)

`mode: "candles"` with `kalshiTickers`, `candlePeriod` (`1m`/`1h`/`1d`), and `candleDays`
returns OHLC **plus bid/ask closes, volume, and open interest** per bar — spread-aware
history suitable for research and backtesting.

### Output schema

Every row: `venue, id, title, category, yes_price, no_price, yes_bid, yes_ask, spread,
volume_24h, open_interest, liquidity, close_time, status, url, fetched_at`. Candle rows:
`ts, open, high, low, close, yes_bid_close, yes_ask_close, volume, open_interest, period`.

### Why this actor

- Official APIs only → stable, fast, cheap (no browser, no proxies).
- Both venues in one schema — no field-mapping glue on your side.
- Sports contracts filtered out by default.
- Failed lookups come back as error rows (`{id, error}`) — your run still succeeds.

### Use with AI agents

Works out of the box through the Apify MCP server: an agent can fetch the catalog, watch
specific markets, or pull history and reason over clean JSON. Pay-per-event pricing means
an agent pays cents for exactly what it uses.

# Actor input Schema

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

What to fetch.

## `venue` (type: `string`):

Which market(s) to query. Candles mode is Kalshi-only for now.

## `search` (type: `string`):

Case-insensitive text filter on market/event titles (catalog mode).

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

e.g. Economics, Politics, Climate, Financials, Crypto (catalog mode).

## `kalshiTickers` (type: `array`):

Kalshi market tickers for snapshot/candles mode, e.g. KXCPIYOY-26JUL-T2.9.

## `polymarketSlugs` (type: `array`):

Polymarket market slugs (from the market URL) for snapshot mode.

## `candlePeriod` (type: `string`):

Candles mode: bar size.

## `candleDays` (type: `integer`):

Candles mode: how many days back from now.

## `maxMarkets` (type: `integer`):

Cap on returned markets (catalog mode).

## `includeSports` (type: `boolean`):

Sports event contracts are excluded by default.

## Actor input object example

```json
{
  "mode": "catalog",
  "venue": "both",
  "candlePeriod": "1d",
  "candleDays": 30,
  "maxMarkets": 200,
  "includeSports": false
}
```

# 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("lizaraco/prediction-market-data").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("lizaraco/prediction-market-data").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 lizaraco/prediction-market-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lizaraco/prediction-market-data",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/uo7DDcac1Zslv6Mvg/builds/cDdTHCAmodgCJB3Kz/openapi.json
