# Prediction Markets (`pintostudio/prediction-markets`) Actor

Live prediction market data from Polymarket, Kalshi and Manifold in one clean JSON format: odds, order books, OHLC price history, cross-venue arbitrage, dutch-book scanner, consensus fair value and Kelly stake sizing. Export to JSON, CSV or Excel, or call it by API.

- **URL**: https://apify.com/pintostudio/prediction-markets.md
- **Developed by:** [Pinto Studio](https://apify.com/pintostudio) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 standard calls

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

## Prediction Markets API: Polymarket, Kalshi and Manifold Odds, Arbitrage and Kelly Sizing

> ⚡ **Need help or a custom feature? Telegram [@pintoflow](https://t.me/pintoflow) for the fastest reply.**

Get **live prediction market data from Polymarket, Kalshi and Manifold in one normalized JSON format**. Pull markets, odds, order books and OHLC price history. Scan for **cross-venue arbitrage** and **dutch-book mispricings**. Build a **volume-weighted consensus fair value** and size your stake with the **Kelly criterion**. Every run is computed live at request time.

Run it from the Apify Console, call it as an API, schedule it, or plug it into Make, Zapier, n8n, Google Sheets or your own code. Results export as **JSON, CSV, Excel or XML**.

### What can it do?

| Operation | What you get | Main inputs |
|---|---|---|
| `markets` | Normalized market list with title, status, volume, liquidity, bid, ask and outcome odds | `venue`, `q`, `limit` |
| `market` | One market in full | `venue`, `id` |
| `orderbook` | Live bids and asks (Manifold returns the AMM probability and pool) | `venue`, `id` |
| `odds` | Outcomes in probability, decimal and American odds | `venue`, `id` |
| `oddsCompare` | One topic compared side by side across every venue | `q` |
| `history` | OHLC candles as probabilities from 0 to 1, plus volume | `venue`, `id`, `interval`, `lookback`, `outcome` |
| `search` | Free-text search merged across the three venues | `q`, `venue`, `limit` |
| `arbitrage` | Same question priced differently on two venues, with the guaranteed edge and optional Kalshi fee modeling | `q`, `minEdge`, `feeAware`, `limit` |
| `arbitrageEvent` | Dutch-book check for one multi-outcome event on one venue | `venue`, `eventId`, `feeAware` |
| `arbitrageEvents` | The same check across every event found by a search | `q`, `venue`, `minEdge`, `feeAware` |
| `consensus` | Volume-weighted fair value plus a venue disagreement score | `q`, `minSimilarity` |
| `kelly` | Kelly stake from your probability estimate and the market price | `probability`, `price`, `bankroll`, `fraction` |
| `venues` / `health` | Supported venues and a liveness check | none |

Use `venue` values `polymarket`, `kalshi` or `manifold`. For operations that compare venues you can pass two or more, comma-separated.

### Quick start

Choose an **operation**, fill only the fields it needs, and click **Start**.

```json
{ "operation": "markets", "venue": "polymarket", "q": "bitcoin", "limit": 10 }
```

More examples:

```json
{ "operation": "consensus", "q": "fed rate cut october" }
{ "operation": "arbitrage", "q": "bitcoin", "minEdge": 0.02, "feeAware": true, "limit": 20 }
{ "operation": "history", "venue": "kalshi", "id": "KXHIGHNY-26OCT27-T67", "interval": "1d", "lookback": "30d" }
{ "operation": "kelly", "probability": 0.6, "price": 0.45, "bankroll": 500, "fraction": 0.5 }
```

### Call it from the API

```bash
curl -X POST "https://api.apify.com/v2/acts/pintostudio~prediction-markets/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "operation": "consensus", "q": "fed rate cut october" }'
```

### Output

Every run returns one JSON object. It is saved in the dataset and also in the key-value store as `OUTPUT`.

```json
{
  "error": false,
  "data": { "...": "operation specific result" },
  "message": "OK"
}
```

If something goes wrong, `error` is `true`, `data` is `null` and `message` explains why.

### Who is it for?

- **Traders and quants:** compare lines across exchanges, find arbitrage and dutch books, backtest on OHLC history.
- **Bot and app builders:** one schema for three venues, ideal for Telegram bots, dashboards and alerts.
- **Journalists and researchers:** cite what the market thinks about elections, rates, crypto and sports with a consensus number.
- **Data teams:** schedule runs and push results to Sheets, a database or a webhook.

### FAQ

**Is this an official Polymarket, Kalshi or Manifold product?**
No. It is an independent tool that aggregates and normalizes public market data. It is not affiliated with or endorsed by any of them.

**Do I need accounts or API keys for the venues?**
No.

**Is the data real time?**
Yes. Each run is computed live. Nothing is cached beyond a single run.

**Can it place trades?**
No. It is read-only data and analytics. Trade on the venues themselves.

**Is this financial advice?**
No. Arbitrage, consensus and Kelly outputs are informational. Always verify live prices and liquidity before trading.

**Do you also offer a plain REST API?**
Yes, see the [Prediction Markets API on RapidAPI](https://rapidapi.com/belchiorarkad-FqvHs2EDOtP/api/prediction-markets) and the open source examples on [GitHub](https://github.com/BelNaruto/prediction-markets-api).

### Support

⚡ **Questions, bugs or feature requests? Telegram [@pintoflow](https://t.me/pintoflow) for the fastest reply.**

# Actor input Schema

## `operation` (type: `string`):

Which thing to do. Each operation uses a different subset of the fields below.

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

polymarket | kalshi | manifold. Comma-separate two or more for operations that compare venues (arbitrage, arbitrageEvents, consensus), e.g. "polymarket,kalshi". Leave empty to use all three where that's allowed.

## `id` (type: `string`):

The venue's own market identifier: Polymarket numeric id or slug, Kalshi ticker, Manifold id or slug. Used by: market, orderbook, odds, history, kelly.

## `eventId` (type: `string`):

The venue's event identifier (Polymarket numeric id/slug, Kalshi event_ticker) - a group of mutually-exclusive candidate markets. Used by: arbitrageEvent.

## `q` (type: `string`):

Free-text search term, e.g. "fed rate cut". Used by: markets, oddsCompare, search, arbitrage, arbitrageEvents, consensus. Strongly recommended on arbitrage/consensus/arbitrageEvents - scopes the scan and makes matches far more accurate.

## `outcome` (type: `string`):

Which outcome to use: "Yes" or "No" (Polymarket also accepts custom outcome names). Used by: orderbook, history, kelly.

## `interval` (type: `string`):

OHLC candle width. Used by: history.

## `lookback` (type: `string`):

How far back to fetch history. Used by: history.

## `limit` (type: `integer`):

Max results to return. Used by: markets, search, arbitrage, arbitrageEvents.

## `perVenueLimit` (type: `integer`):

How many markets per venue to scan before matching (higher = more thorough, slower). Used by: arbitrage. Leave empty for a sensible default.

## `minEdge` (type: `number`):

Minimum profit edge to report, as a decimal fraction of $1 (e.g. 0.02 = 2%). Used by: arbitrage, arbitrageEvents.

## `minSimilarity` (type: `number`):

How strictly two venues' market titles must match to be treated as the same question, 0-1 (higher = stricter). Used by: arbitrage, consensus.

## `feeAware` (type: `boolean`):

Subtract Kalshi's real public trading fee from the reported edge/cost. Used by: arbitrage, arbitrageEvent, arbitrageEvents.

## `probability` (type: `number`):

YOUR OWN estimate that the outcome happens, 0-1 exclusive (e.g. 0.6). Used by: kelly.

## `price` (type: `number`):

The market's price for the outcome, 0-1 (cost of a $1 Yes contract). Pass this OR venue+id. Used by: kelly.

## `bankroll` (type: `number`):

Your stake budget, any currency unit. Used by: kelly.

## `fraction` (type: `number`):

1 = full Kelly, 0.5 = half Kelly, 0.25 = quarter Kelly (lower variance, usually recommended). Used by: kelly.

## Actor input object example

```json
{
  "operation": "markets",
  "outcome": "Yes",
  "interval": "1h",
  "lookback": "7d",
  "limit": 20,
  "minSimilarity": 0.55,
  "feeAware": false,
  "bankroll": 100,
  "fraction": 1
}
```

# Actor output Schema

## `result` (type: `string`):

No description

## `output` (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 = {
    "operation": "markets",
    "venue": "",
    "id": "",
    "eventId": "",
    "q": "",
    "outcome": "Yes",
    "interval": "1h",
    "lookback": "7d",
    "limit": 20,
    "minEdge": 0,
    "minSimilarity": 0.55,
    "bankroll": 100,
    "fraction": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("pintostudio/prediction-markets").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 = {
    "operation": "markets",
    "venue": "",
    "id": "",
    "eventId": "",
    "q": "",
    "outcome": "Yes",
    "interval": "1h",
    "lookback": "7d",
    "limit": 20,
    "minEdge": 0,
    "minSimilarity": 0.55,
    "bankroll": 100,
    "fraction": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("pintostudio/prediction-markets").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 '{
  "operation": "markets",
  "venue": "",
  "id": "",
  "eventId": "",
  "q": "",
  "outcome": "Yes",
  "interval": "1h",
  "lookback": "7d",
  "limit": 20,
  "minEdge": 0,
  "minSimilarity": 0.55,
  "bankroll": 100,
  "fraction": 1
}' |
apify call pintostudio/prediction-markets --silent --output-dataset

```

## MCP server setup

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

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/xVnoapGCcfYTMhH4v/builds/mjUykJcrqhGmXyaci/openapi.json
