Depth
Get market depth (Level 2 data) for a symbol showing top 5 bid and ask prices with quantities.
Endpoint URL
Local Host : POST http://127.0.0.1:5000/api/v1/depth
Ngrok Domain : POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/depth
Custom Domain: POST https://<your-custom-domain>/api/v1/depthSample API Request
{
"apikey": "<your_app_apikey>",
"symbol": "SBIN",
"exchange": "NSE"
}Sample cURL Request
curl -X POST http://127.0.0.1:5000/api/v1/depth \
-H 'Content-Type: application/json' \
-d '{
"apikey": "<your_app_apikey>",
"symbol": "SBIN",
"exchange": "NSE"
}'Sample API Response
Request Body
apikey
Your OpenAlgo API key
Mandatory
-
symbol
Trading symbol
Mandatory
-
exchange
Any value in the shared VALID_EXCHANGES list
Mandatory
-
These three fields are the complete DepthSchema. Any other field, including a depth-level count, returns HTTP 400. The number of levels returned is whatever the broker supplies.
Response Fields
status
string
"success" or "error"
data
object
Market depth data object
Data Object Fields
open
number
Day's open price
high
number
Day's high price
low
number
Day's low price
ltp
number
Last traded price
ltq
number
Last traded quantity
prev_close
number
Previous day's close
volume
number
Total traded volume
oi
number
Open interest (for F&O)
totalbuyqty
number
Total buy quantity in order book
totalsellqty
number
Total sell quantity in order book
asks
array
Top 5 ask (sell) prices
bids
array
Top 5 bid (buy) prices
Ask/Bid Array Fields
price
number
Price level
quantity
number
Quantity at this price
Understanding Market Depth
Notes
Depth shows the order book structure for a symbol
Bid-Ask spread indicates liquidity (tighter = more liquid)
totalbuyqty vs totalsellqty shows demand-supply balance
For F&O, oi (open interest) is available
The REST call returns one broker snapshot. Use WebSocket Depth for continuous updates.
Use Cases
Scalping strategies: Identify immediate support/resistance
Order placement: Decide limit price based on depth
Liquidity analysis: Assess ease of entry/exit
Related Endpoints
Quotes - Basic quote data
WebSocket Depth - Real-time depth streaming
Back to: API Documentation
Last updated
Was this helpful?