Skip to main content

Parameters

Same shape as fetch_midpoint — uses the unified MidpointRequest type.
market_id
string
required
outcome
string?
token_id
string?

Returns

Spread
object
bid
f64
Best bid.
ask
f64
Best ask.
spread
f64
ask − bid.
ts_ms
i64?
Polymarket /spread returns just the spread number; OpenPX combines it with /midpoint to populate bid and ask (mid ± spread/2). When the midpoint is unavailable, bid is reported as 0.0 and ask as spread.
use openpx::MidpointRequest;

let s = ex.fetch_spread(MidpointRequest {
    market_id: "KXBTC-25MAR14-T20000".into(),
    ..Default::default()
}).await?;
println!("{} -> {} ({:.4} wide)", s.bid, s.ask, s.spread);
{ "bid": 0.42, "ask": 0.46, "spread": 0.04, "ts_ms": null }