For the complete documentation index, see llms.txt. This page is also available as Markdown.

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/depth

Sample 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

Parameter
Description
Mandatory/Optional
Default Value

apikey

Your OpenAlgo API key

Mandatory

-

symbol

Trading symbol

Mandatory

-

exchange

Exchange code: NSE, BSE, NFO, BFO, CDS, BCD, MCX

Mandatory

-

Response Fields

Field
Type
Description

status

string

"success" or "error"

data

object

Market depth data object

Data Object Fields

Field
Type
Description

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

Field
Type
Description

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


Back to: API Documentation

Last updated