REST APIMarkets

Get market quote

GET
/markets/{id}/quote

Get the best bid and best ask resting on a market's order book, quoted against the outcome whose indexSet is 1, as the book itself is.

Prefer this over the full order book when only the current price matters, and over the quotes embedded in a market payload, which are deprecated.

Authorization

ApiKeyAuth
headerx-api-key<token>

API key authentication via the x-api-key header.

Path Parameters

id*integer

The market's ID.

Formatint64

Response Body

application/json; charset=utf-8
  1. response

Response for GET /v1/markets/:id/quote

success*boolean
data*

Top of a market's order book: the best price resting on each side.

This is the lightweight alternative to fetching a whole order book, or to reading the quotes that used to be embedded in a market payload. Both sides come from a single reading, so the two ends of a spread are always observed at the same instant.

Prices are quoted against the outcome whose indexSet is 1, the same convention the order book itself uses. To price the complementary outcome, swap the sides and subtract from one: its best bid is 1 - bestAsk.price and its best ask is 1 - bestBid.price, at the same sizes. Round the result to six decimal places, or binary floating point will hand you values like 0.17000000000000004.

A quote reports the order book as it stands and says nothing about whether the market is still trading. Read the market itself for that, and note that an absent quote means only that no book is being maintained.

Example Request
curl -X GET 'https://api.predict.fun/v1/markets/0/quote'
Example Response
{  "success": true,  "data": {    "marketId": 0,    "updateTimestampMs": 0,    "bestBid": {      "price": 0.1,      "size": 0.1    },    "bestAsk": {      "price": 0.1,      "size": 0.1    }  }}