惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Darknet – Hacking Tools, Hacker News & Cyber Security
N
News and Events Feed by Topic
N
News | PayPal Newsroom
SecWiki News
SecWiki News
P
Privacy International News Feed
T
Troy Hunt's Blog
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
L
LINUX DO - 热门话题
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Security Latest
Security Latest
AWS News Blog
AWS News Blog
S
Secure Thoughts
W
WeLiveSecurity
H
Heimdal Security Blog
T
Threat Research - Cisco Blogs
I
Intezer
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security @ Cisco Blogs
G
GRAHAM CLULEY
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Spread Privacy
Spread Privacy
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
Cisco Talos Blog
Cisco Talos Blog
雷峰网
雷峰网
Cloudbric
Cloudbric
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
Latest news
Latest news
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
D
Docker
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
H
Help Net Security
博客园 - 司徒正美
TaoSecurity Blog
TaoSecurity Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Check Point Blog
博客园 - 叶小钗

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I Built a Tool That Finds Mathematical Arbitrage on Polymarket — Here's How It Works
Fatih İlhan · 2026-04-29 · via DEV Community

Prediction markets are supposed to be efficient. They're not.

Here's a trade I found last week: the Lebanon Parliamentary Election had 21 candidate markets on Polymarket. Each one was a binary YES/NO bet on whether that party wins the most seats. Exactly one party will win — so the probabilities must sum to 1.0.

They summed to 0.789.

That means you could buy one share of YES on every single candidate for $0.789 total, and guaranteed receive $1.00 when the election resolves. No forecasting required. No opinion on Lebanese politics needed. Pure arithmetic.

After fees, that's a 22.7% locked return.

I built a tool that finds these automatically. Here's how.


The Math

For any event where exactly one outcome can resolve YES — an election winner, a championship, an award — the following must hold under perfect pricing:

Σ P(outcome_i = YES) = 1.0

Enter fullscreen mode Exit fullscreen mode

When the sum falls below 1.0, you buy all YES positions:

Cost    = Σ YES prices       (e.g. 0.789)
Payout  = $1.00              (guaranteed — exactly one resolves YES)
Gross   = (1.0 - Σ YES) / Σ YES
        = (1.0 - 0.789) / 0.789
        = 26.7%

Enter fullscreen mode Exit fullscreen mode

Subtract fees (Polymarket charges ~2% per fill, so ~4% round-trip):

Net return = 26.7% - 4.0% = 22.7%

Enter fullscreen mode Exit fullscreen mode

It also works in reverse. When Σ YES > 1.0, you buy NO on every outcome:

Cost    = N - Σ YES          (sum of NO prices)
Payout  = N - 1              (every NO resolves YES except one)
Gross   = (Σ YES - 1.0) / (N - Σ YES)

Enter fullscreen mode Exit fullscreen mode

The Eurovision 2026 Top 5 is a live example of this: 35 countries, Σ YES = 9.58 when it should equal 5.0. Buying NO on every country pays out 30 countries × $1 = $30, costing $25.42 — a 14% net return.


Why These Mispricings Exist

Three reasons:

1. Market fragmentation. Each candidate is a separate binary market. Market makers price each one independently. Small errors compound across 20+ markets and the aggregated sum drifts from 1.0 without anyone noticing.

2. Thin liquidity. Many of these markets have $5K–$50K of liquidity per leg, not millions. Arbitrageurs with serious capital move on, and the mispricing persists for smaller traders.

3. Unlisted-candidate risk. For winner-take-all events, part of the Σ YES shortfall is rational: traders implicitly price in "someone not listed here wins." That's real risk, not pure arb. The tool flags this in the output so you can judge it yourself.


What the Tool Does

Polymarket Multi-Outcome Arbitrage Scanner is an Apify Actor (a cloud-hosted script) that:

  1. Fetches every open Polymarket event via the Gamma API
  2. Classifies each event's structure — winner-take-all (Σ = 1.0), top-K (Σ = K), or neither
  3. Filters out events that look like arb but aren't: cumulative "by date" events, price ladders, independent prop bets
  4. Computes fee-adjusted basket returns for qualifying events
  5. Walks the CLOB order book for each leg and verifies fillability at your target position size
  6. Scores each opportunity 0–100 and returns structured JSON

The classifier step is the most important. Without it, the tool surfaces thousands of false positives — events like "Will Solana reach $110 / $100 / dip to $70 this month?" look like massive arb (Σ YES ≈ 0.05 → 1900% return) but the outcomes are independent, not mutually exclusive. All three can resolve YES.


The Classifier

Three structures pass the filter:

WINNER_TAKE_ALL — exactly one outcome resolves YES. Detected by keywords: nominee, nomination, winner, wins the [year], championship, next president/CEO/Pope.

TOP_K — exactly K outcomes resolve YES. Detected by: Top N in the title, or reach the final / advance to final (K=2 implied by a two-slot final).

Everything else is rejected. The rejection list is explicit:

  • by [month] in labels → cumulative nested structure
  • / arrows in labels → price ladder
  • O/U in questions → independent prop bets
  • What X will Y / Which X will → multi-condition, can co-resolve

Conservative by design. It's better to miss a few valid signals than to ship noise dressed as alpha.


Sample Output

