- TypeScript
- Python
- API
Given a market, read its outcome token IDs:
Order Book
Retrieve the resting bids and asks for one outcome token. Bids are ordered by ascending price and asks by descending price, so the best bid and ask are the last entries in their respective arrays. Each response also includes ahash
for the order-book state. Compare it with the previous response’s hash to
determine whether the book changed between reads.
Fetch an Order Book
- TypeScript
- Python
- API
Call The returned
fetchOrderBook() on a PublicClient or SecureClient to fetch an outcome’s
order book.OrderBook describes its price levels and the market details
needed to interpret them:Fetch Multiple Order Books
Batch order-book reads return the resting bids and asks for several outcomes in one request.Maximum 500 items per request.
- TypeScript
- Python
- API
Call Each item uses the
fetchOrderBooks() on a PublicClient or SecureClient to fetch several order
books in one request.OrderBook shape described above:Best Market Price
Read the best available execution price for an outcome and side.BUY returns
the lowest ask, which is the price you would pay to buy. SELL returns the
highest bid, which is the price you would receive when selling.
Fetch a Price
- TypeScript
- Python
- API
Call The method returns the price as a decimal string:
fetchPrice() on a PublicClient or SecureClient to fetch the best price for
one side. For a BUY, the method returns the lowest ask.Fetch Multiple Prices
Batch price reads return the best market price for several outcome-and-side pairs in one request. Use them when the same view or calculation needs more than one outcome.Maximum 500 items per request.
- TypeScript
- Python
- API
Call
fetchPrices() on a PublicClient or SecureClient to fetch several prices in
one request.Prices maps each token ID to the requested side and price:Midpoint Price
The midpoint is the average of the best bid and best ask. It provides a reference price between the two sides of the order book.Fetch a Midpoint
- TypeScript
- Python
- API
Call The method returns the midpoint as a decimal string:
fetchMidpoint() on a PublicClient or SecureClient to fetch the midpoint.Fetch Multiple Midpoints
Fetch midpoint prices for several outcomes in one request.Maximum 500 items per request.
- TypeScript
- Python
- API
Call
fetchMidpoints() on a PublicClient or SecureClient to fetch several
midpoints.Midpoints maps each token ID to its midpoint:Spread
The spread is the difference between the best ask and best bid. A narrower spread indicates that the two sides of the order book are closer together.Fetch a Spread
- TypeScript
- Python
- API
Call The method returns the spread as a decimal string:
fetchSpread() on a PublicClient or SecureClient to fetch the spread.Fetch Multiple Spreads
Batch spread reads return the bid-ask spread for several outcomes in one request.Maximum 500 items per request.
- TypeScript
- Python
- API
Call The result maps each token ID to its spread:
fetchSpreads() on a PublicClient or SecureClient to fetch several spreads
in one request.Last Trade Price
The last trade price records the most recent matched trade for an outcome. It includes the trade price and side.Fetch a Last Trade Price
- TypeScript
- Python
- API
Call
fetchLastTradePrice() on a PublicClient or SecureClient to fetch the last
trade.LastTradePrice pairs the traded price with its order side:Fetch Multiple Last Trade Prices
Fetch the most recent matched trade for several outcomes in one request.Maximum 500 items per request.
- TypeScript
- Python
- API
Call Each
fetchLastTradePrices() on a PublicClient or SecureClient to fetch several
last trades.LastTradePriceForToken identifies the outcome alongside its traded
price and side:Price History
Price history is a time series of observed prices for an outcome. Fetch either a relative window or an absolute time range, but do not combine the two forms. You can also control the interval between returned observations; longer time ranges require a sampling interval.- TypeScript
- Python
- API
Call Each
fetchPriceHistory() on a PublicClient or SecureClient to fetch historical
prices. Set interval for a relative window, or set startTs and endTs
for an absolute range. Use fidelity to set the sampling interval in
minutes.PriceHistoryPoint contains a timestamp and its observed price: