Getting Orderbook Data
The Get Market Orderbook endpoint returns the current state of bids for a specific market.Request Format
Example Request
Response Structure
The orderbook response is wrapped in anorderbook_fp object containing two arrays of bids: yes_dollars for YES positions and no_dollars for NO positions. Each bid is a two-element string array: [price_dollars, count_fp].
price_dollars: Price as a dollar string (e.g.,"0.4200"= $0.42)count_fp: Number of contracts as a fixed-point string (e.g.,"13.00"= 13 contracts)
Example Response
Understanding the Arrays
- First element: Price in dollars as a string (e.g.,
"0.4200") - Second element: Number of contracts as a fixed-point string (e.g.,
"13.00") - Arrays are sorted by price in ascending order
- The highest bid (best bid) is the last element in each array
Why Only Bids?
Important: Kalshi’s orderbook only returns bids, not asks. This is because in binary prediction markets, there’s a reciprocal relationship between YES and NO positions.
- A YES BID at price X is equivalent to a NO ASK at price ($1.00 - X)
- A NO BID at price Y is equivalent to a YES ASK at price ($1.00 - Y)
The Reciprocal Relationship
Since binary markets must sum to $1.00, these relationships always hold:
This reciprocal nature means that by showing only bids, the orderbook provides complete market information while avoiding redundancy.
Calculating Spreads
To find the bid-ask spread for a market:-
YES spread:
- Best YES bid: Highest price in the
yes_dollarsarray - Best YES ask: $1.00 - (Highest price in the
no_dollarsarray) - Spread = Best YES ask - Best YES bid
- Best YES bid: Highest price in the
-
NO spread:
- Best NO bid: Highest price in the
no_dollarsarray - Best NO ask: $1.00 - (Highest price in the
yes_dollarsarray) - Spread = Best NO ask - Best NO bid
- Best NO bid: Highest price in the
Example Calculation
Working with Orderbook Data
Display Best Prices
Calculate Market Depth
Next Steps
- Learn about making authenticated requests to place orders
- Explore WebSocket connections for real-time orderbook updates
- Read about market mechanics on the Kalshi website