{
  "id": "alaska-governor-election-winner-buy_yes_basket",
  "event_title": "Alaska Governor Election Winner",
  "event_url": "https://polymarket.com/event/alaska-governor-election-winner",
  "resolution_date": "2026-11-03",
  "event_type": "winner_take_all",
  "expected_sum_yes": 1.0,
  "arb_type": "buy_yes_basket",
  "leg_count": 9,
  "sum_yes_price": 0.9015,
  "deviation_from_one": -0.0985,
  "fees_pct": 4.0,
  "gross_return_pct": 10.93,
  "net_return_pct": 6.93,
  "legs": [
    {
      "outcome_label": "Tom Begich",
      "side": "YES",
      "price": 0.375,
      "liquidity_usd": 24661,
      "fillable": true
    },
    {
      "outcome_label": "Bernadette Wilson",
      "side": "YES",
      "price": 0.235,
      "liquidity_usd": 14765,
      "fillable": true
    }
  ],
  "liquidity": {
    "tested_usd_per_leg": 100,
    "all_legs_fillable": true,
    "fillable_leg_count": 9,
    "total_leg_count": 9
  },
  "signal_score": 81,
  "signal_label": "Pure arbitrage"
}

Enter fullscreen mode Exit fullscreen mode

9 candidates, all fillable at $100/leg, 6.9% net return locked in until election day November 2026.


Technical Stack

The whole thing is ~600 lines of Python 3.11:

pm-arbitrage/
├── src/
│   ├── core/
│   │   ├── scanner.py          # orchestrates the pipeline
│   │   ├── event_classifier.py # rejects non-exclusive structures
│   │   ├── scorer.py           # 0-100 signal scoring
│   │   └── models.py           # Pydantic v2 output schema
│   └── venues/
│       └── polymarket.py       # Gamma + CLOB API adapter

Enter fullscreen mode Exit fullscreen mode

Key technical decisions:

Async-first, bounded concurrency. The CLOB order book probe fans out to all legs simultaneously but through an asyncio.Semaphore(20) to avoid OOMing the 512MB Apify container. Early version hit OOM at 352 eligible events × 10 legs each = 3500 concurrent HTTP connections.

Conservative classifier, not a blocklist. Rejecting bad structures is whitelisting-only — events must positively match a good pattern. Default is NOT_ARB. This means some edge cases get rejected, but the output is clean.

Szymkiewicz–Simpson overlap for entity matching. (In an earlier cross-venue matching phase, since scrapped.) Jaccard penalizes asymmetric sets; S-S handles the case where one side has more "noise" tokens than the other. Relevant if you extend this to cross-venue matching later.


Results From a Live Run

From a scan on April 29, 2026 with default settings (1000 events, top-K and WTA only, min $5K event liquidity):

Event Type Net Return Legs
Lebanon Parliamentary Election winner_take_all 22.7% 21
Guinea-Bissau Assembly Election winner_take_all 11.7% 4
Alaska Governor Election winner_take_all 6.9% 9
MLS Cup Winner 2026 winner_take_all 7.8% 25
Serie A Top 4 Finish top_k (K=4) 81.1% 5
EPL Top 4 Finish top_k (K=4) 28.2% 10
Eurovision 2026 Top 5 top_k (K=5) 14.0% 35
2026 Fields Medal winner_take_all 47.3% 7

Note: the Serie A 81% return reflects the scanner computing against the expected Σ=4 baseline — it's real but assumes the 5 listed teams are the only realistic top-4 candidates. Judge accordingly.


Limitations and Honest Caveats

Implicit "Other" probability. For winner-take-all events with many candidates, Polymarket may not list every plausible winner. The probability shortfall partially reflects unlisted-candidate risk, not pure arb. Top-K events (EPL Top 4, Eurovision Top 5) are cleaner — the outcome space is rigorously closed.

Execution risk. Prices move between scan and fill. Large baskets with 20+ legs require many simultaneous fills; by the time you've filled legs 1–15, legs 16–20 may have moved. The tool tests fillability at $100/leg which is conservative — if you're sizing at $1000/leg, retest.

Liquidity depth. The CLOB test is at liquidity_test_amount_usd (default $100/leg). Higher position sizes will face more slippage. The fillable flag is binary at the test size, not a continuous depth curve.

This is not financial advice. It's an arithmetic signal engine. Trade your own book.


Try It

The actor is live on Apify:

👉 https://apify.com/seralifatih/pm-arbitrage

Run it with these settings to start:

{
  "min_net_return_pct": 0,
  "min_signal_score": 60,
  "min_event_liquidity_usd": 10000,
  "liquidity_test_amount_usd": 100,
  "max_days_to_resolution": 365,
  "max_events_to_scan": 1000,
  "output_limit": 25
}

Enter fullscreen mode Exit fullscreen mode

min_net_return_pct: 0 filters to pure arbitrage only — positions where you profit even after fees regardless of outcome. min_signal_score: 60 cuts marginal low-liquidity results.

Source code: github.com/seralifatih/pm-arbitrage


What's Next

The obvious extension is adding more venues. Kalshi has the same multi-outcome structure on US elections and sports. Cross-venue arb (same event, different prices on Polymarket vs Kalshi) is the gold standard but requires a much better title-matching system than raw string similarity — I built one using entity extraction + Szymkiewicz-Simpson and it still struggles on the short, diverse titles both venues use.

The more tractable extension is real-time alerting — running the scanner on a 5-minute schedule and pushing Telegram/Discord notifications only when new high-score opportunities appear. If you want to build on top of this via the Apify API, all the pieces are there.


Questions? Leave a comment.