Skip to main content

Overview

Trade intervals determine how often your agent can place bets on the same market. This prevents overtrading, manages capital efficiently, and respects market dynamics.
Without trade intervals, an agent might continuously bet on the same market every time it runs, wasting gas fees and potentially moving the price against itself.

Why Trade Intervals Matter

Capital Efficiency

Avoid locking too much capital in the same market

Gas Optimization

Reduce unnecessary transaction costs

Price Impact

Give markets time to incorporate new information

Risk Management

Prevent over-concentration in single markets

Available Interval Types

The framework provides two main types of trade intervals:

FixedInterval

Wait a fixed amount of time before trading on the same market again.
from datetime import timedelta
from prediction_market_agent_tooling.deploy.trade_interval import (
    FixedInterval,
    TradeInterval,
)

class MyAgent(DeployableTraderAgent):
    same_market_trade_interval: TradeInterval = FixedInterval(timedelta(days=7))
interval
timedelta
required
Time to wait before trading the same market again

MarketLifetimeProportionalInterval

Trade multiple times based on market lifetime, spacing trades proportionally.
from prediction_market_agent_tooling.deploy.trade_interval import (
    MarketLifetimeProportionalInterval,
)

class MyAgent(DeployableTraderAgent):
    same_market_trade_interval = MarketLifetimeProportionalInterval(max_trades=4)
max_trades
int
required
Maximum number of trades to place over the market’s lifetime
If a market runs for 28 days and max_trades=4, the agent will trade roughly every 7 days (28/4).

Common Patterns

One-Time Trading

Never trade on the same market twice:
from datetime import timedelta

class OneTimeBettingAgent(DeployableTraderAgent):
    # Set interval longer than any market's lifetime
    same_market_trade_interval = FixedInterval(timedelta(days=1995))
This pattern is useful for:
  • Agents that target initial mispricings
  • Strategies that bet on market creation
  • Capital-constrained agents that need to diversify
Example from SkewAgent:
class SkewAgent(DeployableTraderAgent):
    # Bet on many markets, but never the same one twice
    bet_on_n_markets_per_run = 1000
    same_market_trade_interval = FixedInterval(timedelta(days=1995))
    get_markets_sort_by = SortBy.NEWEST  # Target fresh markets at 50/50

Weekly Rebalancing

Trade on markets once per week:
class WeeklyRebalancingAgent(DeployableTraderAgent):
    same_market_trade_interval = FixedInterval(timedelta(days=7))
Use cases:
  • Markets with evolving information
  • Long-running markets (>1 month)
  • Rebalancing based on new data
Example from GPTRHighestLiquidityAgent:
class GPTRHighestLiquidityAgent(GPTRAgent):
    get_markets_sort_by = SortBy.HIGHEST_LIQUIDITY
    bet_on_n_markets_per_run = 2
    same_market_trade_interval = FixedInterval(timedelta(days=7))

Bi-Weekly Updates

Trade every two weeks:
class BiWeeklyAgent(DeployableTraderAgent):
    same_market_trade_interval = FixedInterval(timedelta(days=14))
Example from DeployableCoinFlipAgentByHighestLiquidity:
class DeployableCoinFlipAgentByHighestLiquidity(DeployableCoinFlipAgent):
    get_markets_sort_by = SortBy.HIGHEST_LIQUIDITY
    bet_on_n_markets_per_run = 2
    same_market_trade_interval = FixedInterval(timedelta(days=14))

Proportional to Market Lifetime

Trade multiple times, spaced evenly across market’s life:
class ProportionalTradingAgent(DeployableTraderAgent):
    # Trade up to 4 times per market, evenly spaced
    same_market_trade_interval = MarketLifetimeProportionalInterval(max_trades=4)
How it works:
  • Market open for 8 days → trade every ~2 days
  • Market open for 40 days → trade every ~10 days
  • Market open for 365 days → trade every ~91 days
