Skip to main content

Overview

AgentMarket is the core interface for interacting with prediction markets across different platforms. It provides a unified API for accessing market metadata, current probabilities, liquidity, trading operations, and position management.

Import

Basic Properties

Market Identity

str
required
Unique identifier for the market
str
required
Direct URL to view the market on the platform
str
required
The market’s question or title

Market Outcomes

list[str]
required
List of possible outcomes (e.g., [“Yes”, “No”] for binary markets)
dict[str, Probability]
required
Current probability for each outcome

Market Type

MarketType
required
Platform where the market exists (OMEN, MANIFOLD, etc.)

Time Properties

datetime
required
When the market was created
datetime | None
When the market will close for trading
datetime | None
When the market was finalized/resolved

Scalar Market Properties

For numeric prediction markets:
float | None
Minimum possible value
float | None
Maximum possible value

Market Statistics

get_liquidity

Get the current liquidity available in the market.
TokenAmount
Current liquidity in the market’s native token

volume

TokenAmount | None
Total trading volume in the market

Trading Operations

get_trade_balance

Get available balance for trading on this market.
APIKeys
required
API keys for accessing wallet/account
TokenAmount
Available balance in the market’s token

place_bet

Execute a bet on the market.
str
required
The outcome to bet on (must be in market.outcomes)
TokenAmount
required
Amount to bet in the market’s token
APIKeys
required
API keys for executing the transaction

Position Management

get_positions

Get your current positions in this market.
str
required
User identifier (address or account ID)
list[Position]
List of current positions in the market

get_most_recent_trade_datetime

Get the timestamp of the most recent trade by a user.
str
required
User identifier
datetime | None
Timestamp of most recent trade, or None if no trades

get_user_id

Get the user identifier for the current agent.
APIKeys
required
API keys to derive user ID from
str
User identifier (wallet address or account ID)

Resolution Status

str | None
The resolved outcome if market is finalized, None otherwise

Token Conversion

get_in_token

Convert an amount to the market’s native token.
TokenAmount
required
Amount to convert (e.g., USD)
TokenAmount
Equivalent amount in market’s token

Fetching Markets

get_binary_markets

Fetch binary (yes/no) markets from a platform.
int
required
Maximum number of markets to fetch
MarketType
required
Platform to fetch from
FilterBy
default:"FilterBy.OPEN"
Filter criteria (OPEN, RESOLVED, etc.)
SortBy
default:"SortBy.NONE"
Sort order (NEWEST, HIGHEST_LIQUIDITY, etc.)

Filter and Sort Options

FilterBy

SortBy

Platform-Specific Implementations

OmenAgentMarket

Complete Example

See Also