pub struct Market {Show 54 fields
pub openpx_id: String,
pub exchange: String,
pub id: String,
pub group_id: Option<String>,
pub event_id: Option<String>,
pub title: String,
pub question: Option<String>,
pub description: String,
pub slug: Option<String>,
pub rules: Option<String>,
pub status: MarketStatus,
pub market_type: MarketType,
pub accepting_orders: bool,
pub outcomes: Vec<String>,
pub outcome_tokens: Vec<OutcomeToken>,
pub outcome_prices: HashMap<String, f64>,
pub token_id_yes: Option<String>,
pub token_id_no: Option<String>,
pub condition_id: Option<String>,
pub question_id: Option<String>,
pub volume: f64,
pub volume_24h: Option<f64>,
pub volume_1wk: Option<f64>,
pub volume_1mo: Option<f64>,
pub liquidity: Option<f64>,
pub open_interest: Option<f64>,
pub last_trade_price: Option<f64>,
pub best_bid: Option<f64>,
pub best_ask: Option<f64>,
pub spread: Option<f64>,
pub price_change_1d: Option<f64>,
pub price_change_1h: Option<f64>,
pub price_change_1wk: Option<f64>,
pub price_change_1mo: Option<f64>,
pub tick_size: Option<f64>,
pub min_order_size: Option<f64>,
pub close_time: Option<DateTime<Utc>>,
pub open_time: Option<DateTime<Utc>>,
pub created_at: Option<DateTime<Utc>>,
pub settlement_time: Option<DateTime<Utc>>,
pub image_url: Option<String>,
pub icon_url: Option<String>,
pub neg_risk: Option<bool>,
pub neg_risk_market_id: Option<String>,
pub maker_fee_bps: Option<f64>,
pub taker_fee_bps: Option<f64>,
pub denomination_token: Option<String>,
pub chain_id: Option<String>,
pub notional_value: Option<f64>,
pub price_level_structure: Option<String>,
pub settlement_value: Option<f64>,
pub previous_price: Option<f64>,
pub can_close_early: Option<bool>,
pub result: Option<String>,
}Expand description
Unified prediction market model.
All exchanges produce this single type directly — no intermediate conversion.
§Price Format
All prices are normalized to decimal format (0.0 to 1.0). Exchange-specific conversions are handled during parsing:
- Kalshi: Fixed-point dollar strings parsed directly (post March 2026 migration).
- Polymarket, Opinion: Native prices already in decimal (0.0-1.0).
Fields§
§openpx_id: StringPrimary key: {exchange}:{native_id}
exchange: StringExchange identifier (kalshi, polymarket, opinion)
id: StringNative exchange market ID
group_id: Option<String>Source-native event/group ID from the exchange.
event_id: Option<String>Canonical OpenPX event ID for cross-exchange event grouping.
title: StringMarket title
question: Option<String>Market question (may differ from title)
description: StringFull description
slug: Option<String>URL-friendly identifier
rules: Option<String>Resolution rules
status: MarketStatusNormalized status: Active, Closed, Resolved
market_type: MarketTypeMarket type classification
accepting_orders: boolWhether the market is currently accepting orders
outcomes: Vec<String>Outcome labels (e.g., [“Yes”, “No”] for binary markets)
outcome_tokens: Vec<OutcomeToken>Outcome-to-token mapping for orderbook subscriptions
outcome_prices: HashMap<String, f64>Outcome prices from the REST API (e.g., {“Yes”: 0.65, “No”: 0.35})
token_id_yes: Option<String>Yes outcome token ID
token_id_no: Option<String>No outcome token ID
condition_id: Option<String>Condition ID for CTF
question_id: Option<String>Question ID (Opinion, Polymarket)
volume: f64Total volume (USD)
volume_24h: Option<f64>24-hour trading volume (USD)
volume_1wk: Option<f64>7-day rolling trading volume (USD)
volume_1mo: Option<f64>30-day rolling trading volume (USD)
liquidity: Option<f64>Current liquidity
open_interest: Option<f64>Current open interest
last_trade_price: Option<f64>Last trade price (normalized 0-1)
best_bid: Option<f64>Best bid price (normalized 0-1)
best_ask: Option<f64>Best ask price (normalized 0-1)
spread: Option<f64>Bid-ask spread (decimal)
price_change_1d: Option<f64>24-hour YES price change (decimal, e.g. 0.05 = +5%)
price_change_1h: Option<f64>1-hour YES price change
price_change_1wk: Option<f64>7-day YES price change
price_change_1mo: Option<f64>30-day YES price change
tick_size: Option<f64>Tick size (minimum price increment, normalized decimal e.g. 0.01)
min_order_size: Option<f64>Minimum order size (contracts)
close_time: Option<DateTime<Utc>>Market close time
open_time: Option<DateTime<Utc>>Market open time
created_at: Option<DateTime<Utc>>Market creation time
settlement_time: Option<DateTime<Utc>>Settlement / resolution time
image_url: Option<String>Market image URL
icon_url: Option<String>Market icon URL
neg_risk: Option<bool>Polymarket: neg-risk flag
neg_risk_market_id: Option<String>Polymarket: neg-risk market ID
maker_fee_bps: Option<f64>Maker fee rate (basis points)
taker_fee_bps: Option<f64>Taker fee rate (basis points)
denomination_token: Option<String>Denomination token (e.g. USDC address)
chain_id: Option<String>Chain ID for on-chain markets
notional_value: Option<f64>Notional value per contract (Kalshi)
price_level_structure: Option<String>Kalshi sub-penny pricing structure
settlement_value: Option<f64>Kalshi: settlement value
previous_price: Option<f64>Kalshi: previous price
can_close_early: Option<bool>Kalshi: can close early
result: Option<String>Resolution result
Implementations§
Source§impl Market
impl Market
Sourcepub fn make_openpx_id(exchange: &str, id: &str) -> String
pub fn make_openpx_id(exchange: &str, id: &str) -> String
Create openpx_id from exchange and native id
Sourcepub fn parse_openpx_id(openpx_id: &str) -> Option<(&str, &str)>
pub fn parse_openpx_id(openpx_id: &str) -> Option<(&str, &str)>
Parse openpx_id into (exchange, native_id)
Sourcepub fn matches_search(&self, query: &str) -> bool
pub fn matches_search(&self, query: &str) -> bool
Check if market matches search query (case-insensitive)
pub fn is_binary(&self) -> bool
pub fn is_open(&self) -> bool
Sourcepub fn computed_spread(&self) -> Option<f64>
pub fn computed_spread(&self) -> Option<f64>
Compute bid-ask spread from outcome prices for binary markets.
pub fn get_token_ids(&self) -> Vec<String>
pub fn get_outcome_tokens(&self) -> Vec<OutcomeToken>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Market
impl<'de> Deserialize<'de> for Market
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Market, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Market, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Market
impl Serialize for Market
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Market
impl RefUnwindSafe for Market
impl Send for Market
impl Sync for Market
impl Unpin for Market
impl UnsafeUnpin for Market
impl UnwindSafe for Market
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more