Get Order Book
Retrieve the order book for a market, including the top 10 bid and ask price levels as seen from each outcome. YES and NO share a single book: a NO bid at X appears as a YES ask at 100 − X (and vice versa), so each outcome's view is the mirror of the other. Only open limit orders (status OPEN or PARTIALLY_FILLED) are included.
Endpoint
GET /api/v1/market/order-book?marketId={uuid}Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| marketId | UUID | Yes | The ID of the market |
Response
Returns the order book for both outcomes (status 200). Each level aggregates the unfilled quantity resting at that price, with total the cumulative quantity from the best price. Bids are sorted by price descending (highest first), asks by price ascending (lowest first). lastTradePrice is the most recent execution price on that outcome, or null if none.
{
"orderBookYes": {
"bids": [
{
"price": 65,
"quantity": 10,
"total": 10
},
{
"price": 60,
"quantity": 25,
"total": 35
}
],
"asks": [
{
"price": 70,
"quantity": 5,
"total": 5
},
{
"price": 75,
"quantity": 15,
"total": 20
}
],
"lastTradePrice": 66
},
"orderBookNo": {
"bids": [
{
"price": 30,
"quantity": 5,
"total": 5
},
{
"price": 25,
"quantity": 15,
"total": 20
}
],
"asks": [
{
"price": 35,
"quantity": 10,
"total": 10
},
{
"price": 40,
"quantity": 25,
"total": 35
}
],
"lastTradePrice": 34
}
}Example
import requests
API_KEY = "your_api_key"
BASE_URL = "https://www.vancouverpx.ca/api/v1"
def get_order_book(market_id: str) -> dict:
response = requests.get(
f"{BASE_URL}/market/order-book",
params={"marketId": market_id},
headers={"Authorization": f"Bearer {API_KEY}"},
)
response.raise_for_status()
return response.json()
book = get_order_book("your-market-uuid")
yes_bids = book["orderBookYes"]["bids"]
yes_asks = book["orderBookYes"]["asks"]
print(f"Best YES bid: {yes_bids[0]['price']}¢" if yes_bids else "No bids")
print(f"Best YES ask: {yes_asks[0]['price']}¢" if yes_asks else "No asks")