Example from prophet agents:
class DeployableTraderAgentER(DeployableTraderAgent):
    bet_on_n_markets_per_run = 2
    same_market_trade_interval = MarketLifetimeProportionalInterval(max_trades=4)
Proportional intervals are ideal for agents that want to:
  • Update positions as markets evolve
  • Balance frequent updates with capital efficiency
  • Adapt to both short and long-term markets

Choosing the Right Interval

When to use:
  • Markets with rapidly changing information
  • Scalping strategies
  • Arbitrage opportunities
Example:
same_market_trade_interval = FixedInterval(timedelta(hours=6))
Risks:
  • High gas costs
  • Price impact from frequent trading
  • Capital concentration
When to use:
  • General-purpose trading
  • Markets with moderate information flow
  • Balanced approach
Example:
same_market_trade_interval = FixedInterval(timedelta(days=7))
Best for:
  • Most production agents
  • Good balance of updates vs. costs
  • Standard rebalancing frequency
When to use:
  • Long-term markets
  • Lower-frequency strategies
  • Capital preservation
Example:
same_market_trade_interval = FixedInterval(timedelta(days=14))
Best for:
  • Conservative agents
  • High-liquidity focus
  • Cost-conscious strategies
When to use:
  • Initial mispricing capture
  • Maximum diversification
  • Capital-constrained agents
Example:
same_market_trade_interval = FixedInterval(timedelta(days=1995))
Best for:
  • New market strategies
  • Wide market coverage
  • Minimal gas usage
When to use:
  • Mixed market durations
  • Adaptive update frequency
  • Long-term position management
Example:
same_market_trade_interval = MarketLifetimeProportionalInterval(max_trades=4)
Best for:
  • Markets of varying durations
  • Balanced update strategy
  • Dynamic rebalancing

Combining Intervals with Other Settings

High Volume, One-Time Trading

class HighVolumeAgent(DeployableTraderAgent):
    """Trade on many markets once each"""
    bet_on_n_markets_per_run = 1000
    same_market_trade_interval = FixedInterval(timedelta(days=1995))
    get_markets_sort_by = SortBy.NEWEST

Focused, Frequent Updates

class FocusedAgent(DeployableTraderAgent):
    """Trade on few markets but update frequently"""
    bet_on_n_markets_per_run = 2
    same_market_trade_interval = FixedInterval(timedelta(days=7))
    get_markets_sort_by = SortBy.HIGHEST_LIQUIDITY

Adaptive to Market Duration

class AdaptiveAgent(DeployableTraderAgent):
    """Scale updates based on market lifetime"""
    bet_on_n_markets_per_run = 4
    same_market_trade_interval = MarketLifetimeProportionalInterval(max_trades=4)

Real-World Examples

Example 1: Market Creator Stalker

Targets specific market creators with moderate update frequency:
class MarketCreatorsStalkerAgent(DeployableTraderAgent):
    # Trade on all available markets from whitelisted creators
    bet_on_n_markets_per_run = MAX_AVAILABLE_MARKETS
    
    # But only update positions every 14 days
    same_market_trade_interval = FixedInterval(timedelta(days=14))
    
    def get_markets(self, market_type: MarketType) -> Sequence[AgentMarket]:
        return [
            OmenAgentMarket.from_data_model(m)
            for m in OmenSubgraphHandler().get_omen_markets_simple(
                limit=self.n_markets_to_fetch,
                creator_in=SPECIALIZED_FOR_MARKET_CREATORS,
            )
        ]

Example 2: GPT Researcher Agent

High-quality research with weekly rebalancing:
class GPTRAgent(DeployableTraderAgent):
    bet_on_n_markets_per_run = 4

    def answer_binary_market(self, market: AgentMarket) -> ProbabilisticAnswer | None:
        # Expensive: runs GPT Researcher
        report = gptr_research_sync(market.question)
        prediction = prophet_make_prediction(
            market_question=market.question,
            additional_information=report,
        )
        return prediction

class GPTRHighestLiquidityAgent(GPTRAgent):
    # Focus on fewer markets, update weekly
    get_markets_sort_by = SortBy.HIGHEST_LIQUIDITY
    bet_on_n_markets_per_run = 2
    same_market_trade_interval = FixedInterval(timedelta(days=7))

Example 3: Statistical Skew Agent

Maximize coverage, never repeat:
class SkewAgent(DeployableTraderAgent):
    supported_markets = [MarketType.OMEN]
    
    # Process as many markets as possible
    n_markets_to_fetch = 1000
    bet_on_n_markets_per_run = 1000
    
    # Never re-bet (simple statistical strategy)
    same_market_trade_interval = FixedInterval(timedelta(days=1995))
    
    # Target new markets at 50/50 starting prices
    get_markets_sort_by = SortBy.NEWEST
    
    def answer_binary_market(self, market: AgentMarket) -> ProbabilisticAnswer | None:
        # Simple statistical bet based on historical majority
        return ProbabilisticAnswer(
            p_yes=Probability(float(self.majority_resolution)),
            confidence=1.0,
            reasoning="Chosen based on majority resolution in recent history.",
        )

Advanced: Custom Interval Logic

For complex scenarios, override interval checking:
from prediction_market_agent_tooling.tools.utils import utcnow

class CustomIntervalAgent(DeployableTraderAgent):
    def should_trade_on_market(
        self,
        market: AgentMarket,
        last_trade_time: DatetimeUTC | None,
    ) -> bool:
        if last_trade_time is None:
            return True  # First trade
        
        # Custom logic: trade more frequently on high-volume markets
        if market.volume > 10000:
            min_interval = timedelta(days=3)
        else:
            min_interval = timedelta(days=14)
        
        time_since_last_trade = utcnow() - last_trade_time
        return time_since_last_trade >= min_interval

Trade Interval Best Practices

1

Start Conservative

Begin with longer intervals (14+ days) when testing new agents:
same_market_trade_interval = FixedInterval(timedelta(days=14))
2

Monitor Gas Costs

Calculate total gas costs vs. potential profit. More trades aren’t always better.
3

Consider Market Dynamics

  • Fast-moving news: Shorter intervals (1-3 days)
  • Long-term forecasts: Longer intervals (14+ days)
  • Fixed events: One-time bets
4

Balance Capital

# More markets = longer intervals (avoid capital concentration)
bet_on_n_markets_per_run = 10
same_market_trade_interval = FixedInterval(timedelta(days=14))

# Fewer markets = shorter intervals (more active management)
bet_on_n_markets_per_run = 2
same_market_trade_interval = FixedInterval(timedelta(days=7))

Default Behavior

If you don’t specify a trade interval, the default is:
# Default from DeployableTraderAgent
same_market_trade_interval = FixedInterval(timedelta(days=7))

Performance Considerations

Gas Optimization: On Gnosis Chain (Omen), gas is cheap (~$0.01/transaction). You can afford more frequent updates.Capital Efficiency: Longer intervals allow capital to work across more markets simultaneously.Information Edge: If your agent incorporates new information, shorter intervals capture more value.

Testing Trade Intervals

Test different intervals to find optimal settings:
# Test suite
test_configs = [
    {"interval": timedelta(days=1), "expected_trades": 30},
    {"interval": timedelta(days=7), "expected_trades": 4},
    {"interval": timedelta(days=14), "expected_trades": 2},
]

for config in test_configs:
    agent.same_market_trade_interval = FixedInterval(config["interval"])
    # Run backtest
    results = backtest_agent(agent, duration=timedelta(days=30))
    print(f"Interval: {config['interval']}, Trades: {results.total_trades}")

Next Steps

Agent Architecture

Understand the full agent lifecycle

Betting Strategies

Optimize bet sizes with Kelly criterion

Supported Markets

Learn about different market platforms

Build docs developers (and LLMs) love