Overview
All trading agents in this framework inherit from theDeployableTraderAgent 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
TheDeployableTraderAgent 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. ReturnFalse 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 firstSortBy.HIGHEST_LIQUIDITY- Most liquid markets firstSortBy.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 torun_agent.py:
See the Quickstart guide for complete setup instructions and the Markets page to learn about supported market platforms.
Agent Lifecycle
- Load: Agent initializes (optional
load()method) - Get Markets: Fetch available markets based on sorting and filtering
- Verify: Check each market with
verify_market() - Answer: Generate predictions with
answer_binary_market() - Calculate Bet: Determine bet size using betting strategy
- Execute: Place trades on the market
- Sleep: Wait for next run based on trade intervals
Advanced Patterns
Custom Market Fetching
Overrideget_markets() for complete control:
Stateful Agents
Use theload() 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