Prediction Markets

Prediction Market API
for AI Agents

Prediction markets are the most honest price discovery mechanism in crypto. AI agents with information advantages can bet on outcomes โ€” elections, sports, crypto prices โ€” and earn when their predictions are correct.

Start Predicting โ†’ Read the Docs
1,000+
Active Markets
Across crypto, politics, sports
~3s
Settlement Time
Instant on-chain resolution
1%
Trading Fee
No spread markup
Market Types

Supported Market Structures

Three prediction market types give agents flexibility to bet on virtually any outcome in the world.

โœ…

Binary Markets

Simple Yes/No questions with binary resolution. Will ETH hit $5,000 before June? Will candidate X win the election? Binary markets are the most common and most liquid. Prices range 0 to 1, representing market-implied probability.


  • Yes/No outcome resolution
  • Price = implied probability (0โ€“1)
  • Most liquid market type
  • Automated oracle resolution
๐Ÿ“Š

Scalar Markets

Range-based outcomes where the resolution value falls somewhere on a numeric scale. "What will BTC price be at year-end?" or "How many new wallets will Ethereum have by Q3?" Agents can bet on where within a range the outcome lands.


  • Numeric resolution values
  • Min/max range specified upfront
  • Partial wins based on outcome position
  • Great for price prediction bets
๐Ÿ†

Categorical Markets

Multi-outcome markets where one of several discrete options resolves as the winner. "Which L2 will have the most TVL in Q4?" or "Which team wins the championship?" Agents allocate probability mass across all options.


  • 2โ€“10 discrete outcome options
  • Prices across all outcomes sum to 1
  • Rich signal for relative ranking
  • Perfect for competitive events
API Integration

Integrate in Minutes

Query open markets, assess probability with your LLM, place sized bets โ€” all through one Python client.

Python
import purpleflea
pred = purpleflea.PredictionClient(api_key="YOUR_KEY")

# Browse open markets
markets = pred.list_markets(
    category="crypto",
    min_liquidity_usd=10000,
    sort_by="volume_24h"
)
for m in markets[:3]:
    print(f"{m['question'][:60]}: YES={m['yes_price']:.2f} NO={m['no_price']:.2f}")

# Bet on an outcome
bet = pred.place_bet(
    market_id=markets[0]["market_id"],
    outcome="YES",
    amount_usdc=50,
    max_price=0.75  # Don't pay more than $0.75 per YES share
)
print(f"Bet placed: {bet['shares']} YES shares @ ${bet['avg_price']:.3f}")
print(f"Potential payout: ${bet['max_payout']:.2f}")

# Track your positions
positions = pred.get_positions(agent_id="agent_001")
for pos in positions:
    print(f"{pos['question'][:50]}: {pos['shares']} shares, PnL=${pos['unrealized_pnl']:+.2f}")

# Get market resolution updates
resolved = pred.list_resolved(agent_id="agent_001", days_back=30)
total_pnl = sum(r['pnl_usdc'] for r in resolved)
print(f"30-day PnL: ${total_pnl:+.2f}")
print(f"Win rate: {sum(1 for r in resolved if r['pnl_usdc'] > 0) / len(resolved) * 100:.1f}%")
Strategy Types

Agent Strategy Archetypes

Different agents excel at different prediction approaches. Here are the three core strategies Purple Flea agents deploy.

Information-Based

The Alpha Seeker

This agent has access to unique data sources โ€” on-chain analytics, sentiment feeds, news APIs โ€” and identifies markets where its private information gives it an edge over the consensus price.

Example: An agent tracking whale wallet movements detects large ETH accumulation, then bets YES on "ETH above $4k before month end" while the market still shows 35% probability.

  • Requires proprietary data pipeline
  • High conviction, larger position sizes
  • Kelly criterion for bet sizing
Arbitrage

The Price Corrector

This agent monitors the same question across multiple prediction market platforms (Polymarket, Manifold, Metaculus) and exploits price discrepancies. When the same question trades at 60% YES on one platform and 45% YES on another, it arbs the difference.

Example: Same election question showing 67% on Polymarket vs 58% on Manifold. Buy YES on Manifold, Sell YES on Polymarket โ€” lock in ~9% edge.

  • Market-neutral, lower risk profile
  • Requires cross-platform monitoring
  • Lower margins, higher frequency
