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].
bids: A list of the current buy price depth based on the Yes side [price, quantity].
Price Calculations#
The order book stores prices based on the Yes outcome. To get the equivalent prices for the No outcome, use the following calculations:1.
No Buy Price: This is the price at which someone can "sell" No. It’s calculated as:Explanation: Since the bids array is sorted by price, bids[0][0] gives the highest bid price for Yes. Subtracting this value from 1 gives the corresponding No price.
2.
No Sell Price: This is the price at which someone can "buy" No. It’s calculated as:Explanation: Since the asks array is sorted by price, asks[0][0] gives the lowest ask price for Yes. Subtracting this value from 1 gives the corresponding No price.
Notes#
Order Book Data: The order book (bids and asks) data is already sorted, with the best prices first. This makes it easy to access the current highest bid (bids[0][0]) and lowest ask (asks[0][0]) directly for price calculations.
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.
By following these formulas, you can accurately derive the current market prices for both Yes and No outcomes based on the order book data provided by the API.