# Polymarket Multi-Outcome Arbitrage Scanner (`yzy001/polymarket-edge-scanner`) Actor

Finds Polymarket multi-outcome events where buying one share of every outcome costs less than the $1 it pays. Walks the live order books for the size you could fill, with profit, edge, lock-up days and each leg's best ask so you can check the maths.

- **URL**: https://apify.com/yzy001/polymarket-edge-scanner.md
- **Developed by:** [宗諭 楊](https://apify.com/yzy001) (community)
- **Categories:** Developer tools, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 arbitrage opportunities

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 Multi-Outcome Arbitrage Scanner

Finds Polymarket multi-outcome events where buying one share of every outcome costs less than the $1 the set pays out, after Polymarket's trading fees, at the size the live order books can actually fill.

### How the gap works

A multi-outcome Polymarket event (for example "who wins the election") has several outcomes, and exactly one of them resolves to Yes. One share of every outcome therefore pays exactly $1 in total, whichever one wins. If buying one share of each costs less than $1, fees included, the difference is locked in until the event resolves.

### What you get for every gap

- `sharesPerOutcome`: how many shares of each outcome the books can fill while one more set still costs under $1 including fees
- `capitalUsd`: the money you would put in, fees included
- `feesUsd`, `grossProfitUsd`, `profitUsd`: Polymarket's taker fees at that size, the profit before fees, and the profit after fees
- `edgePct`: profit after fees divided by capital
- `daysToResolution` and `annualizedPct`: how long your money is locked, and the simple annualised return. A 1% gap that closes in a year is not the same as a 1% gap that closes next week
- `topAskSum` and `topAskSumWithFees`: the sum of every outcome's best ask, before and after fees
- `minOrderSize`: the smallest order the books accept
- `legs`: every outcome with its best ask, the size at that price, the quoted price from the event list, its fee rate and exponent, the average price you would pay, and its fee. With these you can check the figures yourself
- `warnings`: anything that weakens the gap, such as an outcome named like "Other" or a missing end date
- `outcomesCanBeAdded`: true only when you turned on `includeAugmented` and this event can still add outcomes. Such a row always carries a warning: if an outcome that is not listed yet wins, every share bought pays nothing

Fees follow Polymarket's own formula from its official trading client: fee = shares × rate × (price × (1 − price))^exponent, with the rate and exponent read for each market from Polymarket's order-book service in the same run. Markets without a fee schedule are charged nothing, and `feeInfoPresent` says so for each leg. If a market's fee schedule cannot be read, that event is not reported; an unknown fee is never treated as zero.

### How it scans

1. It reads open events, the most traded in the last 24 hours first, and keeps the multi-outcome ones.
2. It screens them on each event's quoted best prices.
3. It checks the tightest ones, up to the number you set, against the full order books and fee schedules, two requests per outcome.

The run summary lists how many events were read and skipped and why, and how many were checked. A run that finds no gap is a normal result; the free `NEAR_MISS` rows show how near the market came.

### What is skipped, and why

- **Events past their end date.** An event that should have ended but is still open usually has a resolution problem: an annulled election, a delayed result, a dispute. Prices there can add up to well under $1 because the market expects that none of the listed outcomes will win, so it is not a locked-in gap. These are skipped and counted.
- **Events that can add outcomes later or hold placeholder names.** If a new outcome is added and wins, the set you bought pays nothing. These are skipped unless you turn on `includeAugmented`.
- **Gaps smaller than the minimum order size.** If the books can only fill fewer shares than the smallest accepted order, the gap is listed as a near miss with the reason.

### What the numbers still leave out

- **Moving the price.** Placing several orders one after another can move the prices. The depth shown is what the books held at the moment each was read.
- **Time.** Order books change while the run happens. A gap seen here can be gone when you act.
- **Lock-up.** Your money is tied up until the event resolves.
- **Gas, deposits and conversion.** Only Polymarket's trading fee is counted.
- **Resolution risk.** The gap is only locked in if exactly one listed outcome resolves Yes.

This is a calculation on public order-book data, not a recommendation to trade.

### Input

| Field | What it does |
|---|---|
| `minEdgePct` | Minimum profit after fees divided by capital, in percent. Default 0.5 |
| `minProfitUsd` | Minimum profit after fees in dollars at the fillable size. Default 1 |
| `maxEvents` | How many open events to read, most traded first, 100 per request, up to 1,000. Default 500 |
| `maxVerify` | How many of the tightest events to check against order books. Default 40 |
| `screenSlack` | Events whose quoted prices add up to under 1 plus this are still checked, since quotes can be slightly stale. Default 0.03 |
| `includeAugmented` | Include events that can add outcomes or hold placeholders. Default off |

### Output

Two kinds of dataset rows:

- `ARBITRAGE`: a gap that survives fees, the minimum order size and your thresholds, sorted by `edgePct`. **Only these rows are charged.**
- `NEAR_MISS`: every other event that was checked against the order books, closest first, with `reason` saying why it is not a gap: `NO_GAP_AFTER_FEES`, `BELOW_MIN_ORDER_SIZE` or `BELOW_YOUR_MINIMUM`, plus the same legs and sums so you can check it. These rows are free. They are there so that a run that finds nothing still shows how close the market came.

The run summary, including counts, the closest misses and the caveats, is stored under the key `SUMMARY` in the key-value store.

Fields that cannot be known are empty rather than zero: a missing end date gives an empty `annualizedPct`.

### If something goes wrong

If Polymarket answers with a shape this Actor does not recognise, an order book holds an impossible price, or a fee schedule is unreadable, the run fails and names the problem. It does not guess. If many order-book or fee requests fail, the run fails instead of reporting from the few that worked.

### Data and fair use

The Actor reads public, read-only Polymarket endpoints with a descriptive User-Agent. It does not log in, trade, hold keys or work around any blocking, and it paces its requests.

# Actor input Schema

## `minEdgePct` (type: `number`):

Only report a gap whose profit after Polymarket's trading fees, divided by the money you would put in (fees included), is at least this percentage.

## `minProfitUsd` (type: `number`):

Only report a gap worth at least this many dollars after fees, at the size the order books can actually fill.

## `maxEvents` (type: `integer`):

How many open events to read, most traded in the last 24 hours first, 100 per request. Polymarket's event list cannot be paged much past 1,000.

## `maxVerify` (type: `integer`):

The event list is screened first using its quoted best prices; only the tightest events up to this number are checked against the full order books, one request per outcome.

## `screenSlack` (type: `number`):

The quoted prices in the event list can be slightly stale, so events whose quoted prices add up to less than 1 plus this amount are still checked against the order books.

## `includeAugmented` (type: `boolean`):

Some multi-outcome events can add outcomes later or hold placeholder names, so the outcomes may not cover every possible result. They are skipped by default because a gap there can be a trap.

## Actor input object example

```json
{
  "minEdgePct": 0.5,
  "minProfitUsd": 1,
  "maxEvents": 500,
  "maxVerify": 40,
  "screenSlack": 0.03,
  "includeAugmented": false
}
```

# Actor output Schema

## `items` (type: `string`):

Arbitrage gaps with the size the order books can fill, the capital needed, the gross profit and the days until the event ends, or wallet statistics.

## `summary` (type: `string`):

How many events were screened and checked, how many qualified, the closest misses, and what the figures leave out.

# 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 = {
    "minEdgePct": 0.5,
    "minProfitUsd": 1,
    "maxEvents": 500,
    "maxVerify": 40,
    "screenSlack": 0.03
};

// Run the Actor and wait for it to finish
const run = await client.actor("yzy001/polymarket-edge-scanner").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 = {
    "minEdgePct": 0.5,
    "minProfitUsd": 1,
    "maxEvents": 500,
    "maxVerify": 40,
    "screenSlack": 0.03,
}

# Run the Actor and wait for it to finish
run = client.actor("yzy001/polymarket-edge-scanner").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 '{
  "minEdgePct": 0.5,
  "minProfitUsd": 1,
  "maxEvents": 500,
  "maxVerify": 40,
  "screenSlack": 0.03
}' |
apify call yzy001/polymarket-edge-scanner --silent --output-dataset

```

## MCP server setup

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

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/IbJxuEvQHWaWbMJSD/builds/o7aDMcrchs1XmOZqe/openapi.json