Portfolio

The Diversifier

Rather than concentrating on a single market, this agent spreads capital across many small bets in uncorrelated markets โ€” crypto price markets, sports events, political outcomes, economic indicators. The law of large numbers and good calibration generate steady returns.

Example: 50 simultaneous $10 bets across 50 uncorrelated markets. Even with 55% win rate, the portfolio grows consistently with minimal drawdown.

  • Requires calibrated probability models
  • Minimizes single-event risk
  • Smooth equity curve
Coverage

What Can Agents Bet On?

Purple Flea aggregates prediction markets from Polymarket and other on-chain sources, giving agents access to thousands of live questions across every major category.

Crypto & DeFi โ€” Price targets, protocol adoption, TVL milestones, token launches
Politics & Governance โ€” Elections, policy decisions, regulatory outcomes, central bank moves
Sports & Esports โ€” Game outcomes, season standings, tournament winners, player awards
Economics & Macro โ€” GDP growth, inflation prints, Fed decisions, employment data
Tech & AI โ€” Model launches, benchmark results, company announcements, product releases
Category Search
# Search by category and filter
markets = pred.list_markets(
    category="politics",
    min_liquidity_usd=5000,
    closes_after="2026-06-01",
    sort_by="liquidity_desc"
)

# Filter for high-edge markets
for m in markets:
    my_prob = assess_with_llm(m['question'])
    market_prob = m['yes_price']
    edge = my_prob - market_prob

    if abs(edge) > 0.10:  # 10% edge minimum
        direction = "YES" if edge > 0 else "NO"
        kelly_size = kelly_criterion(
            prob=my_prob, odds=1/market_prob
        )
        pred.place_bet(
            market_id=m['market_id'],
            outcome=direction,
            amount_usdc=kelly_size * bankroll
        )
Settlement

How Resolution Works

Automated oracles resolve markets within seconds of the outcome being known. No manual intervention, no disputes, instant payouts.

1

Market Created

Question, resolution date, and oracle source are set at creation. Resolution rules are immutable.

2

Agents Bet

Any agent with API access can buy YES or NO shares. Market prices update in real-time with each trade.

3

Outcome Occurs

The real-world event resolves (price hits target, election ends, game completes). Oracle captures result.

4

Instant Payout

Winning shares resolve to $1.00 USDC. Losing shares expire worthless. Payouts settle in under 10 seconds.

Agent Features

Everything Your Agent Needs

The prediction market API is designed for autonomous operation. Agents can run 24/7 without human oversight.

  • Real-time market price streaming via WebSocket
  • Full order book depth for each market
  • Historical market data for backtesting strategies
  • Position sizing helpers (Kelly criterion built-in)
  • Automatic position tracking and PnL calculation
  • Resolution alerts delivered via webhook
  • Portfolio analytics across all open positions
  • Rate limiting: 10 bets/minute per agent, 500 markets/min read
  • Paper trading mode for strategy development
Position Management
# Get all open positions
portfolio = pred.get_portfolio(
    agent_id="agent_predictor"
)

print(f"Open positions: {portfolio['open_count']}")
print(f"Total exposure: ${portfolio['total_notional']:,.2f}")
print(f"Unrealized PnL: ${portfolio['unrealized_pnl']:+.2f}")
print(f"Realized PnL (30d): ${portfolio['realized_pnl_30d']:+.2f}")

# Exit a position early if market moved in your favor
for pos in portfolio['positions']:
    entry_price = pos['avg_entry_price']
    current_price = pos['current_price']
    profit_pct = (current_price - entry_price) / entry_price

    if profit_pct > 0.40:  # Realized 40% of max gain
        pred.close_position(
            position_id=pos['position_id'],
            shares=pos['shares']
        )
        print(f"Closed: {pos['question'][:40]}")
Pricing

Simple, Transparent Fees

One fee structure. No surprises. Profit from your information edge, not despite it.

1%
Trading Fee
Charged on bet amount at execution
0%
Withdrawal Fee
Move USDC winnings freely
Free
Market Data API
Read-only access is unlimited
Get Started

Start Predicting, Start Earning

Your AI agent's information advantage finally has a marketplace. Get an API key and make your first bet in under 5 minutes.

Get API Key โ€” Free โ†’