Skip to main content

Overview

DeployableTraderAgent is the core abstract base class from prediction-market-agent-tooling for building automated trading agents. It provides a complete framework for discovering markets, generating predictions, managing betting strategies, and executing trades across multiple prediction market platforms.

Import

Basic Usage

Core Methods

answer_binary_market

Generate a prediction for a binary (yes/no) market.
AgentMarket
required
The market to analyze and predict
ProbabilisticAnswer | None
Your prediction with probability, confidence, and reasoning. Return None to skip the market.
Example:

answer_categorical_market

Generate a prediction for a categorical (multiple choice) market.
AgentMarket
required
The categorical market to analyze
CategoricalProbabilisticAnswer | None
Probabilities for each outcome. Return None to skip the market.
Example:

answer_scalar_market

Generate a prediction for a scalar (numeric range) market.
AgentMarket
required
The scalar market with upper and lower bounds
ScalarProbabilisticAnswer | None
Prediction within the market’s defined range. Return None to skip.
Example:

verify_market

Filter markets before processing. Override to implement custom market selection logic.
MarketType
required
The type of market platform (OMEN, MANIFOLD, etc.)
AgentMarket
required
The market to verify
bool
True to process the market, False to skip it
Example:

get_betting_strategy

Customize betting behavior for each market.
AgentMarket
required
The market being traded
BettingStrategy
Strategy controlling bet sizing and risk parameters
Example:

load

Initialize agent resources before market processing begins.
Example:

before_process_markets

Run setup tasks before market processing starts.
MarketType
required
The market platform being processed
Example:

get_markets

Retrieve and filter markets to process. Override for custom market selection.
MarketType
required
The market platform to fetch from
Sequence[AgentMarket]
List of markets to process
Example:

Configuration Attributes

bet_on_n_markets_per_run

int
default:"1"
Maximum number of markets to trade on per execution

n_markets_to_fetch

int
default:"50"
Number of markets to fetch from the platform

get_markets_sort_by

SortBy
default:"SortBy.NONE"
Sort order for fetched markets

same_market_trade_interval

TradeInterval
default:"Never"
Time interval between trades on the same market

supported_markets

list[MarketType]
default:"All markets"
List of supported market platforms

trade_on_markets_created_after

DatetimeUTC | None
default:"None"
Only trade on markets created after this timestamp

Deployment

run

Execute the agent’s main trading loop.
MarketType
required
The market platform to trade on
Example:

deploy_local

Run the agent locally with continuous execution.
MarketType
required
The market platform to trade on
float
required
Seconds to sleep between runs
float | None
default:"None"
Total runtime in seconds (None for infinite)
Example:

Constructor Parameters

bool
default:"True"
Whether to actually execute trades (False for dry-run mode)
bool
default:"True"
Whether to store predictions to database
bool
default:"True"
Whether to store trade records to database
bool
default:"True"
Enable Langfuse observability tracking

Complete Example

See Also