Skip to main content

Overview

All trading agents in this framework inherit from the DeployableTraderAgent base class provided by the prediction-market-agent-tooling library. This base class provides a standardized interface for interacting with multiple prediction market platforms.

The DeployableTraderAgent Class

The DeployableTraderAgent is the foundation for all prediction market trading agents. It handles:
  • Market discovery and filtering
  • Trade execution and position management
  • Rate limiting and trade intervals
  • Multi-platform support (Omen, Manifold, Polymarket, Metaculus)

Core Methods

Every agent must implement specific methods to define its trading behavior:

answer_binary_market()

The primary method that generates predictions for binary markets. This is where your agent’s logic lives.

verify_market() (Optional)

Filter markets before processing them. Return False to skip a market.

get_betting_strategy() (Optional)

Define how much to bet on each market. See the Betting Strategies page for details.

Configuration Properties

Agents can override class properties to customize behavior:
int
default:"1"
Number of markets to trade on each execution
SortBy
default:"SortBy.CLOSING_SOONEST"
How to sort available markets:
  • SortBy.CLOSING_SOONEST - Markets closing soon first
  • SortBy.HIGHEST_LIQUIDITY - Most liquid markets first
  • SortBy.NEWEST - Recently created markets first
TradeInterval
default:"FixedInterval(days=7)"
How often to trade on the same market. See Trade Intervals for details.
list[MarketType]
default:"All markets"
Limit which market platforms your agent supports

Complete Example: Liquidity-Focused Agent

Here’s a complete agent that targets high-liquidity markets and trades frequently:

Running Your Agent

Once you’ve created an agent, add it to run_agent.py:
Then run it:
See the Quickstart guide for complete setup instructions and the Markets page to learn about supported market platforms.

Agent Lifecycle

  1. Load: Agent initializes (optional load() method)
  2. Get Markets: Fetch available markets based on sorting and filtering
  3. Verify: Check each market with verify_market()
  4. Answer: Generate predictions with answer_binary_market()
  5. Calculate Bet: Determine bet size using betting strategy
  6. Execute: Place trades on the market
  7. Sleep: Wait for next run based on trade intervals

Advanced Patterns

Custom Market Fetching

Override get_markets() for complete control:

Stateful Agents

Use the load() method to initialize state:

Next Steps

Markets

Learn about supported market platforms

Betting Strategies

Optimize your bet sizing with Kelly criterion

Trade Intervals

Control when your agent trades on markets