Skip to Content
API ReferenceREST APIGET /orderbook

GET /orderbook

Returns the current orderbook snapshot for a market.

Request

Query Parameters:

NameTypeRequiredDescription
marketIdnumberYes*Market ID
symbolstringYes*Market symbol (e.g., “BTCUSD”)

*One of marketId or symbol is required.

# By market ID curl "https://zo-mainnet.n1.xyz/orderbook?marketId=0" # By symbol curl "https://zo-mainnet.n1.xyz/orderbook?symbol=BTCUSD"

Response

{ "bids": [ [97500.0, 1.5], [97490.0, 2.3], [97480.0, 0.8] ], "asks": [ [97510.0, 1.2], [97520.0, 1.8], [97530.0, 3.1] ] }

Response Fields

FieldTypeDescription
bids[price, size][]Array of bid levels (buy orders), sorted by price descending
asks[price, size][]Array of ask levels (sell orders), sorted by price ascending

Each level is a tuple of [price, size] where:

  • price: Limit price
  • size: Total quantity at that price level

Example: Python

import requests response = requests.get("https://zo-mainnet.n1.xyz/orderbook", params={"marketId": 0}) orderbook = response.json() print("Top 5 Bids:") for price, size in orderbook["bids"][:5]: print(f" ${price:,.1f} x {size:.4f}") print("\nTop 5 Asks:") for price, size in orderbook["asks"][:5]: print(f" ${price:,.1f} x {size:.4f}") # Calculate mid price best_bid = orderbook["bids"][0][0] if orderbook["bids"] else 0 best_ask = orderbook["asks"][0][0] if orderbook["asks"] else 0 mid_price = (best_bid + best_ask) / 2 print(f"\nMid Price: ${mid_price:,.2f}")
Last updated on