Polymarket Coherence Arb for Openclaw

An algorithmic trading agent skill that detects and exploits logical pricing inconsistencies within related Polymarket markets without relying on external data.

bridgeaisocial
v0.1.0
Jun 10, 2026
0
518
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install polymarket-coherence-arb

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install polymarket-coherence-arb using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Polymarket Coherence Arb?

Polymarket Coherence Arb is a powerful trading algorithm designed to identify pricing anomalies across logically-linked, mutually exclusive Polymarket markets. By analyzing complete, exhaustive market sets (such as FIFA group stage winners) where the aggregate YES prices must theoretically equal 1 (or 100%), the system identifies instances where the markets are either collectively overpriced or underpriced. This skill operates entirely self-contained, requiring no external data feeds, and instead leverages arbitrage opportunities inherent inside Polymarket itself.

As part of the Openclaw Skills ecosystem, this codebase delivers a modular, robust foundation for automated sports and political betting arbitrage. If a confirmed market set's YES prices sum significantly above 1, the skill initiates a trade to buy NO on the richest leg; if they sum below 1, it buys YES on the cheapest leg, trading the legs back toward logical coherence. It acts as an incredibly efficient template for developers looking to scale on-chain predictions.

Polymarket Coherence Arb Use Cases

  • Sports Tournament Arbitrage: Automatically detecting mispriced group stages (such as FIFA 'win Group X' brackets) where the four mutually exclusive outcomes diverge from 100% implied probability.
  • Custom Market-Id Arbitrage: Using the COHERENCE_GROUPS configuration to map custom prediction ladders, political races, or award ceremonies for logical coherence validation.
  • Algorithmic Simulation: Testing execution logic and probability mathematical modeling securely using simulated prediction markets before committing capital.
  • Custom Strategy Expansion: Leveraging the modular discover_sets() structure in Openclaw Skills to design and deploy custom prediction market parsers.

How Polymarket Coherence Arb Works

  1. Market Discovery: The skill scans Polymarket utilizing either built-in text classifiers (e.g., FIFA Group structures) or user-defined explicit IDs via environment variables.
  2. Exclusivity Verification: It confirms mutual exclusivity dynamically from the market text to avoid false positives. Unconfirmed sets are flagged as alerts and never traded.
  3. Probability Calculation: The system sums the raw YES prices of the set. If the difference from 1.0 exceeds the MIN_COHERENCE_GAP, an actionable edge is identified.
  4. Execution Routing: Depending on the edge, the skill determines the cheapest or richest leg and places a single position via the Simmer SDK, falling back to mid-pricing in simulation.
  5. State & Exposure Gate: The execution engine cross-references the trade with strict budget and exposure rules, lock-protecting state modifications via fcntl.flock before initiating transaction calls.

Polymarket Coherence Arb Setup

To get started with this project from Openclaw Skills, set up your workspace and configure your environment variables. Ensure you have your SIMMER_API_KEY ready.

Environment Variables

Ensure the following keys are configured in your environment:

export SIMMER_API_KEY='your_simmer_key'
export TRADING_VENUE='sim' # Set to 'polymarket' for live execution
export MAX_TRADE_USD=20
export DAILY_BUDGET_USD=100
export MIN_COHERENCE_GAP=0.05
# Optional: Specify manual market-id groups separated by semicolons
export COHERENCE_GROUPS='id1,id2,id3,id4; idA,idB,idC'

Run the Agent

Execute the skill in dry-run mode, check active exposure, or execute live trading on Polymarket:

# Run a default dry-run simulation pass
python coherence_arb.py --dry-run

# Inspect current open positions, balances, and exposure
python coherence_arb.py --status

# Execute with real capital after verifying simulation results
python coherence_arb.py --live --venue polymarket

Polymarket Coherence Arb Data Schema & Taxonomy

The system cleanly isolates active state management based on the environment to ensure dry runs never corrupt live production data. Openclaw Skills prioritize safety, isolating states into dedicated schema structures.

State Storage Isolation

Filename Purpose Locking Protocol
state_live.json Stores live production exposure, active trades, and tracking data. fcntl.flock (exclusive lock)
state_dry.json Keeps sandbox and simulated dry-run transaction logs. fcntl.flock (exclusive lock)

Metadata Schema

Every executed order tracks comprehensive context metadata suitable for backtesting pipelines:

  • skill_slug: Identifier for the logic driver (polymarket-coherence-arb).
  • reasoning: A human-readable text string explaining why the market leg was selected (e.g., pricing sum divergence).
  • signal_data: Backtest-ready telemetry captured at the millisecond of execution.

Polymarket Coherence Arb Advanced Features

  • Custom Coherence Mapping: Easily map any arbitrary complex tournament brackets or conditional markets using the COHERENCE_GROUPS layout directly without changing the codebase.
  • Simmer Paper SDK Engine: Unlike simple mocks, dry runs query and interact with live price data against the Simmer paper trading core for highly realistic performance checks.
  • Atomic Lock Safety Rails: Strict file-level thread locking prevents state corruption or race conditions when running multi-agent configurations in parallel within Openclaw Skills.
  • Custom Discovery Hooks: The modular discover_sets() hook in discovery.py offers an extensible entry point for developers to write custom scraping or parsing rules for any niche prediction market.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*