The order book stores prices based on the Yes outcome.See the guide below to understand how to calculate the No outcome price.
Order Book Price Structure Overview#
The API returns the order book for a given market with the following JSON structure that contains depth details about both buy (bids) and sell (asks) prices for the Yes side of the market. To understand how to derive the corresponding No side prices, let’s break down the API response and how prices are calculated.Example API Response#
Here is an example of the API response structure:{
"success": true,
"data": {
"marketId": 1,
"updateTimestampMs": 1727910141000,
"asks": [
[0.492, 30192.26],
[0.493, 20003]
],
"bids": [
[0.491, 303518.1],
[0.49, 1365.44]
]
}
}
asks: A list of the current sell price depth based on the Yes side [price, quantity] (best/lowest ask first).
bids: A list of the current buy price depth based on the Yes side [price, quantity] (best/highest bid first).
Price Calculations#
The order book stores prices based on the Yes outcome. To get the equivalent prices for the No outcome, you need the complement price at the market’s decimal precision (so that Yes + No = 1 at that precision).1.
No Buy Price: This is the best price to buy No (equivalently: sell Yes into the best Yes bid). It’s calculated as:Explanation: bids[0][0] is the highest bid price for Yes. The corresponding best price to buy No is the complement of that Yes bid.
2.
No Sell Price: This is the best price to sell No (equivalently: buy Yes from the best Yes ask). It’s calculated as:Explanation: asks[0][0] is the lowest ask price for Yes. The corresponding best price to sell No is the complement of that Yes ask.
If you need the
full depth for the
No side (not just top-of-book), you transform the book by
swapping sides and complementing each level:
Notes#
Order Book Data: The order book (bids and asks) data is already sorted with the best prices first (bids[0] highest, asks[0] lowest).
Precision Matters: Use the same decimalPrecision as the market/backend expects. Using a raw 1 - price can produce values that don’t match backend rounding.
Price Range: Both Yes and No prices are constrained to the range [0, 1], reflecting probabilities in a market context.
Edge Cases: If there are no bids or asks (e.g., bids or asks arrays are empty), additional logic may be needed to handle these cases to avoid errors during price calculation.